将几何点从GeoJSON转换为纬度和经度

时间:2017-02-08 16:39:33

标签: python maps gis geopandas

我有一个包含GeoJSON对象的列表,如下所示:

{ 
    "type": "Feature", 
    "properties": { 
        "ListEntry": 1440052.000000, 
        "Name": "Edmonton War Memorial", 
        "Location": "Enfield, London, N9", 
        "Grade": "II",
        "ListDate": "2017\/01\/13",
        "AmendDate": null, 
        "LegacyUID": null,
        "NGR": "TQ3435693567",
        "CaptureSca": "1:1250", 
        "Easting": 534356.190450,
        "Northing": 193567.535720
    },
    "geometry": { 
        "type": "Point",
         "coordinates": [ 
             534356.190499999560416,
             193567.535700000822544 
          ]
    }
}

重新geometry密钥,如何将coordinates转换为传统的纬度和经度,最好是在Python中?

非常感谢。

1 个答案:

答案 0 :(得分:1)

单独此条目中的信息似乎不足以转换为纬度和经度。为此,您还需要点的坐标参考系。但是,假设geojson保存在一个文件" points.json"并且您知道对应于坐标参考系统的epsg代码,您可以执行以下操作:

import geopandas as gp
gdf = gp.read_file("points.json")
epsg_code = 32630              # my guess based on a quick search, but evidently wrong
gdf.crs = {"init": "epsg:{}".format(epsg_code)}
gdf_reprojected = gdf.to_crs({"init": "epsg:4326"})

gdf_reprojected中的点数将位于经度/纬度。