Question

Identify multipart features that are X distance apart

  • 10 January 2019
  • 5 replies
  • 27 views

Badge +1

I have a Postgis table with records which have a geometry column. Within the geometry, there are multipart polygons (example. If I query this one record in QGIS, it shows one polygon at location x,y and the other polygon 200 meters north). What transformer can I use to identify records that have multipart geometries that are over 150 meters apart from one another?

Other records in the table have a geometry with one polygon and these can be ignored. I'm looking for records that have multipart geometry and if so, that are greater than 150m apart.

Much appreciated. Thank you.


5 replies

Userlevel 2
Badge +17

Hi @messagemauri,

Use a Counter to assign a unique id to each multi-part, then use a Deaggregator to break them up into polygons. Send the polygons to a NeighborFinder with Group By set to the id attribute, and the following settings:

Input: Candidates Only

Number of Neighbors to find: <blank>

Maximum Distance: <blank>

Attribute Accumulation - Generate List: checked

Closest Candidate List Name: _list

Selected Attributes: _id

This will produce a list on each polygons of all the other polygons in the multi-part and their distances.

Finally, we can use a ListSearcher to search the list to find distances greater than 150. Set the List attribute to _list{}.distance, Search For to 150, and Search Type to First Greater Than.

Badge +1

Hi @messagemauri,

Use a Counter to assign a unique id to each multi-part, then use a Deaggregator to break them up into polygons. Send the polygons to a NeighborFinder with Group By set to the id attribute, and the following settings:

Input: Candidates Only

Number of Neighbors to find: <blank>

Maximum Distance: <blank>

Attribute Accumulation - Generate List: checked

Closest Candidate List Name: _list

Selected Attributes: _id

This will produce a list on each polygons of all the other polygons in the multi-part and their distances.

Finally, we can use a ListSearcher to search the list to find distances greater than 150. Set the List attribute to _list{}.distance, Search For to 150, and Search Type to First Greater Than.

Thank you @DaveAtSafe. After running the workspace, no records are being returned. When I inspect the results from the NeighborFinder, the distances are very small and are incorrect. I know for a fact that I have multi-part features with polygons that are 88,000 meters apart from each other. Could it be that I need to set the distance units in meters somewhere in the FME settings?

 

 

Thank you.
Badge +1

I have always regarded multipart features as an evil that should not be allowed! I am very suspicious that the spatial analysis tools do not really handle the topology correctly. Try exploding the multiparts into single parts and run the analysis again. You will still keep the multipart ids, they just won't be a unique id because each part would have the same id, but it will still give you the right answer.

 

Badge +22

Thank you @DaveAtSafe. After running the workspace, no records are being returned. When I inspect the results from the NeighborFinder, the distances are very small and are incorrect. I know for a fact that I have multi-part features with polygons that are 88,000 meters apart from each other. Could it be that I need to set the distance units in meters somewhere in the FME settings?

 

 

Thank you.

FME always works in the units of the coordinate system of the data, so if you're in WGS84, then the distance is in degrees, not meters.

 

 

If you need to work in meters, you can reproject your data to _AZMED_ (Azimuthal Equidistant) before the deaggregatort/Neighborfinder.
Badge +1

FME always works in the units of the coordinate system of the data, so if you're in WGS84, then the distance is in degrees, not meters.

 

 

If you need to work in meters, you can reproject your data to _AZMED_ (Azimuthal Equidistant) before the deaggregatort/Neighborfinder.

Thank you everyone! @jdh I reprojected it as you noted and got it in meters. Works fine now.

Reply