basemap UTM conversion discrepancy

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

···

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.

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

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


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
or
I get the results that my commandline proj produces.
So I think that something with my pyproj installation is not working.
Regards,
Stefan.
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?

-Jeff
···

http://home.hiwaay.net/~taylorc/toolbox/geodesy/datumtrans/http://www.uwgb.edu/dutchs/UsefulData/ConvertUTMNoOZ.HTMhttp://spatialreference.org/ref/epsg/32633http://p.sf.net/sfu/intel-appdevMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users

Jeff,

Here are the versions that I'm working with:
basemap: 1.0.2
matplotlib: 1.1.0
numpy: 1.5.1
libgeos: 3.2.0

I ran the coordinate conversion on another computer with the same system
configuration and there it works as it should.
I have tried to clean my system and removed all the packages related to
basemap (geos, proj) and only reinstalled the required libgeos packages.
I deleted the basemap directory from
the /usr/local/lib/python2.7/dist-packages.
I deleted the _geoslib.so from /usr/local/lib/python2.7/dist-packages.
After that I rebuilt and installed basemap.

The problem still remains.

Don't know what's going wrong.

Stefan.

···

Am Montag, den 19.12.2011, 18:33 -0700 schrieb Jeff Whitaker:

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
> 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.

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?

-Jeff
>
> 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
> >
> >
> >
> > ------------------------------------------------------------------------------
> > 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
> > matplotlib-users List Signup and Options