Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to interpolate between coordinates, as a step in that process I convert latlong to UTM so I can work in metric.

I don't get the expected latlong when converting back, reproduced below:

>>> import pyproj
>>> pyproj.__version__
'1.9.2'
>>> p = pyproj.Proj("+proj=utm +zone=33 +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
>>> p(58.4, 15.6)
(5579373.890337878, 2328887.997220567)
>>> p(*p(58.4, 15.6), inverse=True) # Should return (58.4, 15.6)
(58.284316956873305, 15.63501250163002)

Is there a good explanation for this? How do I do what I want without this issue?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Your input coordinates are in the wrong order. Pyproj expects long, lat.

>>> import pyproj
>>> p = pyproj.Proj(init='epsg:32633')
>>> p(*p(15.6, 58.4), inverse=True)
(15.6, 58.399999999999991)
share|improve this answer
    
Subtle, thought it could be because projection/rounding errors, couldn't figure out how though. Thanks a lot! –  Sebastian Jansson Jan 22 '13 at 17:33
1  
Many transforms are only reversible within a restricted area. Check out the red strip in the map at spatialreference.org/ref/epsg/32633. Outside your UTM zone, the algorithm's robustness decreases. –  sgillies Jan 22 '13 at 17:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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