แผนที่ถนนด้วย Folium สำหรับย่านดาวน์ทาวน์
คราวนี้จะสร้างแผนที่ folium ของย่านดาวน์ทาวน์ และเพิ่มพื้นที่ย่าน Urban Residents จาก urban_polygon ลงไป โดย urban_polygon ได้แสดงผลไว้ที่คอนโซลแล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การแสดงผลข้อมูลเชิงภูมิศาสตร์ด้วย Python
คำแนะนำการฝึกหัด
- สร้างอาร์เรย์ชื่อ
folium_locจากurban_polygon.center - สร้างแผนที่ folium ชื่อ
downtown_mapโดยตั้งค่าอาร์กิวเมนต์ location ให้เท่ากับfolium_locและกำหนด zoom_start เป็น 15 - ส่ง geometry จาก GeoDataFrame
urban_polygonไปยังเมธอด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)