Skip to main content
Solved

Value assignation based on no. of features


Hi,

 

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

 

Thanks in advance.

 

Best answer by takashi

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

View original
Did this help you find an answer to your question?

3 replies

takashi
Evangelist
  • Best Answer
  • January 22, 2022

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


geomancer
Evangelist
Forum|alt.badge.img+51
  • Evangelist
  • January 24, 2022

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 


  • Author
  • January 24, 2022

Awesome, thank you both for your support!

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings