Solved

How to merge Polygon neighbours individually?

  • 30 March 2022
  • 4 replies
  • 29 views

Hi,

I have polygon data of different lots of land from a city. The goal is to figure out if any two polygons together are bigger than a predefined value.

That means I need to merge two adjacent polygons together, test their size and repeat that process with all other adjacent polygons. (Let's say a lot has 6 neighbours, that means I need to check 6 different combinations) This need to be repeated over the whole dataset (around 5000 polygons).

The problem is I don't know how to merge the polygons individually. I tried different methods with NeighborFinder, SpatialFilter, etc. but none of them yielded the results I needed.

Thanks for any input!

F

icon

Best answer by geomancer 31 March 2022, 10:21

View original

4 replies

Badge +2

@fabian22​ Both NeighborFinder and SpatialRelator allow you to create list{} attributes from features that meet the criteria you set. You can choose the attributes that are added to the list attribute, like ID and Area. So in your example, you'll have a list attribute with 6 elements. You can then compare the Requestor / Base feature with the Supplier / Candidate elements in the list . You might need to develop a little python code in PythonCaller to cycle through the list, not any more complicated than described here.

Userlevel 4
Badge +36

Another approach is to use the TopologyBuilder. Generate a list with the ID's and the areas from the Input Faces. Use the output of the Edges port.

For each feature calculate the sum of the 2 areas from the list. Also get the ID's of both polygons from the list.

Filter the features with a combined area above your threshold.

Adjacent_large_polygons

Another approach is to use the TopologyBuilder. Generate a list with the ID's and the areas from the Input Faces. Use the output of the Edges port.

For each feature calculate the sum of the 2 areas from the list. Also get the ID's of both polygons from the list.

Filter the features with a combined area above your threshold.

Adjacent_large_polygons

Thanks, this worked for me! I needed to tweak the last part a bit to end up with the aggregate polygons itself. I used FeatureMergers and Aggregator to get the that

Userlevel 4
Badge +36

Another approach is to use the TopologyBuilder. Generate a list with the ID's and the areas from the Input Faces. Use the output of the Edges port.

For each feature calculate the sum of the 2 areas from the list. Also get the ID's of both polygons from the list.

Filter the features with a combined area above your threshold.

Adjacent_large_polygons

Good to hear that you could base your process on this idea.

Thanks for the feedback!

Reply