I am trying to create a choropleth map using Folium. I exported a GeoJSON file for London boroughs from an official GIS shapefile. After hours of researching about possible causes, I noticed in my file that the features come up in a different order compared to another GeoJSON file that works, which I assume is the reason for not appearing on the map. Basically the order in mine is something like
"features": [
"geometry": {...},
"properties": {...}, etc
and the working GeoJSON has
"features": [
"properties": {...},
"geometry": {...},
My question is How can I change the order of the features or how to make it render with Folium?
The code for creating the map is as follows:
london = r'london_simple.json' # geojson file
# create a plain London map
london_map = folium.Map(location=[51.5074, 0.1278], zoom_start=10)
london_map.choropleth(
geo_data = london,
data = dfl1,
columns = ['Area_name', 'GLA_Population_Estimate_2017'],
key_on='feature.properties.Counties_1',
fill_color = 'YlOrRd',
fill_opacity = 0.7,
line_opacity=0.2,
legend_name='Population size in London'
)
london_map
I'm working in a jupyter notebook on IBM Watson, if that makes any difference. If I use my geojson file, no choropleth regions appear. If I change to the other file, it works (provided I change the map coordinates to Toronto ([37.7749, -122.4194]).
My code doesn't generate any error, just the plain map focused on London without the choropleth regions.