In QGIS I'm working with a shapefile including polygons which represent the footprint of a building or parts of it (if parts have different heights).
I would like to merge these parts but I have to include multiple conditions. For example, I would like to merge polygons if their "center" is close enough, if the height difference is below a threshold, or if the smallest size of the polygon is shorter than a value.
Is there a way to modify the Python script of the "Join" command of QGIS to add these conditions?
This is an example of a church divided into portions. The inner red square should NOT be merged as its height is significantly higher than the rest.
In response to comments:
- Yes, this process should be done iteratively for all polygons (i.e. buildings) in the shapefile.
- Yes, only polygons with at least one border in common should be considered for the join process. I'm currently looking at the "Join Selected Elements" command.
- I never did cluster analyses but I'll give it a look.