I am new to GRASS and am trying to use it because I can't afford the Spatial Analyst extension in ArcGIS.

I am trying to remove all of the values in a NDVI raster less than some value to exclude shadows and bare soil before I calculate averages. I have tried

NDVI_b = if(NDVI_a <= 0.1,null(),NDVI_a)

My understanding is that this statement means that a new map (NDVI_b) should be created where cell values <= 0.1 are replaced with null otherwise the value remains the same as in NDVI_a. However all I'm getting is null value for all cells in my output raster. Is there something fundamental that I'm missing? I have tried using both the GUI Raster Map Calculator as well as the command console.

  • Have you set your region to match the NDVI_a raster? (This is FAQ #0 for GRASS users. Always set the region first)
    – Micha
    May 26, 2016 at 9:13
  • Yes, I did set my region to match my raster and I opened it and it projected correctly. I think that it is a problem with my Geotiff. I was able to do something similar with a sample raster that I downloaded, but I can't get it to work with a geotiff that was outputted by Pix4D. I compared the gdalinfo for my file and the downloaded file but did not notice substantial differences. I thought that a geotiff was a goetiff.
    – eapedaile
    May 26, 2016 at 18:00
  • When I run r.mapcalc on my geotiff, the output raster is basically empty:
    – eapedaile
    May 26, 2016 at 18:58

1 Answer 1


Figured it out - the problem was that my original geotiff was not properly projected. I fixed the projection and the raster calculation works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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