50

Is it possible to smooth or generalize a polygon in QGIS, perhaps by using a plugin like the Generalizer Plugin for lines?

I could convert my polygons to lines, smooth them and convert them back to polygons but this is not working for my polygons because of several reasons.

5 Answers 5

39

You can use the "Simplify" geoalgorithm via:

Vector menu -> Geometry tools -> Simplify

simplify

Beside this you can use the Douglas-Peucker algorithm in PostGIS too, so you can use it PostGIS then adding the PostGIS layer to QGIS. you can find some info here about Simplify: Reduce the weight of a geometry.

SELECT simplify(the_geom, 500) AS simpgeom 
FROM neighborhoods

simplfy

3
  • 6
    That simplifies the lines, making them more jagged. Is there a way to smooth them(which I guess would have to interpolate some points)? Dec 23, 2012 at 17:13
  • Simplify just removes vertices from the line or polygon, which can still leave jagged lines. You want the Generalizer plug in if you want smoothed lines. Aug 19, 2014 at 2:48
  • 1
    For additional info, this tool has moved in QGIS 2.16 to the Processing toolbox / QGIS geoalgorithms / Vector geometry tools / Simplify geometry
    – gisnside
    Sep 9, 2016 at 15:43
27

Aragon's answer is good for generalization. Bryan's answer is good for smoothing but is a little convoluted. Here are two alternatives for smoothing:

  • Use the GRASS v.generalize tool from the Processing toolbox. This is the module on which the QGIS Generalizer Plugin in Bryan's answer is built. The GRASS tool allows you to use polygons so you can avoid the steps of converting to lines and back again. It is an excellent tool with a LOT of algorithms for smoothing/generalization.
  • Use the 'old-school' approach of buffer-debuffer. Simply buffer your polygons by an appropriate amount (your call depending on the nature of the data and degree of smoothing you require). Then de-buffer by applying the same value for the buffer distance but making it negative this time. If you dissolve the buffers first time, you can often simultaneously eliminate small gaps or doughnut holes if required (though this is not always desirable so consider carefully before opting to dissolve).

Smoothing often means the addition of vertices (especially with the buffer-debuffer method). After smoothing, you could then apply generalization as per Aragon's reply.

2
  • 3
    Nice demonstration of the buffer/de-buffer approach at Paul Ramsey: Removing Complexities Oct 3, 2014 at 16:49
  • Excellent idea! I used both approaches, Ramer (lines) and area-based, the latter giving a bit smoother polys, but still looking like barbed wire. Hope this approach works better.
    – culebrón
    Nov 17, 2015 at 18:51
17

I've also had luck using the QGIS Generalizer plugin (enable experimental plugins), and then:

Vector > Geometry Tools > Polygons to lines

Then use the Generalizer plugin to smooth the lines and vertices

Plugins > Generalizer > Generalizer
Algorithm: "Chaiken's Algorithm"

Then turn the lines back into a polygons

Vector > Geometry Tools > Polygons to lines

This does a better job actually smoothing the lines and rounding the corners. It's a bit clunky to have to have to switch back and forth between lines and polys, but it works. I know that there's ways to do this via Grass as well, but I've found them difficult to setup.

1
  • This a useful approach: however, I had holes in my polygons and I cant recreate them with the lines->polygon tool
    – Djana
    Oct 11, 2016 at 13:32
12

It is now available the Smooth geometry algorithm via Processing Toolbox > QGIS geoalgorithms > Vector Geometry Tools.

  1. Take jagged geometry objectsenter image description here
  2. Set options (I changed the Iterations field to 5 and was satisfied with the result)enter image description here
  3. Get smoothed object enter image description here
4
  • Is the "smooth geometry algorithm" still a valid option? Since I do not get the desired results using other algorithms I was looking for this algorithm in my installation of QGIS 2.14 but could not find it. I then installed QGIS 2.18.16 but still can´t find this algorithm in the processing toolbar. I´d appreciate any help in finding or installing it.
    – Taya
    Jan 28, 2018 at 14:29
  • 1
    Ok, Solution to my own problem found after restarting the system. There was a problem with the processing plugin right after the fresh installation of QGIS 2.18 was completed. Restarting the system and QGIS fixed this and I can see the "Smooth geometry algorithm" inside the processing toolbox.
    – Taya
    Jan 28, 2018 at 17:50
  • I should check gisSE more often :) I'm glad you found the solution Jan 29, 2018 at 8:03
  • I think you are missing a step... I have the French version for my QGIS install so I can't quite add the step myself but somewhere along the line I had to choose "lisser". Sep 18, 2018 at 15:34
3

Right click on main board (on top) then activate "toolbox" -> see as you can see on pic below enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.