From: Stefan M. <in...@st...> - 2011-12-19 23:47:23
|
Hi Jeff, I'm not an expert in coordinate transformation and the usage of proj, so I can't exactly tell you if I have all the datum files installed. If you could tell me what files could be missing I could search for them. What makes me wonder, is that you get the results that my mpl_toolkits.basemap.pyproj.Proj usage produced. When using some conversion tools on the internet like http://home.hiwaay.net/~taylorc/toolbox/geodesy/datumtrans/ or http://www.uwgb.edu/dutchs/UsefulData/ConvertUTMNoOZ.HTM I get the results that my commandline proj produces. So I think that something with my pyproj installation is not working. Regards, Stefan. Am Montag, den 19.12.2011, 15:51 -0700 schrieb Jeff Whitaker: > On 12/19/11 2:23 PM, Stefan Mertl wrote: > > Hello, > > > > I'm starting to use the mpl_toolkits.basemap.pyproj.Proj class to do > > lon/lat to UTM coordinate conversion. > > I did some tests and noticed that there is a discrepancy between the > > mpl_toolkits.basemap.pyproj.Proj output and the proj commandline tool > > output. > > > > e.g.: I'm converting the coordinates lat=48.2; lon=16.5 to UTM > > coordinates UTM zone 33 with WGS84 ellipse. > > I'm using the following proj4 string for the conversion: > > +proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs > > > > The output using mpl_toolkits.basemap.pyproj.Proj is: > > x: 611458.865; y: 5339596.032 > > > > The proj commandline tool using the same proj4 string gives: > > x: 611458.69 y: 5339617.54 > > > > As you can see, the y coordinate differs significantly. > > > > Here's the code used with the basemap pyproy classes: > > > > -------------------------------------------------- > > > > from mpl_toolkits.basemap.pyproj import Proj > > > > # I got the proj string from > > # http://spatialreference.org/ref/epsg/32633 > > myProj = Proj("+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m > > +no_defs") > > > > lat = 48.2 > > lon = 16.5 > > > > (x,y) = myProj(lon, lat) > > > > print "x: %.3f; y: %.3f" % (x,y) > > > > --------------------------------------------------- > > > > Can somebody explain me this behavior? > > > > Regards, > > Stefan. > > > Stefan: > > When I run this test, I get the same answer with both, and it is the > same as the answer basemap.pyproj gave you. I suspect you didn't > install the extra datum files with your command-line proj distribution. > > -Jeff > |