Skip to main content

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

 

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:


@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.


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.


@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