Skip to main content
Solved

How to get the smallest polygon's ID within multiple nested polygons?


Dear FME community,

I have a CSV file containing points (longitude and latitude for properties) and a neighborhood shape file containing nested polygons. There are three types of the polygons from the smallest to the largest: Sub-neighborhood, Neighborhood and Macro-neighborhood.

I would like to join the points to the polygons and append only one polygon ID to each property. If a property falls within multiple nested polygons, I would like to get the ID from the smallest polygon. For example, if a property is in a Sub-neighborhood which is nested in a Neighborhood, the Sub-neighborhood ID should be appended to the CSV file.

Currently, I am using the PointOnAreaOverlayer, and I always get the IDs from the largest polygons when there are multiple polygons matched.

Which transformers should I use to always get the IDs from the smallest polygons (based on the polygon type) when there are multiple polygons matched?

I appreciate your help.

Thao

 

Best answer by bwn

It isn't the size of the overlaying polygons that is determining this. It is the order in which the Polygon features enter the PointOnAreaOverlayer Transformer.

It sounds like the Macro-Neighbourhood polygons (the largest) coincidentally are entering PointOnAreaOverlayer first, and getting the priority for Attribute Merging.

The easiest way is to:

  • Assign a Priority Attribute to each Neighbourhood Polygon dataset, say with AttributeCreators
  • Put these into a Sorter, to make sure that the Sub-neighbourhoods come out as the first features, then the Neighbourhoods, then the MacroNeighbourhoods

Then on the Attribute Merge, whichever Polygon is found to match first will be used to merge the Attributes to the Point. It the first match is a SubNeighbourhood, because Sorter put them as the first features into PointOnAreaOverLayer, then it will be used for the Attribute Merge.

Like so:

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

4 replies

bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • Best Answer
  • February 4, 2020

It isn't the size of the overlaying polygons that is determining this. It is the order in which the Polygon features enter the PointOnAreaOverlayer Transformer.

It sounds like the Macro-Neighbourhood polygons (the largest) coincidentally are entering PointOnAreaOverlayer first, and getting the priority for Attribute Merging.

The easiest way is to:

  • Assign a Priority Attribute to each Neighbourhood Polygon dataset, say with AttributeCreators
  • Put these into a Sorter, to make sure that the Sub-neighbourhoods come out as the first features, then the Neighbourhoods, then the MacroNeighbourhoods

Then on the Attribute Merge, whichever Polygon is found to match first will be used to merge the Attributes to the Point. It the first match is a SubNeighbourhood, because Sorter put them as the first features into PointOnAreaOverLayer, then it will be used for the Attribute Merge.

Like so:


Forum|alt.badge.img+2
  • February 4, 2020

@thaonguyen An alternative is to use the list capabilities of the PointOnAreaOverlayer. Under Attribute Accumulation you can create a list of the areas that overlap each point. Then use the ListSorter to sort by the area of the polygon.


  • Author
  • February 6, 2020
bwn wrote:

It isn't the size of the overlaying polygons that is determining this. It is the order in which the Polygon features enter the PointOnAreaOverlayer Transformer.

It sounds like the Macro-Neighbourhood polygons (the largest) coincidentally are entering PointOnAreaOverlayer first, and getting the priority for Attribute Merging.

The easiest way is to:

  • Assign a Priority Attribute to each Neighbourhood Polygon dataset, say with AttributeCreators
  • Put these into a Sorter, to make sure that the Sub-neighbourhoods come out as the first features, then the Neighbourhoods, then the MacroNeighbourhoods

Then on the Attribute Merge, whichever Polygon is found to match first will be used to merge the Attributes to the Point. It the first match is a SubNeighbourhood, because Sorter put them as the first features into PointOnAreaOverLayer, then it will be used for the Attribute Merge.

Like so:

@bwn, this is exactly what I was looking for. Thank you very much for your help.


  • Author
  • February 6, 2020
markatsafe wrote:

@thaonguyen An alternative is to use the list capabilities of the PointOnAreaOverlayer. Under Attribute Accumulation you can create a list of the areas that overlap each point. Then use the ListSorter to sort by the area of the polygon.

Mark, thanks for your suggestion.


Reply


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