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.
Latihan ini adalah bagian dari kursus
Visualizing Geospatial Data in Python
Petunjuk latihan
- 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 torow_values. Create a location formatted forfolium, use it to build a marker, and add it to thedowntown_map. - Display the map.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# 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(____)