当前位置: 首页>>代码示例>>Python>>正文


Python crs.from_epsg方法代码示例

本文整理汇总了Python中fiona.crs.from_epsg方法的典型用法代码示例。如果您正苦于以下问题:Python crs.from_epsg方法的具体用法?Python crs.from_epsg怎么用?Python crs.from_epsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fiona.crs的用法示例。


在下文中一共展示了crs.from_epsg方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: latlon_to_shp

# 需要导入模块: from fiona import crs [as 别名]
# 或者: from fiona.crs import from_epsg [as 别名]
def latlon_to_shp(lon, lat, shapefile):

    shapefile = str(shapefile)

    schema = {'geometry': 'Point',
              'properties': {'id': 'str'}}

    wkt = loads('POINT ({} {})'.format(lon, lat))

    with collection(shapefile, "w",
                    crs=from_epsg(4326),
                    driver="ESRI Shapefile",
                    schema=schema) as output:

        output.write({'geometry': mapping(wkt),
                      'properties': {'id': '1'}}) 
开发者ID:ESA-PhiLab,项目名称:OpenSarToolkit,代码行数:18,代码来源:vector.py

示例2: projectShapes

# 需要导入模块: from fiona import crs [as 别名]
# 或者: from fiona.crs import from_epsg [as 别名]
def projectShapes(features, toCRS):
    import pyproj
    from functools import partial
    import fiona.crs as fcrs
    from shapely.geometry import shape, mapping
    from shapely.ops import transform as shpTrans

    project = partial(
        pyproj.transform,
        pyproj.Proj(fcrs.from_epsg(4326)),
        pyproj.Proj(toCRS))

    return list(
        {'geometry': mapping(
            shpTrans(
                project,
                shape(feat['geometry']))
        )} for feat in features
        ) 
开发者ID:mapbox,项目名称:make-surface,代码行数:21,代码来源:fill_facets.py

示例3: generate_empty_md_graph

# 需要导入模块: from fiona import crs [as 别名]
# 或者: from fiona.crs import from_epsg [as 别名]
def generate_empty_md_graph(name: str,
                            init_crs: Dict=crs.from_epsg(WGS84)):
    """
    Generates an empty multi-directed graph.

    Parameters
    ———————
    name : str
        The name of the graph
    init_crs : dict
        The coordinate reference system to be assigned to the graph. Example \
        CRS would be `{'init': 'epsg:4326'}`

    Returns
    ——
    G : nx.MultiDiGraph
        The muti-directed graph
    """
    return nx.MultiDiGraph(name=name, crs=init_crs) 
开发者ID:kuanb,项目名称:peartree,代码行数:21,代码来源:graph.py

示例4: make_shp

# 需要导入模块: from fiona import crs [as 别名]
# 或者: from fiona.crs import from_epsg [as 别名]
def make_shp(tree_csv, points, hashid):
    """
    수목정보와 좌표정보를 매칭시켜 shp파일을 생성합니다
    :param tree_csv:
    :param points:
    :return:
    """
    shp_driver = 'ESRI Shapefile'
    properties = OrderedDict([
        # tree_csv에서 가져올 정보
        ('탐방로', str), ('구간', int), ('좌우', str), ('종명', str), ('개화', int), ('결실', int), ('비고', str),
        # point_csv에서 가져올 정보
        ('경도', float), ('위도', float), ('고도', int)
    ])
    # 타입별 기본값
    shp_schema = {
        #
        'properties': [(atr, properties[atr].__name__) for atr in properties],
        'geometry': 'Point'
    }
    shp_crs = crs.from_epsg(4326)
    file = f'/tmp/{hashid}.shp'
    with fiona.open(file, 'w', encoding="utf-8", driver=shp_driver, schema=shp_schema, crs=shp_crs) as shp:
        for row in tree_csv:
            # 구간 번호
            point_num = int(row['구간'])
            # 수목의 구간번호에 매칭하는 좌표 정보
            point_info = points[point_num]
            # shp에 입력될 형식
            record = make_record(properties, 1, row, point_info)
            shp.write(record)
    return file 
开发者ID:awskrug,项目名称:handson-labs-2018,代码行数:34,代码来源:csv2shp.py

示例5: to_crs

# 需要导入模块: from fiona import crs [as 别名]
# 或者: from fiona.crs import from_epsg [as 别名]
def to_crs(self, crs):
        """
        Returns the trajectory reprojected to the target CRS.

        Parameters
        ----------
        crs : pyproj.CRS
            Target coordinate reference system

        Returns
        -------
        Trajectory

        Examples
        --------
        Reproject a trajectory to EPSG:4088

        >>> from pyproj import CRS
        >>> reprojected = trajectory.to_crs(CRS(4088))
        """
        temp = self.copy()
        temp.crs = crs
        temp.df = temp.df.to_crs(crs)
        if type(crs) == CRS:
            temp.is_latlon = crs.is_geographic
        else:
            temp.is_latlon = crs['init'] == from_epsg(4326)['init']
        return temp 
