Skip to main content

LinesOutsidePolygonsI have 2 large Mapinfo tables - Hedges (lines) and Gardens (polygons). I want to retain all hedges outside gardens, including those which have ends touching the gardens. I want to remove all hedges running along (coincident with) garden boundaries. I attach an image showing with red crosses these lines. All others should be kept including those touching the boundary at an angle.

Is this possible using the SpatialFilter or SpatialRelator? I've tried various ways with both these but I am not able to achieve this. In Mapinfo I achieved it by the SQL query "Not Obj Within Any (Select Obj from Gardens)". Is there an equivalent in an FME transformer? The only other way I can think of is by buffering the gardens slightly and then using the Clipper to remove all hedges within the gardens (and the buffer would remove those running round the garden boundaries).

Many thanks if you can help!

Jane

@janem​ You should be able to accomplish this with the SpatialFilter. I think the Touches predicate would work. However... the SpatialFilter & SpatialRelator do not use a tolerance, so lines that early touch or are not noded might not meet the criteria you set in the spatial predicate. Sometimes you need to do a bit of snapping (AnchorSnapper) to add vertices to the areas (gardens).

If you still have trouble, perhaps attach a small sample dataset and your workspace, or send it to me at mark at safe . com


Many thanks for your suggestion, Mark. I tried the SpatialFilter with the Touches predicate again, with the Writer attached to the Failed port. However, as you can see in the attached image, it doesn't remove hedge lines with an end node touching a garden polygon (black lines retained - good, pink lines removed - good, highlighted purple lines retained - bad).

What I need is something like "Have their centre in" applied to the lines, so that all lines entirely coincident with the polygon boundary can be removed.

I tried the same but using Within and the Failed port, and no lines were removed because none fall entirely within a polygon.

A buffer and Clipper is the only way I can see to do this at the moment, but not ideal as it removes the 'touch' relationship with the ends of the hedges with the garden polygons which I may need some time.

I attach a sample workspace and will send you the sample data if you do get chance to have a look.

Many thanks!


Just an update - I've used the Clipper and it actually does what I want without using a buffer - I didn't realise that it will treat lines on the boundary as Inside, which is great!


Many thanks for your suggestion, Mark. I tried the SpatialFilter with the Touches predicate again, with the Writer attached to the Failed port. However, as you can see in the attached image, it doesn't remove hedge lines with an end node touching a garden polygon (black lines retained - good, pink lines removed - good, highlighted purple lines retained - bad).

What I need is something like "Have their centre in" applied to the lines, so that all lines entirely coincident with the polygon boundary can be removed.

I tried the same but using Within and the Failed port, and no lines were removed because none fall entirely within a polygon.

A buffer and Clipper is the only way I can see to do this at the moment, but not ideal as it removes the 'touch' relationship with the ends of the hedges with the garden polygons which I may need some time.

I attach a sample workspace and will send you the sample data if you do get chance to have a look.

Many thanks!

I forgot to attach the image.....


Reply