Skip to main content
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

david_r
Celebrity
  • March 24, 2016

Hi

Have a look at the CenterLineReplacer

David


  • Author
  • March 24, 2016
david_r wrote:

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
  • 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

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
  • March 24, 2016
jeroenstiers wrote:

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
jeroenstiers wrote:

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
  • 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+44
  • Safer
  • March 24, 2016
amilu wrote:

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+44
  • Safer
  • March 24, 2016
amilu wrote:

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
jeroenstiers wrote:

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?


  • February 26, 2020
jeroenstiers wrote:

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?


  • February 26, 2020
jeroenstiers wrote:

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
fmeuser99 wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings