Monday 24 April 2017

Seeking methods for converting coordinate datum and format in Python?



Related to an earlier Q&A of Missing grid shift files for cs2cs.exe?, what are the various methods to convert coordinate datum and format in python?


(Windows Vista, python 3.4)


For example, given the coordinates WGS84 Decimal Degrees 39deg 12.3456min north by 120deg 12.3456min west, (epsg 4326)


translate the coordinates to NAD27 CONUS UTM zone 10 latitude band S (epsg 26710, unless there's a better one?)


Speed is not important for this application.



The methods I'm aware of:



  • pyProj - a pain to install for Windows, if possible at all? Attempting and researching this was enough of a pain that I bailed out and tried the next two options as an external system call from python, which seems fine since I'm not using very much of the proj capabilities:

  • cs2cs from OSGeo - does not come with the necessary grid shift files?

  • cs2cs from gisinternals.com - working correctly with advice from @user30184 at Missing grid shift files for cs2cs.exe?


Are there any other methods?



Answer



I prefer the latest builds from Gisinternals. Note that the link has recently moved to http://download.gisinternals.com/. It gives you always the latest Windows builds of GDAL and PROJ.


The binaries linked on the PROJ page are version 4.46, and quite outdated. The current version of PROJ is 4.8.0



PyProj might be a benefit if you do things programmatically, but not for a quick test.


As an alternative, you can look into the OSGEO4W installation. It offers current binaries and libraries including python support. But they support only Python 2.7, not yet python 3:


http://trac.osgeo.org/osgeo4w/wiki/pkg-python


Currently, Python 2.7.4 is included in the package. Once you start the shell, paths will be set to that (disregarding the python 3 you have installed previously).


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...