0

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.

Patrik
  • 499
  • 1
  • 7
  • 24
  • Could it be that your coordinates are out of range? I know absolutely nothing about this stuff, but [this web site](https://www.spatialreference.org/ref/epsg/wgs-84-utm-zone-18n/) 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 Nov 27 '20 at 20:06

1 Answers1

1

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.

ozs
  • 3,051
  • 1
  • 10
  • 19