# GRASS Clean not splitting all lines

Using the census road network for Los Angeles, I am trying to clean the network to have nodes at all intersections. The GRASS v.clean algorithm seems to do this, but is missing some intersections - actually, many intersections. I cannot fathom why this is - the short line segments appear to be very close (if not on) to the main street segments, but they are not splitting the lines as I expect.

I read the documentation and Threshold is not used by break, so that's not an issue. I have zoomed into the intersections as closely as i can and they appear to abut. Any thoughts on how best to address this?

To demonstrate this, the red lines are the original road segments and the short stubs are connectors from block centroids (for a routing analysis i am doing). You'll see one broke the segment and the other did not. Also, it broke where clearly the lines cross, just not always when they abut.

One thought is to add a vertex to the street segment at the nearest point to the end of each short stubs - i wrote the short stubs, so i know they are all directionally towards the street. With that, then i could use v.clean snap. Would have to find a recipe for doing that.

• a quick hack would be to expand the lines connected to to the centroid by a short distance (10cm?), then run the clean process and finally shorten the lines by the same amount.
– JGH
May 15, 2017 at 23:01

I stepped away from this for a few months.

Revisiting, that is exactly what I did. I cribbed an algorithm for extending my line (simple math, but it's been a while), then in a post processing step, I used the Geomery.Intersects method to make sure my line segments intersected (since some were just adjacent based on the find closest line segment as they ended up on an end node) and if they did intersect, then Union'd the streets with the connectors and finally deleted the dangles (anything less than slightly more than the length in my ExtendLine method).

``````def ExtendLine (self, startPoint, endPoint, length):
lenAB = sqrt(pow(startPoint.GetX() - endPoint.GetX(), 2.0) +
pow(startPoint.GetY() - endPoint.GetY(), 2.0))
newPoint = ogr.Geometry(ogr.wkbPoint)