開始使用免費開始

市中心社區的 Folium 街道地圖

這次你要建立市中心的 folium 地圖,並把 urban_polygon 中的 Urban Residents 社區範圍加入地圖。urban_polygon 已經印在你的主控台上。

本練習屬於課程

在 Python 視覺化地理空間資料

檢視課程

練習說明

  • urban_polygon.center 建立一個名為 folium_loc 的陣列。
  • 建立一個名為 downtown_map 的 folium 地圖。將 location 參數設為 folium_loc,並以 zoom_start 為 15 初始化地圖。
  • urban_polygon GeoDataFrame 的 geometry 傳入 folium.GeoJson() 方法。接著對它呼叫 add_to()

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Create array for called folium_loc from the urban_polygon center point
point = urban_polygon.____[0]
folium_loc = [point.____, point.____]

# Construct a map from folium_loc: downtown_map
downtown_map = folium.Map(location = ____, ____ = 15)

# Draw our neighborhood: Urban Residents
folium.GeoJson(____.____).add_to(____)

# Display the map
display(downtown_map)
編輯並執行程式碼