I have one shapefile with XY coordinates in meters. Now, I want to develop one script in Python which converts meters to decimal degrees. Please help me to develop this.
Thanks
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI have one shapefile with XY coordinates in meters. Now, I want to develop one script in Python which converts meters to decimal degrees. Please help me to develop this.
Thanks
Sounds like you are looking to project your shapefile. Look at Project (Data Management) they have examples of how to do it using Python.
It would really help if you would write what do you want to do exactly. You can use GDAL to do this or call a web service if you would find one. For example you can try using this http://www.opencts.org/guidedwcts.php in your python code.
If you want to write it completely on your own, convert this java code to python. There is also some theory on what really happens there.
ogr2ogr -t_srs EPSG:4326 unprojected.shp projected.shp
from the command-line
– Mike T
Aug 9 '11 at 0:28
The easiest way to do it is using GDAL command line calls from Python.
So, using the line from above (ogr2ogr ...) along with a GDAL install (see Installing GDAL with Python on windows?) you can sort out a method which will do it for you.
The more comprehensive way is to find a shapefile importing tool and then using pyproj to do it natively in Python. I would try the former for a script, and the latter if you want something embedded in a portable application.