简体   繁体   English

如何编辑 geojson 文件中的坐标值?

[英]How can I edit the values of coordinates within a geojson file?

I am trying to map a geojson file (A map of Alaska precincts, downloaded from the division of elections and then converted online to geojson) onto a choropleth map using folium, the problem is the coordinates are in 7-digit numbers like this: I am trying to map a geojson file (A map of Alaska precincts, downloaded from the division of elections and then converted online to geojson) onto a choropleth map using folium, the problem is the coordinates are in 7-digit numbers like this:

[ -16624764.227, 8465801.1497 ] [-16624764.227,8465801.1497]

I read on a similar post that this was most likely a US coordinate system like UTM or State Plane, and recommended using an API to reproject it.我在类似的帖子中读到,这很可能是美国坐标系,如 UTM 或 State 平面,并建议使用 API 重新投影它。 Is it also possible to access the coordinates directly such as with geopandas and divide them by 100000?是否也可以直接访问坐标,例如使用 geopandas 并将它们除以 100000?

The data is most likely in a specific cartographic projection .数据最有可能在特定的制图投影中。 You don't just want to divide by 100k - the data will likely have nonlinear transformations which have a different effect on the position depending on the location.您不只是想除以 100k - 数据可能会有非线性变换,根据位置对 position 产生不同的影响。 See the GeoPandas docs on working with projections .请参阅有关使用投影的 GeoPandas 文档。

If the CRS of the data is correctly encoded, you can re-project the dataframe into lat/lons (eg WGS84, which has the EPSG Code 4326) using geopandas.GeoDataFrame.to_crs , eg:如果数据的 CRS 编码正确,您可以使用geopandas.GeoDataFrame.to_crs将 dataframe 重新投影到纬度/经度(例如 WGS84,EPSG 代码为 4326),例如:

df_latlon = df.to_crs("epsg:4326")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM