【问题标题】:Converting a geometry point from GeoJSON to latitude and longitude将几何点从 GeoJSON 转换为纬度和经度
【发布时间】:2017-02-08 16:39:33
【问题描述】:

我有一个包含 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 中?

非常感谢。

【问题讨论】:

    标签: python maps gis geopandas


    【解决方案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 中的点将采用经度/纬度。

    【讨论】:

      猜你喜欢
      • 2014-05-01
      • 2013-09-09
      • 2021-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      相关资源
      最近更新 更多