I would like to aggregate polygons that are within 2 meters of each other, like the Aggregate Polygons (Cartography) tool in ArcMap, but using GDAL with Python.
To add some detail in case the problem can be approached earlier in the pipeline, these polygons were created using Polygonize in GDAL from PNG binary masks with the following code:
dst_layername = blockname + "_Piles" drv = ogr.GetDriverByName("ESRI Shapefile") dst_ds = drv.CreateDataSource( dst_layername + ".shp" ) dst_layer = dst_ds.CreateLayer(dst_layername, srs = None ) gdal.Polygonize( srcband, None, dst_layer, -1, , callback=None )
To demonstrate what I mean using the ArcMap tool, here are my polygons before:
And here are my polygons after running the Aggregate Polygons tool:
I wish to do this using non-ESRI tools that I can call from Python. I have been using osgeo and GDAL for my project thus far.