Question

Create Centrelines of polygons


Hi,

I have been sent a road network in polygon shp file format and need to translate this to just the centreline of each polygon. This will show the road network as a polyline instead of a polygon. Please note I am not just looking to turn the polygons into polylines.

Any help would be most appreciated.


13 replies

Userlevel 4

Hi

Have a look at the CenterLineReplacer

David

Hi

Have a look at the CenterLineReplacer

David

Hi,

I have tried CenterLineReplacer and it produces a "hairy" line.

centerlinereplacer.png

I have only used 1 polygon at the moment to test this on. Any other ideas?

Thank you in advance.

Badge +5

Converting polygons to their centrelines is surprisingly difficult and I have had issues before. The centrelinereplacer does a pretty good job but it has limitations.

By hairy line do you mean the tributary lines coming off the main road? Or are you referring to the smoothness of the actual lines? You could use the generalizer to smooth the output. If you are referring to the tributaries you could use a chopper or an intersector to split the lines apart, then filter out the ones you need.

Badge +7

Hi Amilu,

Does the following list of transformers does the job with sufficient accuracy?

CenterLineReplacer > HullReplacer (Concave) > CenterLineReplacer

 

 

I think this will work OK if the 'hair' on your line is not too long.

Hi Amilu,

Does the following list of transformers does the job with sufficient accuracy?

CenterLineReplacer > HullReplacer (Concave) > CenterLineReplacer

 

 

I think this will work OK if the 'hair' on your line is not too long.

Hi Jeroenstiers,

I shall have a look at doing this in a workspace. Thank you.

Badge +7

Hi Amilu,

Does the following list of transformers does the job with sufficient accuracy?

CenterLineReplacer > HullReplacer (Concave) > CenterLineReplacer

 

 

I think this will work OK if the 'hair' on your line is not too long.

Just a little tip, if you have lines that are curved, you might want to make use of the concave-option in the HullReplacer

Badge +3

One way would be to do following.

1. Negative buffer then a generalizer in reduce mode. Then densify and smooth.

2. Remove pieces smaller then a certain length (like halve average road widht or so).

If visualy not satisfying. You can do step 1 in succesion.

You'll never get a exact centerline network (unless u live in a square grid city or something) without manual labour.

Userlevel 4
Badge +25

Hi,

I have tried CenterLineReplacer and it produces a "hairy" line.

centerlinereplacer.png

I have only used 1 polygon at the moment to test this on. Any other ideas?

Thank you in advance.

Can you post a screenshot of the polygon that produces the hairy line? I'd like to see what that looks like for FME to produce something like that.

Userlevel 4
Badge +25

Hi,

I have tried CenterLineReplacer and it produces a "hairy" line.

centerlinereplacer.png

I have only used 1 polygon at the moment to test this on. Any other ideas?

Thank you in advance.

I tried it on a dataset and did get occasional 'hairs' but only at the end of lines. Perhaps you are working on multiple polygons? Can you dissolve them together with the Dissolver?

Badge +7

Hi Amilu,

Does the following list of transformers does the job with sufficient accuracy?

CenterLineReplacer > HullReplacer (Concave) > CenterLineReplacer

 

 

I think this will work OK if the 'hair' on your line is not too long.

Hi Amilu,

Did this method solve your question?

Hi Amilu,

Does the following list of transformers does the job with sufficient accuracy?

CenterLineReplacer > HullReplacer (Concave) > CenterLineReplacer

 

 

I think this will work OK if the 'hair' on your line is not too long.

What is the reason for using HullReplacer here?

Hi Amilu,

Does the following list of transformers does the job with sufficient accuracy?

CenterLineReplacer > HullReplacer (Concave) > CenterLineReplacer

 

 

I think this will work OK if the 'hair' on your line is not too long.

Hi @jeroenstiers, is there a specific reason to use HullReplacer here?

Userlevel 1
Badge +11

Hi @jeroenstiers, is there a specific reason to use HullReplacer here?

Hi @fmeuser99,

Thanks for your question! The HullReplacer replaces input typically with a polygon outlining the hull or outline of the feature. I imagine it was used here as a smoothing process to get a better result when using the CenterLineReplacer a second time. There's been development on the transformer since 2016, so I'd suggest using the latest official releases' CenterLineReplacer first to see if it gives you the desired result.

 

 

If you have further questions on it, I'd encourage you to post a new question as this one is fairly old and likely inactive. Posting a new question will have better visibility as well. Thanks!

Reply