Reputation: 121
I am using geopandas to extract the latitude and longitude coordinates (rather than the polygon coordinates) for a shapefile. Currently, I am using the centroid x/y methods to get the coordinates from my geopandas df data:
lon = data.centroid.x
lat = data.centroid.y
Here is the corresponding output (for latitude):
I have 2 questions on how to interpret this:
Upvotes: 0
Views: 961
Reputation: 56
"Why are the values so large? Is it because I am using the wrong CRS?"
--> Because these coordinates are planar projections and their values are in meters. The most common planar projection is UTM so probably it's the case. You can find more about UTM coordinates here.
"If I am using the wrong CRS, is there a way to fix this? I have tried data.crs but it returns null and using data.set_crs doesn't seem to fix the problem."
-->If you want to calculate distances, and all your polygons are in the same UTM zone then UTM coordinates are a great projection choice. Otherwise, you can use the geopandas method "set_crs" with the correct EPSG code and then use the method "to_crs" to convert it into another projection. The method ".crs" is returning null because geopandas could not find what is the EPSG of your polygons. To solve this absence of reference for your coordinates if you are dealing with a shapefile keep the .prj file in the same folder of your .shp file. Otherwise, if you are using another source of information, check where you got that data. Probably the coordinate system is informed at the site where you downloaded the polygons.
I think this video will also help you
Upvotes: 1