1

I'm trying to calculate the NDVI using raster calculator, but the result is integer instead of decimal.

NDVI = (NIR - RED)/(NIR + RED)

The result is normally in the range -1 to 1, but when i tried to calculate de result is -1, 0 and 1, and it does not have have any number in between like, -0.9 or 0.1. And i need those values so i can classify the result in term of soil occupation

  • 3
    It would help if you posted your Raster Calculator expression. – crmackey Nov 18 '14 at 15:43
  • 3
    Is you raster pixel type floating point? – FGoodison Nov 18 '14 at 16:27
  • You need to add more information! Please Edit your question with your calculation expression and sample data. Short one line questions are generally deleted from this site. – Mark Cupitt Nov 19 '14 at 0:50
11

Pixel depth begets pixel depth. If you are using digital numbers as your input to the NDVI expression then the result will be integer. You will need to explicitly coerce to float in the raster algebra expression.

Float("nir" - "red") / Float("nir" + "red") 
  • 3
    Just a note (to be as lazy as possible) that you don't need to specify everything as a float to get a float in the end (float combined with integer results in float). You will get the same result only changing one instance of one of the rasters to a float: (Float("nir") - "red")/("nir" + "red") – phloem Nov 18 '14 at 18:05
  • 1
    To be safe, I would check the precision of NOT coercing to float on both sides of the equation. You may get some unexpected results, or not. – Jeffrey Evans Nov 18 '14 at 21:33

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.