Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Geopy/Geopy_Get_coordinates_from_address.ipynb
2973 views
Kernel: Python 3

Geopy.png

Geopy - Get coordinates from address

Give Feedback | Bug report

Tags: #geopy #coordinates #address #navigation #snippet

Last update: 2023-07-28 (Created: 2023-07-28)

Description: This notebook demonstrates how to utilize Geopy to the coordinates(longitude and latitude) of a given address.

Input

Import libraries

from geopy.geocoders import Nominatim

Setup variables

  • address: Address to be used to get coordinates

address = "Bulgaria Blvd 69, 1404 Manastirski Livadi, Sofia, Bulgaria"

Model

Get location

geolocator = Nominatim(user_agent="geopy_exercise") location = geolocator.geocode(address)

Output

Display result

if location: print("Latitude:", location.latitude) print("Longitude:", location.longitude) else: print("Location not found.")