1

From a geopandas dataset I would like to join polygons into a single polygon when they meet the condition that they are in close proximity (touching).

The following picture gives the before (A) and after(B):

Remark that the result of the join are two polygons as small yellow areas are touching each other so are grouped into one polygon.

I give a toy data example to test this:

import pandas as pd
from shapely import geometry



df = pd.DataFrame({"id":["poly_b1","poly_b2","poly_b3","poly_a"],
                  "geom":[geometry.Polygon([(3, 0), (3, 3), (5, 3), (5, 0)]),
                          geometry.Polygon([(0, 0), (3, 10), (3, 0)]),
                          geometry.Polygon([(5, 3), (5, 5), (7, 5), (5, 0)]),
                          geometry.Polygon([(15, 13), (15, 15), (17, 15), (15, 10), (12,2)])]})
PeCaDe
  • 277
  • 1
  • 8
  • 33
  • [combine-adjacent-3d-polygons-that-are-in-certain-order](https://stackoverflow.com/a/63757051/3565685) the answer I've pointed to can guide you to few solutions on how you can merge polygons – KD_ Aug 09 '22 at 10:47

0 Answers0