converter.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:sentinel-s3 作者: developmentseed 项目源码 文件源码
def to_latlon(geojson, origin_espg=None):
    """
    Convert a given geojson to wgs84. The original epsg must be included insde the crs
    tag of geojson
    """

    if isinstance(geojson, dict):

        # get epsg code:
        if origin_espg:
            code = origin_espg
        else:
            code = epsg_code(geojson)
        if code:
            origin = Proj(init='epsg:%s' % code)
            wgs84 = Proj(init='epsg:4326')
            wrapped = test_wrap_coordinates(geojson['coordinates'], origin, wgs84)
            new_coords = convert_coordinates(geojson['coordinates'], origin, wgs84, wrapped)
            if new_coords:
                geojson['coordinates'] = new_coords
            try:
                del geojson['crs']
            except KeyError:
                pass

    return geojson
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号