Skip to main content

Is there a way to smooth a line so the resulting line passes through all the original vertices?

Have you looked at any of the smoothing algorithms in the Generalizer transformer?


Have you looked at any of the smoothing algorithms in the Generalizer transformer?

Yes, McMaster and McMaster weighted seem to make big changes to the lines - they move completely away from their original path - to be honest I've read the documentation and I don't really understand what the algorithm or parameters do but I had a little play with them and didn't get any closer to what I want.

 

 

NURBfit produces a nice looking line but it looks like it goes tangentially through the mid-point of the original line segments.

 

 


Yes, McMaster and McMaster weighted seem to make big changes to the lines - they move completely away from their original path - to be honest I've read the documentation and I don't really understand what the algorithm or parameters do but I had a little play with them and didn't get any closer to what I want.

 

 

NURBfit produces a nice looking line but it looks like it goes tangentially through the mid-point of the original line segments.

 

 

I just had a look, you're right about that. Hopefully someone else has any ideas.

Simplifying a line always means you loose vertices, no?. Are these lines arcs? Or simple polylines?


Simplifying a line always means you loose vertices, no?. Are these lines arcs? Or simple polylines?

No, I believe what I want is a bezier curve - there's a smoothing algorithm in Arc, haven't tested it because I want to do the whole process in FME if possible, but it looks like what I want (http://pro.arcgis.com/en/pro-app/tool-reference/cartography/smooth-line.htm).

 

 

My input is polylines.

 

 


The algorithms of the Generalizer transformer are the proper way as david_r suggested.

Another way is to remove vertices by a combination of the VertexCounter and VertexRemover transformers.

If you want to develop your own smoothing algorithm, you can make use of the Python FME API inside a PythonCaller transformer.


Based on your feedback, I'm starting to think that there's no current transformer in FME that can smooth a polyline while preserving the vertices.

However, it should be fairly simple to implement in Python, see this example:

https://stackoverflow.com/a/14348309

Maybe the scipy.interpolate.spline() drawn in red is approaching what you want? (Hint: scipy.interpolate is already installed in the Python interpreter that comes with ArcGIS)

If you do end up implementing this, it would me much appreciated if you would share it through the FME Hub :-)


Hi @btl, It does look like we don't currently have a way to do this in FME, unless you can try david_r's python approach. So I made a suggestion on our Idea page, on your behalf. Can you please add any additional thoughts or use cases in there, and give it an up vote? We will take the popularity of these ideas into consideration, when they plan future development. :)


Based on your feedback, I'm starting to think that there's no current transformer in FME that can smooth a polyline while preserving the vertices.

However, it should be fairly simple to implement in Python, see this example:

https://stackoverflow.com/a/14348309

Maybe the scipy.interpolate.spline() drawn in red is approaching what you want? (Hint: scipy.interpolate is already installed in the Python interpreter that comes with ArcGIS)

If you do end up implementing this, it would me much appreciated if you would share it through the FME Hub :-)

I will have a go - Python in FME will be a new skill.

 

Thanks.

 

 


I will have a go - Python in FME will be a new skill.

 

Thanks.

 

 

Excellent. Feel free to post any questions on the forum here.

Hi @btl, It does look like we don't currently have a way to do this in FME, unless you can try david_r's python approach. So I made a suggestion on our Idea page, on your behalf. Can you please add any additional thoughts or use cases in there, and give it an up vote? We will take the popularity of these ideas into consideration, when they plan future development. :)

Sorry @btl, I forgot to add the link to the idea. The comment above is edited with the hyperlink.

Reply