Question

How to fix breaks in polylines?


Hi,

 

I have a contour dataset which has been clipped incorrectly and has produced errors in the resulting polylines. There are numerous breaks in it, for example, the 0.8m contour line (see attached image) and I would like to join these together. A straight line is fine. I have tried Snapper and LineCombiner with no success. Any suggestions would be great!

Thanks.


10 replies

Userlevel 4
Badge +26

Try the LineBuilder - This should do what you want. The lines will need to be ordered correctly though

"Connects input point features in the order they enter, forming linear or polygonal features." you'll need to group by your contour elevation.

The will probably create some issues when you have contours of the same elevation which should not be connected. That's another can of worms though.

Hi @virtualcitymatt​ thanks for your reply! Well the lines needing the breaks to be joined are actually just one feature... As in a feature is one line with a series of breaks in it which need filling.

I have used LineCombiner to effectively split these into separate features, but unsure where to go with that.

Userlevel 4

What about the Snapper did not work? I'd make sure to use the following settings:

imageAlso very important to remember that the snapping distance is relative to the coordinate system of the input. Meaning that if the the incoming data is in degrees, the snapping distance must also be specified in degrees.

Userlevel 4
Badge +26

Hi @virtualcitymatt​ thanks for your reply! Well the lines needing the breaks to be joined are actually just one feature... As in a feature is one line with a series of breaks in it which need filling.

I have used LineCombiner to effectively split these into separate features, but unsure where to go with that.

Ahhh interesting, the you can create an ID for each group of lines, use a Deaggregator to split them and then use the LineBuilder to connect them together (you can then group by the ID). You don't need the LineCombiner here. Again, this assumes that all line segments are ordered correctly.

Userlevel 4
Badge +26

What about the Snapper did not work? I'd make sure to use the following settings:

imageAlso very important to remember that the snapping distance is relative to the coordinate system of the input. Meaning that if the the incoming data is in degrees, the snapping distance must also be specified in degrees.

The Snapper had a bad habit of forming undesired loops. A potential improvement could be had there

Ahhh interesting, the you can create an ID for each group of lines, use a Deaggregator to split them and then use the LineBuilder to connect them together (you can then group by the ID). You don't need the LineCombiner here. Again, this assumes that all line segments are ordered correctly.

Ah ok great this works perfectly for some of them. But others it doesn't as the lines when deaggregated are not in order. An example of one not being in order hereContour error

What about the Snapper did not work? I'd make sure to use the following settings:

imageAlso very important to remember that the snapping distance is relative to the coordinate system of the input. Meaning that if the the incoming data is in degrees, the snapping distance must also be specified in degrees.

Thanks @david_r​, as @virtualcitymatt​ says, often it created these loops in the polyline - even with the settings you suggest

Userlevel 5
Badge +29

Hi @virtualcitymatt​ thanks for your reply! Well the lines needing the breaks to be joined are actually just one feature... As in a feature is one line with a series of breaks in it which need filling.

I have used LineCombiner to effectively split these into separate features, but unsure where to go with that.

You could try extracting the dangle nodes (nodes with only one connection) then using a neighbour finder, find which dangle nodes need to be connected and use the result to fill in the gap(s).

 

It won't improve the vertex order, but it should help get you a (visually) continuous line.

You could try extracting the dangle nodes (nodes with only one connection) then using a neighbour finder, find which dangle nodes need to be connected and use the result to fill in the gap(s).

 

It won't improve the vertex order, but it should help get you a (visually) continuous line.

Thanks @hkingsbury​ - do you have a way you would do this?

Userlevel 5
Badge +29

You could try extracting the dangle nodes (nodes with only one connection) then using a neighbour finder, find which dangle nodes need to be connected and use the result to fill in the gap(s).

 

It won't improve the vertex order, but it should help get you a (visually) continuous line.

Here's an example, its pretty rough and can be refined a bit, but should give you the general gist of it

Reply