Skip to main content
Question

Create Centrelines of polygons

  • March 24, 2016
  • 13 replies
  • 1176 views

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

13 replies

david_r
Celebrity
  • 8392 replies
  • March 24, 2016

Hi

Have a look at the CenterLineReplacer

David


  • Author
  • 2 replies
  • March 24, 2016

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.


Forum|alt.badge.img+5
  • 68 replies
  • March 24, 2016

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.


Forum|alt.badge.img+7
  • 178 replies
  • March 24, 2016

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.

  • Author
  • 2 replies
  • March 24, 2016

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.


Forum|alt.badge.img+7
  • 178 replies
  • March 24, 2016

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


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • March 24, 2016

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.


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • March 24, 2016

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.


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • March 24, 2016

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?


Forum|alt.badge.img+7
  • 178 replies
  • March 31, 2016

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?


  • 3 replies
  • February 26, 2020

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?


  • 3 replies
  • February 26, 2020

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?


jovitaatsafe
Safer
Forum|alt.badge.img+11
  • Safer
  • 635 replies
  • March 3, 2020

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!