One popular geographical library in Python is geopy. It provides geocoding (converting addresses to latitude/longitude) and reverse geocoding (converting latitude/longitude to addresses) services, as well as distance and geodesic calculations. Here’s an example of how to use geopy to geocode an address and compute the distance between two points:

example : between Seoul City Hall and Tokyo Shinjuku Station in kilometers:


from geopy.geocoders import Nominatim
from geopy.distance import distance

# create a geolocator object
geolocator = Nominatim(user_agent='my_app')

# geocode the addresses of Seoul City Hall and Tokyo Shinjuku Station
location_seoul = geolocator.geocode('Seoul City Hall, South Korea')
location_tokyo = geolocator.geocode('Tokyo Shinjuku Station, Japan')

# print the latitude and longitude of each location
print(location_seoul.latitude, location_seoul.longitude) # Output: 37.5662952 126.9779451
print(location_tokyo.latitude, location_tokyo.longitude) # Output: 35.6895929 139.7004134

# compute the distance between the two points
dist = distance((location_seoul.latitude, location_seoul.longitude), (location_tokyo.latitude, location_tokyo.longitude))

# print the distance in kilometers
print(dist.km) # Output: 1223.5532022390926