user9476284
user9476284

Reputation: 150

folium choropleth and geojson not rendering in jupyter

I cannot get a folium map to display in jupyter when all 33 London boroughs are included in the geojson file

but

I can get the folium map to display if fewer boroughs are included in the geojson file. (up to 23)

If I save the map as an html file and open it separately it works just fine.

here is the version of the code that works (just using the first 23 boroughs).

m = folium.Map(location=[51.5, -0.1], zoom_start=10)

m.choropleth(
    geo_data={"type":geo_london["type"],"features":geo_london["features"][:23]}, # 23 of the boroughs
    data=df["Underground"],
    columns=["LA",'Underground'],
    key_on='feature.properties.name',
    fill_color='BuPu',
    fill_opacity=0.9,
    line_opacity=0.2,
    legend_name='Underground Useage',
    highlight=True
)

Here is the version that doesn't work:

m = folium.Map(location=[51.5, -0.1], zoom_start=10)

    m.choropleth(
        geo_data= geo_london, # all 33 boroughs
        data=df["Underground"],
        columns=["LA",'Underground'],
        key_on='feature.properties.name',
        fill_color='BuPu',
        fill_opacity=0.9,
        line_opacity=0.2,
        legend_name='Underground Useage',
        highlight=True
    )

Other things to note:

Upvotes: 2

Views: 2943

Answers (1)

Andrea Santilli
Andrea Santilli

Reputation: 116

Probably you are describing the bug explained here https://github.com/python-visualization/folium/issues/768 (Folium displays nothing if number of overlaid images > 80 on Chrome). Try to use a different browser like Firefox or Safari.

Upvotes: 3

Related Questions