Get startedGet started for free

A map of downtown art

Now you will assign a popup to each marker to give information about the artwork at each location. In particular you will assign the art title to the popup for each marker. You will do so by creating the map object downtown_map, then add the popups, and finally use the display function to show your map.

One warning before you start: you'll need to ensure that all instances of single quotes (') are removed from the pop-up message, otherwise your plot may not render!

This exercise is part of the course

Visualizing Geospatial Data in Python

View Course

Exercise instructions

  • For each row in urban_art, build a popup message that includes the title for the corresponding artwork.
  • Complete the code to replace all instances of single quotes (') with backticks (`) in the popup messages.
  • Display the finished map.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Construct downtown map
downtown_map = folium.Map(location = nashville, zoom_start = 15)
folium.GeoJson(urban_polygon).add_to(downtown_map)

# Create popups inside the loop you built to create the markers
for row in urban_art.iterrows():
    row_values = row[1] 
    location = [row_values['lat'], row_values['lng']]
    popup = (str(row_values[____])).replace(____, ____)
    marker = folium.Marker(location = location, popup = ____)
    marker.add_to(downtown_map)

# Display the map.
display(____)
Edit and Run Code