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

-- 
Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/PSD  R/PSD1        Email  : jeffrey.s.whita...@noaa.gov
325 Broadway                Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg


------------------------------------------------------------------------------
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
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to