ComeçarComece de graça

Adding markers for the public art

Now that you have added the polygon for the Urban Residents neighborhood to your folium street map, it's time to add the locations of the art within the neighborhood. You can do that by creating folium markers. Each marker needs a location assigned. Use iterrows() to loop through the data to grab the values you need.

Este exercício faz parte do curso

Visualizing Geospatial Data in Python

Ver curso

Instruções do exercício

  • First take a look at the tuple returned by iterrows() by printing the first and second values.
  • Assign the second value of the iterrows() tuple to row_values. Create a location formatted for folium, use it to build a marker, and add it to the downtown_map.
  • Display the map.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Iterate through the urban_art and print each part of tuple returned
for row in urban_art.iterrows():
  print('first part: ', row[____])
  print('second part: ', row[____])

# Create a location and marker with each iteration for the downtown_map
for row in urban_art.iterrows():
    row_values = row[1] 
    location = [row_values[____], row_values[____]]
    marker = folium.Marker(location = ____)
    marker.____(downtown_map)

# Display the map
display(____)
Editar e executar o código