Question

line crossing a polygon

  • 11 December 2019
  • 2 replies
  • 40 views

Badge

Hi,

I have a dataset of lines (from one lat/long to another lat/long).

 

I also have various polygons from an online dataset. I want to find out where the line crosses a polygon and then it the flag 'True'.

 

My guess is to use spatialrelator, but not sure what parameters to set.

 

My line is the requestor, and I believe my polygons should be the supplier. However, not sure what to select as the 'spatial predicates to test'. Or if I even use this method at all.


2 replies

Userlevel 5
Badge +25

SpatialRelator is the way to go. Here's some examples of the spatial relations: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/spatialrelations.htm, I'd say "crosses" is the one to try.

Badge +3

Yes, look at SpatialRelator and the provided help for it as per what @redgeographics suggests. Just to slightly fix up the posted link (there was an inadvertant "," in it), it is:

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/spatialrelations.htm

Notes: "Crosses" are for where the line intersects a Polygon, but does not touch it. Ie. The line has to cross beyond the boundary of the polygon in order for this to be true. If the line only runs along the boundary, or intersects only with an edge vertex, then this will be evaluated as false.

If instead you want to test if the line touches or crosses the polygon, then this is what "Intersects" will do, or both conditions can be tested separately with "Crosses" and "Touches"

Reply