Convert lat/lon to UTM

271 views
Skip to first unread message

Daniel de la Cuesta

unread,
Apr 18, 2010, 11:58:21 AM4/18/10
to geodjango
Hi,

How can I convert lat/lon to UTM format using geodjango?,

When I get a geometry I always have the coordinates in lat/lon format,
is there any way to get the polygon coordinates in UTM format or how
can I do the transformation?

Thank you.

--
You received this message because you are subscribed to the Google Groups "geodjango" group.
To post to this group, send email to geod...@googlegroups.com.
To unsubscribe from this group, send email to geodjango+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/geodjango?hl=en.

Josh Livni

unread,
Apr 18, 2010, 12:40:48 PM4/18/10
to geod...@googlegroups.com
Hi Daniel,

Assuming you have set the srid (probably 4326) on your geometry, then somegeometry.transform(26910) will transform / reproject it to utm zone 10 north.  Replace with the appropriate epsg code for your utm zone of choice.

Cheers,

 -Josh

Justin Bronn

unread,
Apr 18, 2010, 1:01:29 PM4/18/10
to geod...@googlegroups.com
On 4/18/10 11:40 AM, Josh Livni wrote:
> Assuming you have set the srid (probably 4326) on your geometry, then
> somegeometry.transform(26910) will transform / reproject it to utm zone
> 10 north. Replace with the appropriate epsg code for your utm zone of
> choice.

Yes, `geom.tranform(utm_srid)` is the way to go. Remember to set the
SRID when creating your geometries, and that the coordinate ordering is
(lon, lat) -- here's an example transforming a point for Houston, Texas
to it's UTM zone:

>>> from django.contrib.gis.geos import Point
>>> lon, lat = -95.363151, 29.763374
>>> pnt = Point(lon, lat, srid=4326)
>>> pnt.transform(32615) # http://spatialreference.org/ref/epsg/32615/
>>> print pnt
POINT (271507.6854771426296793 3294905.7410673047415912)

-Justin
Reply all
Reply to author
Forward
0 new messages