Question

Finding lines not connected to/touching/near any other lines

  • 23 March 2018
  • 5 replies
  • 84 views

Badge +7

As a proof of concept, I want to use FME to find lines not connected to, touching or near any other lines. The nearness would be user defined e.g. keep lines within 10 metres of another line. I can't find an existing answer so I'm posting my solutions. I was inspired by @redgeographics answer to:

https://knowledge.safe.com/questions/42455/lines-connected.html

The first solutions has 2 options for pre-processing. Either buffer the input lines by the amount required to take care of undershoots. This will obviously create polygons. Or use the LineExtender to do a similar job. The difference with the LineExtender is the direction of the extensions at each end (see documentation).

Then send the pre-processing result to both the Requestor AND Supplier ports of the SpatialRelator. Choose the Intersects and Touches tests (regardless of whether you're using buffered or extended lines). Select ObjectID (or other primary key) as the attribute that must differ. Results with _related_candidates values of 0 (zero) are the lines not connected. A Tester could be used to filter the data to keep, or to filter the unwanted lines to do a DELETE fme_db_operation on the source data.

The second solution is to use the NeighborFinder in CandidatesOnly mode. Set a Maximum Distance to included or excluded non-intersecting/non-touching lines for your desired tolerance. The Matched port will contain the features to keep. The UnmatchedCandidate port had more than just the unwanted lines. I don't know why but I'm not that familiar with the NeighborFinder so there may be a setting I need to tweak. This solution is more elegant in the sense it doesn't involve doing any modifications to the input data.

I've attached my test data in a zipped ShapeFile.


5 replies

Userlevel 4

One solution could be to use a Snapper with a 10m radius and then a NetworkTopologyCalculator, as described in https://knowledge.safe.com/questions/42455/lines-connected.html

Badge +7

One solution could be to use a Snapper with a 10m radius and then a NetworkTopologyCalculator, as described in https://knowledge.safe.com/questions/42455/lines-connected.html

I experimented with the NetworkTopolgyCalculator and wasn't completely happy with the results (but again, I'm not so familiar with that Transformer). But I didn't try it in conjunction with the Snapper.

 

 

Userlevel 4
I experimented with the NetworkTopolgyCalculator and wasn't completely happy with the results (but again, I'm not so familiar with that Transformer). But I didn't try it in conjunction with the Snapper.

 

 

The Snapper basically introduces a tolerance.

 

If you also need to detect intersecting lines that do not break at the point of intersection, try also inserting an Intersector or a TopologyBuilder after the Snapper and before the NetworkTopologyCalculator.
Badge

I think you have the answer already with the NeighborFinder in CandidatesOnly mode.

Is that not providing you with the right results?

Badge +7

I think you have the answer already with the NeighborFinder in CandidatesOnly mode.

Is that not providing you with the right results?

Sorry - perhaps I wasn't very clear. I'm not exactly asking a question, rather sharing my solutions to potentially help others. But there might be other ways or better ways of doing it...

 

Reply