On 12/19/11 4:47 PM, Stefan Mertl wrote:
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
I get the results that my commandline proj produces.
So I think that something with my pyproj installation is not working.


Stefan: I mis-spoke in my earlier email - the answer I get with pyproj is the same as you get with command line proj.  What version of basemap do you have installed?


Am Montag, den 19.12.2011, 15:51 -0700 schrieb Jeff Whitaker: 
On 12/19/11 2:23 PM, Stefan Mertl wrote:

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

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

lat = 48.2
lon = 16.5

(x,y) = myProj(lon, lat)

print "x: %.3f; y: %.3f" % (x,y)


Can somebody explain me this behavior?



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.


Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join

Matplotlib-users mailing list