将几何点从 GeoJSON 转换为纬度和经度
Converting a geometry point from GeoJSON to latitude and longitude
我有一个包含 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?
非常感谢。
仅此条目中的信息似乎不足以转换为纬度和经度。为此,您还需要点的坐标参考系统。但是,假设 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
中的点将在 longitude/latitude 中。
我有一个包含 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?
非常感谢。
仅此条目中的信息似乎不足以转换为纬度和经度。为此,您还需要点的坐标参考系统。但是,假设 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
中的点将在 longitude/latitude 中。