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.

In my raster layers the value -999 means "missing". Those points completely mess up any colormap in qgis because qgis treats them as normal values and includes them in the classification.

I would like to ask

1) is there any raster format that allows for missing values ? (I mostly use geotiff)

2) how can I replace -999 with for example 0 in every raster-cell? QGIS raster-calculator does not seem to do this. I did not find anything like an inline if-function like if(val=-999,0,val)

share|improve this question
    
Welcome to gis.stackexchange @stn. Please try to ask only one question per thread. In this case #3 should be move to a separate topic because it can be answered totally independently of your first questions. –  underdark Apr 3 '12 at 16:29

2 Answers 2

If you are only creating a map you can hide these values in QGIS by going to your layer properties --> transparency and then selecting the values you want to hide.

You can also use gdalwarp to replace the missing values as such:

gdalwarp -srcnodata -999 -dstnodata 0 source.tif output.tif

enter image description here

share|improve this answer
    
For grayscale-maps this is not much of a problem. You can set min and max and transparancy and it works. Single-channel-color-maps on the other hand refuse to honor the transparent values. The "classify"-button always produces -999 as the minimum –  stn Apr 3 '12 at 19:44
  1. GeoTIFF with NODATA value set to your liking. If set correctly, QGIS should ignore them in colormaps.
  2. eq( [input]@1, -999, 0 ) NOTE: this is a command for RasterCalc plugin (available via plugin installer, also needs pyparsing), this is not for embeded Raster Calculator.
  3. Why not ASCII GRID for doing change you need? Raster\Convertion\Translate, choose output filename with type Arc/Info ASCII GRID You can also try: gdal2xyz
share|improve this answer
    
GeoTIFF with NODATA works, thanks. In the german version of QGIS this matter is very confusing because the setting is called "Kein-Datum-Wert" which means "No-Date-Value" or "No-Datum-Value". It does not mean anything like "No-Data-Value". Thanks for clearing this up for me. –  stn Apr 3 '12 at 20:00
    
The ASCII-GRID/gdal-question has been moved to gis.stackexchange.com/questions/22791/…. gdal2xyz is perfect for exporting the data. The real problem is not getting data out, but getting processed data back in, with the correct projection and coordinates etc. That is very easy for vector-layers (just open the dbf of a shapefile in oo-calc) and apparently very difficult for raster. –  stn Apr 3 '12 at 20:02

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.