I have polygons as below, and each polygon is assigned to some value.
What I'd like to do are ...

  • Smoothen boundaries (Values should change more smoothly around boundaries)
  • Fill N/A part properly
  • Generate raster data which met the above

How can I get such a raster data with QGIS ?

enter image description here


Hopefully this example gives you an idea; you can play with the workflow according to your plan how to smooth and/or how you want to fill the N/A area.

In this one Simple filter was used to smooth, and Close Gaps with spline was used to fill the N/A hole.

Input polygon:

enter image description here

Output raster:

enter image description here


  1. Create a polygon layer (your_polygon.shp), and assign Value field. Give zero to the N/A polygon. (See Input polygon)
  2. Rasterize the polygon layer (your_polygon.shp) and save it as (your_raster.tif)
  3. Reclassify the raster value 0 to nodata. Processing Toolbox | SAGA | Raster Tools | Reclassify values Method [0] single, old value= 0.0, new value= -99999. Tick off replace no data values and replace other values. It will give you (Reclassified Grid) layer.
  4. Smooth the (Reclassified Grid) raster layer. Processing Toolbox | SAGA | Raster filter | Simple filter Radius should be given by pixels It will give you (Filtered Grid) raster layer.
  5. Run Close Gaps with spline without mask on the (Filtered Grid) raster layer . Processing Toolbox | SAGA | Raster Tools | Close Gaps with spline This will give you (Closed Gaps Grid) raster layer (nodata value is not filled yet).
  6. Save this raster layer as mask.tif for later use. (This is actually used as a dummy file but it ensures the raster extent of mask be the same with the target layer).
  7. Dissolve the polygon layer (your_polygon.shp) to make a mask (mask.shp) Rasterize the mask polygon (mask.shp) onto the mask.tif
  8. Again, Close Gaps with spline on the (Filtered Grid) with mask (mask.tif) and it is done. (See Output raster)
  • Thank you, I tried to follow the instructions, but I don't have SAGA Raster filter. I enabled SAGA at Processing -> Options, but SAGA doesn't appear(I restarted QGIS, but it didn't work.) I'm using QGIS 2.18.5, should it be out of box ? – Ichiro Apr 27 '17 at 0:45
  • It should be. As far as I could find most recent case was reported on 2.18.4 and it was fixed by restarting QGIS and PC, as you have done already. Can you post your case as new question? – Kazuhito Apr 27 '17 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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