Python UTM – Converting UTM to Latitude/Longitude Coordinates Using Python’s UTM Package

coordinate systempythonutm

From another answer on this stackexchange I found the utm pypi package, which seems awesome.
I seem to however get a wrong result for:

utm.to_latlon(246000, 9860000, 37, 'S')

It is possible though that I may just not understand it well enough (I just learned about utm and the geospatial data)

the output is:

(88.51038878697912, -189.68359627626393)

But I am expecting:

-1.265610402092456, 36.7174203637869

which I got from this website and is what I am expecting:
http://rcn.montana.edu/Resources/Converter.aspx

What am I doing wrong?

Best Answer

A lot of times the UTM grid system is simplified to north (N) and south (S) hemispheres. But the grid zones on the latitude axis are actually most of the letters of the alphabet. See the wikipedia image here. The zone 37 S is actually in north Africa, in the northern hemisphere.

Your location is in grid zone 'M' so the utm call would be:

utm.to_latlon(246000, 9860000, 37, 'M')
(-1.265610382990383, 36.71742036367453)

You can also declare the hemisphere by using the northern argument which, admittedly, is not well documented.

utm.to_latlon(246000, 9860000, 37, northern=False)
(-1.265610382990383, 36.71742036367453)