Open
Description
I have around 200k polygons in a shapefile, and I want to dissolve the polygons that are connected to each other. ArcGIS offers simple techniques to achieve this, but I was wondering if there are quicker ways to do it. I’ve tried the following but it took ages to execute.
import dask-geopands as dd
# Read the shapefile
ddf = dd.read_file(input_shapefile, npartitions=10)
# Dissolve polygons that are connected with each other
ddf['dissolve'] = 1 # Create a dummy column for dissolving
dissolved_gdf = ddf.dissolve('dissolve', split_out=11, sort=False)
# Explode the dissolved multipolygon into individual polygons and reset index
dissolved_gdf = dissolved_gdf.explode().reset_index(drop=True)
# Add an index column
dissolved_gdf['index'] = dissolved_gdf.index
dissolved_gdf.compute().to_file(output_shapefile_filled, use_arrow=True)
Metadata
Metadata
Assignees
Labels
No labels