Reverse geocoding UTM to Longitude and Latitude

Mai 18, 2021

Requirements

  • pip3 install utm
  • pip3 install geopy

Imports

from geopy.geocoders import Nominatim

import utm

import getpass

from os import system, name

In which UTM zone do I live in?




Source code for reverse geocoding with nominatim

input_utm_zone = 

# input latitude (x) UTM33 (float)
input_x =

# input longtude (y) UTM33 (float)

input_y = 

# utm (UTM33) to DG

long_lat = utm.to_latlon(input_x, input_y, input_utm_zone, 'U')

# useragent is current username

username = getpass.getuser()

# reverse geo engineer with DG

geolocator = geolocator = Nominatim(user_agent=username)

location = geolocator.reverse(long_lat)


#print results

print(long_lat)

print(location.address)