Search code examples
pythongisutmpyproj

Why is Pyproj giving me infinity values?


I'm trying to convert from UTM coordinates (WGS84, zone 18N) to latitude and longitude. I'm using the following code:

from pyproj import Proj
x = [230144.41150306776]
y = [3989937.673933774]
wgs84 = Proj(proj="utm", zone=18, ellps="WGS84")
lat, lon = wgs84(x, y)
print(lon)
print(lat)

But the output is:

[inf]
[inf]

Why does this produce infinity values? I feel like I'm doing something backwards.


Solution

  • you need to add inverse=True like this : wgs84(x, y, inverse=True) if inverse is True the inverse transformation from x/y to lon/lat is performed. Default is False.