Is it possible to use a gradient fill on a polygon in QGIS?

I would like to have my polygons with a colour at the edges, fading to clear/white as it moves away from the edge. The majority of the centre of the polygon will be white or clear.

It is something people I know who use Illustrator can do. I wondered if there was a way to emulate it in QGIS.

Here is an example. I would like something like the purple shading.

enter image description here


This method suggested below does work, however it produces some annoying extra bits for my polygons. For example, see the image below:

enter image description here

I am unsure how to remove these. I cannot use a mask as I need to be able to see the base mapping and other data outside of this polygon on layers that are below this layer. Using a mask would obscure all of these layers.

I have included a link to Underdarks blog post about this, which gives more detail, and contains the code to set this up.


  • Hi James. Do you need it for hill shading?
    – julien
    Commented Aug 8, 2011 at 16:06
  • No it is just to use to show the edge of a polygon.
    – James S
    Commented Aug 8, 2011 at 18:08

2 Answers 2


For what it's worth, support for these kinds of fills has now been added into QGIS and will be available from version 2.4. You just need to select "Shapeburst fill" as the symbol layer type:

enter image description here

Additionally, the line offset algorithm has been improved so you shouldn't see the artifacts you were previously experiencing.

  • 1
    Thanks for following this up. I saw this new feature in master and it is exactly what I needed. Just a shame it didn't exist in QGIS two and a half years ago :) This feature is a great addition to QGIS.
    – James S
    Commented Apr 2, 2014 at 7:15

There is no option for gradient fill as far as i know. But you can emulate a gradient if you don't mind some work creating your own symbol. I've done a quick example with only four color step, so it's not a smooth gradient ... but you get the idea.

All you have to do is create layers of type "simple line" and give them a positive offset. That will move the border "inside" the polygon. Don't forget to enable symbol levels for a clean rendering.

enter image description here

  • 1
    Adding transparency to the above method gives a nice look as well.
    – Ando
    Commented Aug 9, 2011 at 4:17

Your Answer

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

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