Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

Update:

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.

http://underdark.wordpress.com/2011/08/08/creating-a-gradient-fill-for-polygons-in-qgis/

share|improve this question
    
Hi James. Do you need it for hill shading? –  julien Aug 8 '11 at 16:06
    
No it is just to use to show the edge of a polygon. –  James S Aug 8 '11 at 18:08
add comment

2 Answers

up vote 8 down vote accepted

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

share|improve this answer
1  
Adding transparency to the above method gives a nice look as well. –  Ando Aug 9 '11 at 4:17
add comment

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.

share|improve this answer
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 Apr 2 at 7:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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