[Python] How to merge almost touching polygons

Discussão em 'Python' iniciado por Stack, Julho 6, 2025.

  1. Stack

    Stack Membro Participativo

    How can I merge polygons that are almost touching, using Python? For example, given these polygons and some distance threshold T:

    [​IMG]

    The algorithm would produce something like this:

    [​IMG]

    So basically I need to remove any gaps smaller than T between the two polygons.

    The original vertices of the polygons should not be unnecessarily modified. So for example simply buffering both polygons and then taking a union of them is not good.

    A library that already implements this functionality would also be fine.

    EDIT: As another example, ArcGIS polygon aggregation seems to do exactly this. However there isn't much hint about how it is implemented, and using ArcGIS is not an option.

    Continue reading...

Compartilhe esta Página