I have latitudes and longitudes from a GPS unit which uses WGS84, and would like to project those to some kind of plane.

I'm totally new to this, but after a lot of reading it sounds like UTM is a good projection to use. According to the Wiki page on UTM, I'm in zone 34H (a very nice place to live, by the way).

I found two python modules to help me do this:

(1) Using pyproj, which wraps Proj4:

from pyproj import Proj
p = Proj(proj='utm', ellps='WGS84', zone='34H')
lat, lon = -34.228258, 18.413602
p(lon, lat)

Which results in:

(261762.5589262726, -3790491.0744062006)

(2) Using utm:

import utm
lat, lon = -34.228258, 18.413602
utm.from_latlon(lat, lon)

Which results in:

(261762.55890839838, 6209508.925565818, 34, 'H')

As you can see, the y values differ, but the x values are the same for all practical purposes. It looks like the y values are shifted by about 9999999.999972, but not scaled. So it seems that these modules are using different origins for the xy plane.

  1. Which one is right?
  2. How can I change it using either module?

Both coordinates are the same. As you are in the Southern Hemisphere a False Northing (of +10000000m) is usually applied to eliminate the negatives.

The utm package applies the false Northing by itself. For Proj you need to specify it:

>>> p = Proj(proj='utm', ellps='WGS84', zone='34H', south=True)
>>> p(lon,lat)
>>> (261762.55892627264, 6209508.925593799)
| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.