0
votes

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.

1
Could it be that your coordinates are out of range? I know absolutely nothing about this stuff, but this web site suggests that valid coordinates fall within a range that uses only two whole number digits. I've entered smaller number as x, y in your code, and it gives back non-inf numbers as a result.CryptoFool

1 Answers

1
votes

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.