Skip to main content

Hi,

I have a dataset with Centerlines shown in blue, some lines contain too much detail which is not accepted as input for the LineDivider I use in the downstream pipeline.

Is there a way I can smooth the blue centerline into something like the red line shown on the right?

The Generalizer should be the way to go I guess but did not find the right settings yet.

 

 

In the example shown, my assumption would be that that is at least 2 separate lines/features, potentially 3. Would that be correct? If so I am not sure that generalizing features would be the best way to clean up small branches off of the main network. A possible solution may be to use a LineCombiner and then calculate line lengths, filtering out those which are too small for your requirements. You could then use the generalizer afterwards, if you were still wanting to smooth the final lines.

Blue centerline is 3 lines/features (green, red, and purple)
Blue centerline is 2 lines/features (green and purple)

 


Hi @lambertus I’ll also suggest that you try a Generalizer on the input feature(s) before the CenterlineReplacer.


@liamfez thanks for your reply! These are goods questions. In my case the orange polygon is the roads dataset. I want to get insight in the length of each road. Hence, I created centerlines. In most case this works fine. However, in this specific case in the figure I get too much centerlines which will probably lead to a wrong estimation of the length of that road. That leads to my final question, how to generalize the centerline into shown red line. 

@DanAtSafe thanks for your reply. You want me generalize the polygons in order to get better centerlines? Thats sounds good. Do you have a suggestion how to do this? I tried the Generalizer but did not found the right settings yet.


@lambertus I see now, I misunderstood originally and was thinking that the blue lines were the initial data. If you are starting with the orange, then I would agree with @DanAtSafe and suggest trying some of the generalizing or smoothing algorithms in the generalizer. Might take some playing around with the settings to get the results you are looking for.

I think you may still be able to use a part of my original solution to help out with any cleanup though. If you are still getting those little lines, you could try the TopologyBuilder and then LengthCalculator. And then decide how you want to filter out features that are short in length and at the end of a branch.


Hi @lambertus I just used the default parameters in the Generalizer on a sample input polygon.  My idea is that the number and frequency of vertices affects the number of “branches”.  You could also try a Densifier to see how adding vertices to the polygon changes the center line.


Reply