Open m-sasha opened 1 year ago
The behavior seems inconsistent w.r.t. easting and northing. With easting it does the "right" thing by returning continuous values across UTM zone boundaries:
>>> utm.from_latlon(0.01, 0.01, 31, 'N')
(167135.73011805036, 1106.8173845648219, 31, 'N')
>>> utm.from_latlon(0.01, -0.01, 31, 'N')
(164907.15610373177, 1106.8377694498813, 31, 'N')
>>> utm.from_latlon(0.01, -0.01)
(832864.2698819496, 1106.8173845648219, 30, 'N')
Related PR #46
I have some geographic shapes that I'm trying to do geometry on (find distances, intersections etc). To do that I'm converting all the lat-lon coordinates to UTM, then using the python Shapely library to do the geometry, and then converting the results back to lat-lon. My shapes are small, but they nevertheless sometimes cross UTM zone boundaries. I can live with the inaccuracy induced by converting coordinates in a nearby zone, but
utm
seems to intentionally wrap negative latitudes, breaking my conversion completely. A short segment from (lat=0.01, lon=0) to (lat=-0.01, lon=0) becomes a huge segment in UTM from northing 1000 to northing 10_000_000:I would expect that specifying
force_zone_number
andforce_zone_letter
would disable this behaviour. The relevant code appears to be infrom_lat_lon
: