I'm a GIS novice, and am struggling to understand how to drive proj4 to accomplish what seems like a simple thing. I've googled for a couple of days, but everything I find seems to presuppose quite advanced knowledge, and leaves many things unsaid. Stack Overflow couldn't clear it up for me, either..

I have a conversion between UTM easting/northing and lat/long to do in both directions. Once I get this working, I'll add some different projections/datums.

I'm working on my recently acquired knowledge/assumptions:

  1. This conversion will require a datum translation, because WGS84 (standard datum for UTM) has it's prime meridian approximately 100m east of Greenwich (where longitude is zero).
  2. I don't need to worry about ellipsoids, because the lat/long are geographic coordinates, rather than projected ones.
  3. I can either start the conversions using one string (as used in the command-line instantiation), or can pre-assemble a source and destination object, and call pj_fwd(data, ref) directly.

Another issue is that if I call the code directly, while I've found the projUV datatype - I can't find the corresponding UTM version.

Could someone please get me started with the format of the string(s) of either method required?

Perhaps using conversion from zone 56 499451mE 6960921mS to lat/long as an example.

  • I asked a question about this a little while ago: gis.stackexchange.com/questions/5265/… It uses javascript but maybe the discussion is helpful
    – djq
    Feb 1, 2011 at 15:26
  • Do you need to perform this calculation client-side? If not, you could use an approach akin to rapidiphonedev.com/?p=16
    – scw
    Feb 1, 2011 at 21:34
  • 1
    You generally don't need to worry about 1. A 'Greenwich' prime meridian means the current zero point somewhere in the vicinity of the Greenwich observatory, not the original location. I'm not sure about 2. Lat/lon values need to have a geographic coordinate [reference] system definition aka datum attached to them. On their own, they are not a unique identifier. If you need to use different GeoCRS or different UTM zones based on different GeoCRS, then, yes, you'll need to handle datum transformations. The UTM coords you quoted could be based on WGS84, GDA94, AGD66, AGD84, etc.
    – mkennedy
    Feb 2, 2011 at 1:59
  • That's disappointing about lat/long needing a datum - That was the only thing I was confident about! (Greenwich was 0 Longitude, and 1/2 way between Geographic north and south was 0 latitude). Bummer. Thanks for the help Feb 4, 2011 at 23:42
  • The utm package (pip install utm) works great for this purpose, and is easy to use: pypi.python.org/pypi/utm
    – user10112
    Jul 2, 2019 at 21:10

2 Answers 2


Personally I'd use the Python bindings for the Proj4 library - http://pypi.python.org/pypi/pyproj/1.8.6

Further details at http://pyproj.googlecode.com/svn/trunk/README.html

You can pass your projection parameters directly to the projection object as follows:

PROJ_32756 = """
+proj=utm +zone=56 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs
p1 = pyproj.Proj(PROJ_32756)

A full list of these strings can be found at http://spatialreference.org/ For zone 56 see http://spatialreference.org/ref/epsg/32756/proj4/

Many of these projections are already built into the library so you can just pass in the code. Below is an example of reprojecting some geojson from one projection to another. You should be able to adapt to your needs.

import pyproj
import simplejson

p1 = pyproj.Proj(init='epsg:3857')
p2 =pyproj.Proj(init='epsg:29902')


pydata = simplejson.loads(json)
print str(pydata)
new_coords = []
for p in pydata['coordinates'][0]:
    x2, y2 = pyproj.transform(p1,p2,p[0],p[1])
    new_coords.append([x2, y2])

new_json = simplejson.dumps(dict(type="Polygon", coordinates=[new_coords], srid="29902"))
print str(new_json)
  • Thanks geographika - I wish I could use python, as there seems to be a few examples out there for doing so, but I'm constrained to objective-c (and so also c++ or c). I downloaded the C source, and just need to tap into that, somehow.. The documentation for the python bindings seems several orders of magnitude more helpful than that of the proj4 library itself.. If I had more reputation, I'd +1 you for the suggestion. Thanks. Feb 1, 2011 at 12:00
  • Ah ok..iPhone development by any chance? Maybe the unit tests in the source are your best examples - trac.osgeo.org/proj/browser/trunk/proj/nad/testvarious ? Feb 1, 2011 at 16:38

You may want to take a look at the route-me project, they seem to have some working examples of wrapping Proj.4 on the iOS platform in Objective-C. The actual transformation looks to happen in Mapview/Map/RMProjection.m.

  • I'll upvote this answer as soon as I have enough reputation - Thanks for the link, I didn't know that existed.. Feb 4, 2011 at 23:57
  • I made this the answer, as although it didn't answer the question, it proposed another method that will work for me. Thanks Feb 8, 2011 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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