Turbo87 / utm

Bidirectional UTM-WGS84 converter for python
http://pypi.python.org/pypi/utm
MIT License
493 stars 101 forks source link

Error when converting from x, y to lan, lon mercator projection #48

Open wxguy opened 4 years ago

wxguy commented 4 years ago

The project looks very promising with simple command. Therefore, I tested it with my hdf data set which has X and Y (x and y coordinate of projection) in meters. I would like to convert this coordination system in to mercator projection with utm module. The area the data covers is over India. Here is the very simple example I wrote:-

import utm
india_zone_no = 43
india_zone_letter = 'G'

print(utm.to_latlon(3473242.733735, 5401854.420193, india_zone_no, india_zone_letter))

This simple example resulted in following error:-

Traceback (most recent call last):
  File "./test_cartopy.py", line 42, in <module>
    print(utm.to_latlon(3473242.733735, 5401854.420193, india_zone_no, india_zone_letter))
  File "/home/sundar/.local/lib/python3.8/site-packages/utm/conversion.py", line 108, in to_latlon
    raise OutOfRangeError('easting out of range (must be between 100.000 m and 999.999 m)')
utm.error.OutOfRangeError: easting out of range (must be between 100.000 m and 999.999 m)

In the above example I have tested with just two coordinates, where as the actual array of X is 1600 and Y is 1800. In such different dimension how would you get lat & lon using utm module?

bartvanandel commented 9 months ago

I realize this is almost 4 years after the question was posted, but...

I'm not sure where you expect these coordinates to show up, but when I try them using an online converter, I end up in the middle of the ocean. Are you sure these coordinates are actual UTM coordinates?