I have a shapefile with thousands of polygons and would like to merge (join) adjacent polygons based on a threshold between attributes. I need to use python because I'm not allowed to use ArcGIS.

e.g., my attribute is "height", if the polygons touch each other and their height difference if lower than 2 metres, they should be merged (the height values are not the same).

I'm trying to use itertools.combination to work with two polygons of the same shapefile, but if I merge them in a new one, the next comparison need to be with this merged one and the newer one.

Can anybody help me?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.