Solved

Value assignation based on no. of features

  • 22 January 2022
  • 3 replies
  • 1 view

Hi,

 

How could I assign a value to a polygon based on the value of most of the overlapping points?

 

Thanks in advance.

 

icon

Best answer by takashi 22 January 2022, 07:44

View original

3 replies

Userlevel 2
Badge +17

Hi @ortegago​ , a possible way I can think of is:

Counter: Add sequential number attribute (say "polygon ID") as unique ID to every polygon.

SpatialFilter (polygons->Filter, points->Candidate): Transfer polygon ID to every point within the polygon.

StatisticsCalculator (Group By: polygon ID, point No): Count the number of points for each group consisting of points having the same polygon ID and the same point No.

Sorter (Group By: polygon ID, Sort By: number of points, numeric descending): Sort the features output from Summary port of the StatisticsCalculator.

DuplicateFilter (Key Attributes: polygon ID): Select the first feature for each polygon ID. Selected feature will have your desired point No for the polygon.

FeatureMerger (Join On: polygon ID): Merge the point No to the original polygon feature.

 

See the attached screenshot to learn more.

Note the workflow has to be a little more complex, if there are two or more input polygons and those could overlap each other. example

Userlevel 4
Badge +36

A completely different approach:

PointOnAreaOverlayer (generate list on output 'Area'): Attach the attributes of the points to the polygon as a list.

ListHistogrammer: Fill a new list with the number of occurences of each value in the list. The most common value will get index 0.

ListIndexer: Add the attributes with index 0 of the new list to the polygon.

most_common_value 

Awesome, thank you both for your support!

 

Reply