pythonpolygongeopandasfoliumshapely

How to fill holes in Multi-polygons created when dissolving geodataframe with geopandas?


I'm aiming to plot the boundaries of clusters of MSOAs (contiguous geographical units in UK) to do so I've downloaded a shapefile of MSOA boundaries from here. I then add a column of cluster labels and dissolve using geopandas.

df.dissolve(by='label', aggfunc='sum')

When I use Folium to plot there are multiple inner holes as seen in the attached image. How do I remove these?

#creates map
m = folium.Map([54.5,-3],zoom_start=6.8,tiles='cartodbpositron')

#makes boundaries plot
Boundaries = folium.GeoJson(
    df,
    name='Boundaries',
    style_function = lambda x: {
        'color': 'black',
        'weight': 3,
        'fillOpacity': 0
    }).add_to(m)
m

Visualisation Created


Solution

  • In case anyone encounters the same problem I found a website which you can upload, simplify and export shape files from called mapshaper this managed to simplify my boundaries to the required form.