Memvisualisasikan Data Geospasial di Python
Mary van Valkenburg
Data Science Program Manager, Nashville Software School
# Construct a map object for Nashville
nashville = [36.1636,-86.7823]
m = folium.Map(location=nashville, zoom_start=10)
# Create a choropleth using the folium Choropleth class
folium.Choropleth(...)
geo_data - sumber data poligon (file geojson atau GeoDataFrame)name - nama kolom geometri (atau properti geojson) untuk poligondata- DataFrame atau Series sumber untuk data ternormalisasicolumns- daftar kolom: satu yang sesuai dengan poligon dan satu berisi nilai yang dipetakankey_on - variabel GeoJSON untuk mengikat data (selalu diawali feature)fill_color - warna isian poligon (baku: biru) fill_opacity - rentang 0 (transparan) hingga 1 (buram penuh)line_color - warna garis batas poligon (baku: hitam)line_opacity - rentang 0 (transparan) hingga 1 (buram penuh) legend_name - membuat judul legenda# Center point and map for Nashville
nashville = [36.1636,-86.7823]
m = folium.Map(location=nashville, zoom_start=10)
# Define a choropleth layer for the map
folium.Choropleth(
geo_data=districts_with_counts,
name='geometry',
data=districts_with_counts,
columns=['district', 'school_density'],
key_on='feature.properties.district',
fill_color='YlGn',
fill_opacity=0.75,
line_opacity=0.5,
legend_name='Schools per km squared by School District'
).add_to(m)
folium.LayerControl().add_to_map()
display(m)

Memvisualisasikan Data Geospasial di Python