I have a dataset of some points in python which have longitude and latitude for each of them. Because they are located in different UTM zones, when I want to convert them to UTM, I will get some negative Easting points. Is there any function in python/QGIS or everywhere that will be smart enough to solve this problem?
-
2This is an expected result to get negative value if the point is in east of the target UTM zone. What is wrong here?– Kadir ŞahbazMar 17 at 12:27
-
Since UTM zones are strictly bounded by declared longitude values, surely you can create a filter to only process those that are in a specified UTM zone. As @KadirŞahbaz says, the negative values are correctly converted, they are just not in that UTM zone.– Leigh BettenayMar 19 at 0:55
1 Answer
Yes! use the UTM Python Library. From the command line install utm
pip install utm
Then try something like:
import utm
utm.from_latlon(48, -122)
(574595.1124862543, 5316784.0095401555, 10, 'U')
utm.from_latlon(-48, -122)
(574595.1124862543, 4683215.9904598445, 10, 'G')
Where 'U' = is a particular latitude band within UTM zone North and 'G' = is a latitude band within UTM zone South