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).

  • 1
    The question is Gdal specific, the answer is Qgis specific. Then, could we rename the question ?
    – Hugolpz
    Aug 19, 2013 at 12:21

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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