0

I'm trying to convert a coordinate to WGS84 degrees to NAD27 UTM on windows (vista 32 home basic), from python.

I tried installing pyproj with no luck even after researching for a while; so decided it would be easier to install the proj windows executables straight from the source (osgeo.org) - specifically the link for proj446_win32_bin.zip under 'Binaries' - then just invoke them from python and read the return value in to python. Speed is not important in this application.

(maybe cs2cs.exe is not the quickest way? If there's a different recommendation I'm all ears!)

I see in the docs where it says the files in proj-datumgrid-1.5.zip should be added to the nad dir before configuring and installing, but, since this was a download of precompiled binaries there was no install procedure (unless I missed something?)

Also I'm not sure what to do with this line in the FAQ, since these were existing binaries:

On Windows the extra nadshift target must be used. For instance nmake /f makefile.vc nadshift in the proj/src directory.

Anyway, trying the 'trivial' datum shift example in the proj FAQ:

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\Tom>set PATH=%PATH%;C:\proj\bin

C:\Users\Tom>cs2cs +proj=latlong +datum=NAD27 +to +proj=latlong +datum=NAD83<enter>
-117 30<enter>
*       * 0.000
<enter again, for good measure>
0dE     0dN 0.000
^Z

Trying it with the -v switch as recommended in the proj FAQ:

C:\Users\Tom>cs2cs -v +proj=latlong +datum=NAD27 +to +proj=latlong +datum=NAD83<enter>
# ---- From Coordinate System ----
#Lat/long (Geodetic)
#
# +proj=latlong +datum=NAD27 +ellps=clrk66 +nadgrids=conus,ntv1_can.dat
# ---- To Coordinate System ----
#Lat/long (Geodetic)
#
# +proj=latlong +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0
-117 30<enter>
*       * 0.000
<enter again>
0dE     0dN 0.000
^Z

Also trying with PROJ_DEBUG env var also as recommended in the FAQ:

C:\Users\Tom>set PROJ_DEBUG=1

C:\Users\Tom>cs2cs -v +proj=latlong +datum=NAD27 +to +proj=latlong +datum=NAD83
pj_open_lib(proj_def.dat): call fopen(C:/PROJ/NAD/proj_def.dat) - failed
pj_open_lib(proj_def.dat): call fopen(C:/PROJ/NAD/proj_def.dat) - failed
# ---- From Coordinate System ----
#Lat/long (Geodetic)
#
# +proj=latlong +datum=NAD27 +ellps=clrk66 +nadgrids=conus,ntv1_can.dat
# ---- To Coordinate System ----
#Lat/long (Geodetic)
#
# +proj=latlong +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0
-117 30
pj_open_lib(conus): call fopen(C:/PROJ/NAD/conus) - failed
*       * 0.000

0dE     0dN 0.000
^Z

That one was a bit more informative. Looking in C:/proj/nad, I see conus.lla but not 'conus', and I do not see proj_def.dat.

Any ideas?

  • Do you have some reason that prevents to use the GDAL Windows binaries from gisinternals.com/sdk? At least they seem to contain all necessary cs2cs +proj=latlong +datum=NAD27 +to +proj=latlong +datum=NAD83 -117 30 117d0'2.901"W 30d0'0.407"N 0.000 – user30184 Jan 23 '15 at 12:50
  • I have not tried those. Installing now... – Tom Grundy Jan 24 '15 at 4:14
  • I must still be missing something obvious - after installing and adding the bin dir to the path: cs2cs +proj=latlong +datum=NAD27 +to +proj=latlong +datum=NAD83<enter>-117 30<enter> shows this: 117dW 30dN 0.000 (which is definitely better than before!) – Tom Grundy Jan 24 '15 at 4:56
  • 1
    If you use the zip version run sdkshell.bat for opening the command window. It should set the environment right. – user30184 Jan 24 '15 at 15:28
  • Hey that works, thanks for the help. So, do you see this as the easiest solution to accomplish the goal, or, do you know of a cleaner easier way to integrate this functionality into python? – Tom Grundy Jan 26 '15 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.