Skip to main content
Question

Fastest way to populate adjacent polygons into a list

  • 8 January 2021
  • 5 replies
  • 47 views

I am using the SpatialRelator for populating a list of adjacent polygons for specific polygons of a geojson polygon layer. I tried the "Requestor Intersects Supplier" and "Requestor Touches Supplier" predicates but they also include those polygons touching at only one point. I only want those sharing a line, so I have a ListElementFilter taking only the following relationship masks: FF2F11212 and FF2F1F212. The problem is that the process is much slower when adding that custom transformer. It is even worse when I use the "FF2F11212 FF2F1F212" value in an attribute in the "spatial predicates to test" field. Can you think of a more performant way to obtain the adjacent polygons into a list?

Thanks!

Olivier

Buffer slightly, area on area overlay, calculate the area, and filter out the ones with very small areas. That would leave ones with a shared boundary in the list.

 

I can think of a few other ways, but that's probably the fastest and easiest.

 

 


Thank you @jlbaker2779​ I will consider your trick. The limiting factor seems to be the SpatialRelator itself not the ListElementFilter. Removing all attributes from the input ports except the ID attribute does not shorten throughput time.


Thank you @jlbaker2779​ I will consider your trick. The limiting factor seems to be the SpatialRelator itself not the ListElementFilter. Removing all attributes from the input ports except the ID attribute does not shorten throughput time.

You wont need the SpatialRelator if you use the area on area, the area on area has a list function.

You can use a feature reader as well, it has intersect functions and works very quickly. But you'll have to still ID the ones you dont want with a buffer or vertex count to get the ones you want in the list.


Thank you @jlbaker2779​ for the additional suggestions! I had mentioned the SpatialRelator in my previous post only to specify that it was this transformer that was responsible for the initial slowness.

In the meantime I did some experimentations including yours, which is indeed much quicker. Another approach which seems to be as fast consists in storing the "requestor" polygon geometry in an attribute, then linking that to an Intersector to which all other "candidate" polygons are also connected as input. You then obtain polygon boundaries indicating (after some attribute filtering) in the attribute table the correspondence between "requestor" id and "candidate id + other relevant attributes. Ultimately this mapping allows me to assign the id of the largest "candidate" in area and then proceed with a dissolve operation. I used this to set up a logic for filling up gaps with the biggest neighboring polygon. That being said, for the sole purpose of filling gaps, the AreaGapAndOverlapCleaner is good and fast. However I needed to fill gaps located at the border of my rectangular tile and the AreaGapAndOverlapCleaner on its own would not have been able to consider these as gaps. The other reason is that I wanted to pick the adjacent neighbour with the largest area for filling the gap (not an option with the AreaGapAndOverlapCleaner).


Thank you @jlbaker2779​ for the additional suggestions! I had mentioned the SpatialRelator in my previous post only to specify that it was this transformer that was responsible for the initial slowness.

In the meantime I did some experimentations including yours, which is indeed much quicker. Another approach which seems to be as fast consists in storing the "requestor" polygon geometry in an attribute, then linking that to an Intersector to which all other "candidate" polygons are also connected as input. You then obtain polygon boundaries indicating (after some attribute filtering) in the attribute table the correspondence between "requestor" id and "candidate id + other relevant attributes. Ultimately this mapping allows me to assign the id of the largest "candidate" in area and then proceed with a dissolve operation. I used this to set up a logic for filling up gaps with the biggest neighboring polygon. That being said, for the sole purpose of filling gaps, the AreaGapAndOverlapCleaner is good and fast. However I needed to fill gaps located at the border of my rectangular tile and the AreaGapAndOverlapCleaner on its own would not have been able to consider these as gaps. The other reason is that I wanted to pick the adjacent neighbour with the largest area for filling the gap (not an option with the AreaGapAndOverlapCleaner).

Well played! I didn't think about storing it as geometry.

 

I had a similar project and to fill the gaps where I had a bit of trouble with the clear. I did the following for interior gaps;

 

  1. Add a bounding box of the extent of the data
  2. Clip the bounding box by the data
  3. Buffer the resulting clipped slivers/edges by a few feet/meters
  4. Clip the data with the area on area
  5. Calculate the area of the resulting intersects
  6. Test out the largest area
  7. Dissolve largest polygon to the result from #2

 

That removed the need for any snapping operations that can accidentally distort the data and it looked very clean.


Reply