Skip to content

Instantly share code, notes, and snippets.

@Perishleaf
Created December 15, 2019 21:29
Show Gist options
  • Save Perishleaf/db51114f4095b45538f24997a59a123d to your computer and use it in GitHub Desktop.
Save Perishleaf/db51114f4095b45538f24997a59a123d to your computer and use it in GitHub Desktop.
Create choropleth map
# Sydney latitude and longitude values
latitude = -33.892319
longitude = 151.146167
# create a plain Sydney map
population_map = folium.Map(location=[latitude, longitude], zoom_start=11, tiles='cartodbpositron')
# create a list for population scale
bins = list(range(0, 60000, 10000))
# generate choropleth map using the total population of each suburb in Sydney
population_map.choropleth(
geo_data=NSW_data,
data=sydney_demography_data,
columns=['Suburbs_with_boundries', 'Population'],
key_on='feature.properties.nsw_loca_2',
fill_color='BuGn',
fill_opacity=0.7,
line_opacity=0.9,
legend_name='Population by Suburb',
bins=bins,
reset=True
)
population_map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment