from geopy.geocoders import Nominatim# Create a geolocator objectgeolocator = Nominatim(user_agent="get-the-geocode")# Define the address for geocodingaddress ="Unter Sachsenhausen 6, Köln, Germany"# Retrieve the geolocation (latitude and longitude) for the given addresslocation = geolocator.geocode(address)print((location.latitude, location.longitude))
(50.9426743, 6.9523815)
import foliumcoordinates = [location.latitude, location.longitude]# Create a map objectm = folium.Map(location=coordinates, zoom_start=15)# Add a marker for each coordinatefolium.Marker(location=coordinates, popup=address).add_to(m)m # Display the map in Jupyter Notebook
Make this Notebook Trusted to load map: File -> Trust Notebook