The goal is to simplify the geometries of a shapefile containing multipolygons. However, when I use Shapely's simplify in geopandas, the result contains gaps between the polygons. I was hoping that preserve_topology would avoid this? How can I avoid or fix the issue?

gdf_simplified = gdf.copy()
gdf_simplified["geometry"] = gdf.geometry.simplify(tolerance=TOLERANCE,preserve_topology=True)

my geoDataFrame is in in {'init': 'epsg:4326'}and I use a tolerance of 360/43200 which corresponds to 30" degrees (appr. 1 km at the equator).

enter image description here

The old polygons are displayed using the black line. The new resulting polygons are depicted using colors.

For now, I was able to revert to MapShaper and get simplified shapes without the gaps. However, I would prefer a python based approach.

  • Maybe converting to TopoJSON might help but I've never used that before.
    – RutgerH
    Commented Jun 13, 2019 at 20:09
  • Preserverve topology does not do that for the whole layer gis.stackexchange.com/questions/20799/…. You need some topology-aware tool for that.
    – user30184
    Commented Jun 13, 2019 at 21:09

1 Answer 1


As mentioned, you need a topology aware simplification algorithm. For this I use the topojson package:

gdf = <geopandas dataframe>

import topojson as tp

topo = tp.Topology(gdf.to_crs({'init':'epsg:3857'}), prequantize=False)
simple = topo.toposimplify(1).to_gdf()

# optional

  • This was very useful thanks. My shape was already in epsg:3857, so I took out the to_crs function. In my scenario (detailed shape covering several 100km2), a value of 0.01 in the toposimplify parameter gave a reasonable balance between size reduction and a reasonably faithful reproduction of the shape.
    – Mike Honey
    Commented Jun 11 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.