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.

I have a raster layer in GeoTIFF format, with continuous data values between -1 and +1. For the colour map, I would like...

  • >0 to be green
  • = 0 to be grey
  • <0 to -0.25 to be pink
  • <-0.25 to -0.50 to be dark pink

...etc to 1. Is this possible with QGIS? I tried putting ranges in the colour map box, but it didn't work.

If not, I'll do it in R.

share|improve this question
1  
> but it didn't work. is not helpful. What did not work exactly? –  Luke Aug 14 '12 at 1:29
    
Putting ranges in the colourmap Value box, e.g. using relational operators like in the example above. It reverts to 0 when the dialogue box is closed and reopened. –  gisol Aug 14 '12 at 8:04
add comment

2 Answers

up vote 6 down vote accepted

This seems to work for me on a -1.0 - 1.0 NDVI raster

  • Double click on the raster layer in QGIS table of contents/layer list
  • Click "Style" tab (1st tab on the left)
  • Select "Render as" -> "single band gray" and "Single band properties" -> "Color map" -> "Colormap"
  • Click "Colormap" tab (2nd tab from the left)
  • Click "Add entry" and add the following entries:
    • -0.4999999 (< -0.5)
    • -0.2499999 (>-0.5 <-0.25)
    • -0.0000001 (> -0.25 <0.0)
    • 0.000000 (=0)
    • 1 ( >0 <=1)
share|improve this answer
    
This works, thanks a lot. –  gisol Aug 14 '12 at 8:05
add comment

One way would be to classify your raster using GRASS r.reclass from the Sextante toolbox. You'll need a 'rules' text file to do this, there are some examples here. Example 2 is probably something like you'd need (with a bit of editing, of course). r.reclass groups raster values into classes following the rules set in the 'rules' text file.

Nick.

share|improve this answer
    
I could reclass in QGIS too, using the Raster Calculator. I was hoping to do it from the Styles/Colormap dialogue, though perhaps it will be easier to reclass into a new raster. –  gisol Aug 13 '12 at 14:33
    
If you use r.reclass you could then (if you wish) unleash the raster polygonzer on the raster to make a vector polygon shapefile for colour styling. Just a thought. N. –  nhopton Aug 13 '12 at 14:43
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.