Skip to main content
Solved

Value assignation based on no. of features

  • January 22, 2022
  • 3 replies
  • 13 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

takashi
Celebrity
  • 7843 replies
  • 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+58
  • Evangelist
  • 932 replies
  • 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
  • 2 replies
  • January 24, 2022

Awesome, thank you both for your support!