QGIS Geometry – Smoothing Out Lines Created by Raster Layers

geometryqgissmoothing

I have a line layer that has been formed from a raster layer (It was a skeletonised raster layer). It now has a lot of unwanted vertices and needs smoothing out before further analysis. I have tried various methods including:

  • Simplify (Geometry Tools)
  • Line Simplification and line smoothing (SAGA vector line tools)
  • v.clean and v.generalizer (GRASS)
  • Smooth (Vector Geometry)
  • Generalizer (Generalizer3 Plugin)

Where I can I have tried the Chaiken's Algorithm. I have also tried various tolerances for the functions that didn't just freeze/fail outright. When I run all of these methods they all return the same line with no change. I'm not sure if I am using these wrong. So any advice on them would also be useful.

Here is an example of the line. Between vertices in the line is about 1m. Ideally this would be just one curved line.

enter image description here

However the whole layer is much larger. It has a 15km radius as you can see below. So these small lines could really do with smoothing out.

enter image description here

Coordinate Reference System: EPSG:27700 – OSGB 1936 / British National Grid

Best Answer

Geometry Generator

If you are just looking for a dynamic, visual smoothing (without altering the underlying geometries), the easiest way is Geometry Generator, one of QGIS' powerful features.

  1. Double click on the layer's name
  2. Select Symbology
  3. Under Symbol Layer Type choose Geometry Generator
  4. In the function area, input smooth($geometry,xxx) (use a real value instead of xxx) and click Apply

This trick is also useful because you can save the symbology as style and re-use it for any number of layers.

enter image description here

Related Question