Solved

Problem with spatial relations


Badge

Hello,

I need to merge attributes of polygon to polyline that contains that polyline (polygon can contain whole polyline or just one part of it) I am using SpatialRelator with test Requestor contains Supplier as shown in image below.

Problem i have is that this test merges attributes from polygons that only contains start point of polyline. Is there any other way to merge these two features?

 

In case that polyline goes over more than one polygon it's enough to merge attributes from any of containing polygons.

Blue line is polyline. With SpatialRelator polyline gets attributes of polygon 2353 but it needs to get attributes of polygon 28 or 30.

icon

Best answer by markatsafe 4 July 2018, 18:52

View original

5 replies

Badge +3

@luckym

Spatialrelator relates; it doe not intersect. So in your example, no polygon actually contain the polyline.

You can use "intersect"

Or you can reverse the inputs and test for "crosses".

Also you can use calculate cardinality, listconcatenate "relationsships.card_line" with no delimiter and and test for it to be >0.

Use list to get all polygon_id's that are crossed by the polyline.

Of course you can also intersect or do lineOnArea and relator.

Badge +2

@luckm There is a pretty good description of the spatial predicates buried in the documentation under Spatial Relations Defined (links are on the SpatialRelator and SpatialFilter transformer docs.). This should help you understand the different spatial interactions. "Crosses" looks like the most appropriate predicate, as @gio suggests.

Badge
@gio

The test i used in my actual workbench is intersects I made a mistake when i posted a problem. And that test gives me results above. I would use crosses as you and @MarkAtSafe suggest but I don't have it

Maybe I'm doing something wrong or maybe test crosses is reserved for non-trial versions of FME?

Badge +3

@luckym

Hi,

Crosses appears when you set Support Mode to "Support All Predicates"

Badge
@gio

Thank you. This works very well. @MarkAtSafe thank you too.

Reply