5

I have downloaded Globcover data in GeoTIFF format. I want to create a new grid which only has values where the Globcover data (the only band in the TIF file) has one certain value (==190).

Can I do this with GDAL?

If not, which way should I go? The procedure should be callable from a Shell script (Linux). I have QGIS installed (but no clue how to use it).

Hugolpz
  • 2,653
  • 3
  • 26
  • 51
andreash
  • 741
  • 3
  • 8
  • 16
  • 1
    The question is Gdal specific, the answer is Qgis specific. Then, could we rename the question ? – Hugolpz Aug 19 '13 at 12:21

1 Answers1

11

In QGIS you have the raster calculator (Under the "Raster" menu) which will do what you want. (not a shell script command)

  • Load your Globcover raster into QGIS, and open the Raster Calculator.
  • The raster will appear in the "Bands" window.
  • Enter a name for the new "Output Layer".
  • Now double click on the Globcover band name so that it appears in the lower "Raster calculator expression".
  • Then complete the expression by typing "=190" in that window.
  • Click OK to create the new raster.

Note that you will have a raster with values of either 190 or 0 everywhere else. You can further use gdal_translate to set the zeros to NULL.

HTH, Micha

urcm
  • 22,533
  • 4
  • 57
  • 109
Micha
  • 15,555
  • 23
  • 29