Question

Split line at intersection

  • 24 July 2013
  • 4 replies
  • 38 views

Hi

 

 

I am trying to build a connectivity model for electrical cables.

 

 

I need to break lines with the following rules:

 

 

If the end of line A touches line B then break line b at that point

 

 

If line A has a node/joint on it, break it at that point

 

 

If line A crosses line B, but there is NOT a vertices at the point it crosses, DO NOT break that line

 

 

if line A crosses line B, but the end of line B is a short distance away from line A, shorten the line to A, and break.

 

 

IF line B does not quite touch line A, adjust its length and break

 

 

I have played with the topology builder etc and so I am confident that I can identify the nodes where lines need to be broken.  I can't figure out how to break the lines in the correct places.  

 

 

Can someone point me towards the correct transformer(s) to do this?

 

 

Thanks

4 replies

Userlevel 2
Badge +17

Some ideas: Rule 1: If the end of line A touches line B then break line b at that point

Create end nodes of line A (CoordinateExtractor + 2DPointReplacer), split line B at those points (PointOnLineOverlayer).

 

Rule 2: If line A has a node/joint on it, break it at that point

If node/joint are given as points, send the node/joint to POINT, line A to LINE port of a PointOnLineOverlayer.

 

Rule 3: If line A crosses line B, but there is NOT a vertices at the point it crosses, DO NOT break that line

Create all vertices of A and B (Chopper: Mode = By Vertex, Maximum Vertices = 1), select common vertices (Matcher), and then split A and B at the common vertices (PointOnLineOverlayer). If a line has self-intersections at its own vertices, filter out duplicate vertices of the same line before selecting common vertices.

 

Rule 4: if line A crosses line B, but the end of line B is a short distance away from line A, shorten the line to A, and break.

Maybe "Find intersecting lines that have different attribute values" could be applied to find intersections between A and B. To find the closest points on line A from end nodes of line B, the NeighborFinder can be used after creating end nodes of line B.

 

Rule 5: IF line B does not quite touch line A, adjust its length and break

A SpatialFilter (Tests to Perform = DISJOINT) can be used to find line B which does not touch line A. I couldn't understand the rule of adjusting length and breaking...

 

Takashi

Userlevel 2
Badge +17
P.S. (Rule 5) If there are multiple A and you use the SpatialFilter with DISJOINT to find B (CANDIDATE) which doesn't touch any A (BASE), specify "Pass Against All Bases" to "Pass Criteria" parameter.
Thanks for the help Takashi, got me well on my way!
Badge +3

I think you can do this with 2 topology builders and some snappers.

I would.

 

  1. use a endpoint snapper followed by a segment snapper. (set to a small max value).
  2. (concerning " If line A crosses line B, but there is NOT a vertices at the point it crosses, DO NOT break that line"

    Identify those crossings by lineonlineoverlayer and cut a piece out (either from B or A, not both). ID them as something like "bridge".

    Create topology, network=not clean. But do not use the cut outs (yet).

  3. check if network is fully connected (apart from "bridges" of course)
  4. if satisfied, use another topology builder. Only this time set it to network = clean. This will prevent "bridges" to be cut, so no node will be created there.

 

If snapping to small value still leaves some unconnected or still overshot, snap those again with a larger setting.

(this is about a standard technique I mostly use)

 

 

Reply