开发者ID:anitagraser,项目名称:movingpandas,代码行数:30,代码来源:trajectory.py

示例6: extract_tile_items

# 需要导入模块: from fiona import crs [as 别名]
# 或者: from fiona.crs import from_epsg [as 别名]
def extract_tile_items(
    raster_features, labels, min_x, min_y, tile_width, tile_height
):
    """Extract label items that belong to the tile defined by the minimum
    horizontal pixel `min_x` (left tile limit), the minimum vertical pixel
    `min_y` (upper tile limit) and the sizes ̀tile_width` and `tile_height`
    measured as a pixel amount.

    The tile is cropped from the original image raster as follows:
      - horizontally, between `min_x` and `min_x+tile_width`
      - vertically, between `min_y` and `min_y+tile_height`

    This method takes care of original data projection (UTM 37S, Tanzania
    area), however this parameter may be changed if similar data on another
    projection is used.

    Parameters
    ----------
    raster_features : dict
        Raw image raster geographical features (`north`, `south`, `east` and
    `west` coordinates, `weight` and `height` measured in pixels)
    labels : geopandas.GeoDataFrame
        Raw image labels, as a set of geometries
    min_x : int
        Left tile limit, as a horizontal pixel index
    min_y : int
        Upper tile limit, as a vertical pixel index
    tile_width : int
        Tile width, measured in pixel
    tile_height : int
        Tile height, measured in pixel

    Returns
    -------
    geopandas.GeoDataFrame
        Set of ground-truth labels contained into the tile, characterized by
    their type (complete, unfinished or foundation) and their geometry

    """
    area = get_tile_footprint(
        raster_features, min_x, min_y, tile_width, tile_height
    )
    bdf = gpd.GeoDataFrame(
        crs=from_epsg(raster_features["srid"]), geometry=[area]
    )
    reproj_labels = labels.to_crs(epsg=raster_features["srid"])
    tile_items = gpd.sjoin(reproj_labels, bdf)
    if tile_items.shape[0] == 0:
        return tile_items[["condition", "geometry"]]
    tile_items = gpd.overlay(tile_items, bdf)
    tile_items = tile_items.explode()  # Manage MultiPolygons
    return tile_items[["condition", "geometry"]] 
开发者ID:Oslandia,项目名称:deeposlandia,代码行数:54,代码来源:geometries.py

示例7: __init__

# 需要导入模块: from fiona import crs [as 别名]
# 或者: from fiona.crs import from_epsg [as 别名]
def __init__(self, df, traj_id, obj_id=None, parent=None):
        """
        Create Trajectory from GeoDataFrame.

        Parameters
        ----------
        df : GeoDataFrame
            GeoDataFrame with point geometry column and timestamp index
        traj_id : any
            Trajectory ID
        obj_id : any
            Moving object ID
        parent : Trajectory
            Parent trajectory

        Examples
        --------
        Creating a trajectory from scratch:

        >>> import pandas as pd
        >>> import geopandas as gpd
        >>> import movingpandas as mpd
        >>> from fiona.crs import from_epsg
        >>>
        >>> df = pd.DataFrame([
        ...     {'geometry':Point(0,0), 't':datetime(2018,1,1,12,0,0)},
        ...     {'geometry':Point(6,0), 't':datetime(2018,1,1,12,6,0)},
        ...     {'geometry':Point(6,6), 't':datetime(2018,1,1,12,10,0)},
        ...     {'geometry':Point(9,9), 't':datetime(2018,1,1,12,15,0)}
        ... ]).set_index('t')
        >>> gdf = gpd.GeoDataFrame(df, crs=from_epsg(31256))
        >>> traj = mpd.Trajectory(gdf, 1)

        For more examples, see the tutorial notebooks_.

        .. _notebooks: https://mybinder.org/v2/gh/anitagraser/movingpandas/binder-tag?filepath=tutorials/0_getting_started.ipynb
        """
        if len(df) < 2:
            raise ValueError("Trajectory dataframe must have at least two rows!")

        self.id = traj_id
        self.obj_id = obj_id
        df.sort_index(inplace=True)
        self.df = df[~df.index.duplicated(keep='first')]
        #self.df['t'] = self.df.index
        self.crs = df.crs
        self.parent = parent
        if self.crs is None:
            self.is_latlon = False
            return
        try:
            crs = CRS.from_user_input(self.crs)
            self.is_latlon = crs.is_geographic
        except NameError:
            self.is_latlon = self.crs['init'] == from_epsg(4326)['init'] 
开发者ID:anitagraser,项目名称:movingpandas,代码行数:57,代码来源:trajectory.py


注:本文中的fiona.crs.from_epsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。