Solved

SpatialFilter and SpatialRelator Spatial Predicates Failing?

  • 2 February 2022
  • 5 replies
  • 18 views

Badge

The spatial predicates for the SpatialFilter and SpatialRelator transformers do not seem to be working as expected.

 

For example, after using the LineOnAreaOverlayer transformer to split candidate lines where they intersect any filter area boundary, a SpatialFilter ("Filter OGC-Contains Candidate") fails to pick up a candidate line which falls wholly within an area filter.

 

Likewise, after creating candidate midpoints of filter lines using the Snipper transformer, a SpatialFilter ("Filter OGC-Intersects Candidate") fails to pick up on the midpoints which intersect their originating filter lines.

 

After reading the documentation of these transformers, I'm struggling to understand why this is occurring. Is this issue related to projection / coordinate systems? Using the 'Select by Location' tool in ArcGIS Pro does yield the expected results (i.e. all the midpoints are selected when an intersect query with the lines is applied, and all split lines are selected when a 'within' query with the areas is applied). This stops me using these transformers in FME, as I tend to feel I can't trust them.

 

It would be great if anyone had any ideas on what I might be missing here. I have attached an FME template containing sample data which demonstrates these issues.

 

 

icon

Best answer by markatsafe 4 February 2022, 20:29

View original

5 replies

Badge +20

There are a couple of issues:

Why do you need to SpatialFilter after LineOnAreaOverlayer? If you need to separate the lines inside the areas from the ones outside just Test(er) for _overlaps>0.

SpatialFilter/Relator lack a Tolerance parameter which is particularly important when inside features also touch the boundary. To get around that just buffer the area features with a very small value (0.001 maibe).

There is a transformer for Point On Line operations named PointOnLineOverlayer. SpatialFilter/Relator don't handle point on line operations.

Badge

Thanks for the info. Right, the SpatialFilter is unnecessary in this example, but I pulled the example together just to demonstrate the kind of issues I've been experiencing with SpatialFilter / SpatialRelators in other workbenches where they are necessary. I've found that SpatialFilters can handle point on line operations in other situations (see attached example). What particularly confuses me is that ArcGIS Pro seems to pick up the spatial queries in my initial example with no issues.

Badge +20

These are vertices of the lines. It's different for these.

Badge +2

@tgibson​ Thanks for including the workspace examples so it's easy to replicate your issue.

It's a floating point coordinate issue. There is no tolerance on the SpatialFilter or SpatialRelator, so coordinates have to match exactly. In the image below that is based on your example, the marked line possibley very slightly crosses the area boundary, since there is no vertex on the area at the line/area intersection. So SpatialFilter will fail the Contains test. The LineOnAreaOverlayer does not add a vertex to the areas where the area boundary splits the line (that would be a helpful option).

You can fix the problem by including AnchorSnapper with Segment Snapping after the LineOnAreaOverlayer. this will add vertices to your areas and if you use those areas in the SpatialFilter will give a better result.

imageRevised example attached (FME 2021.2)

Badge

@Mark Stoakes​ Many thanks for your detailed response, this has been very helpful in clarifying the issue and good knowledge to have for when using the SpatialFilter or SpatialRelator in future.

Reply