I have Landsat 7 images from 2011 to 2016 for my agricultural studies. First I corrected the slc-off problem of band 3 and band 4. Then I calculated the NDVI using both the raster calculator and the vegetation index (slope based) processing toolbox. I realised that the data range of the NDVI Images are different. The raster calculator results between -0.242 - 0.568 and the vegetation index under processing toolbox results between -0.225993 - 0.553768. Can this be due to rounding or is there something that I may be missing?

I also use the raster layer statistics tool to see if these two NDVI images are really different. The results are:

From vegetation index algorithm: Valid cells: 42384039 No-data cells: 15942162 Minimum value: -0.991935491562 Maximum value: 0.982142865658 Sum: 2857838.41327 Mean value: 0.0674272315876 Standard deviation: 0.184433938177

From raster calculator (which I choose from the dropdown menu bar of Raster) Valid cells: 42696562 No-data cells: 15629639 Minimum value: -1.0 Maximum value: 1.0 Sum: 2862525.41327 Mean value: 0.067043463904 Standard deviation: 0.20274331204

This is my QGIS screen:

  • Have you checked your calculation method used in the raster calculator matches the one used by the output mechanism of the vegetation index algorithm? The info can be found in the SAGA documentation.
    – Phil G
    Nov 10, 2016 at 14:36
  • Thank you @PhilG for the link. In theory they both do the same thing. (NIR-Red)/(NIR+Red) is used for vegetation index under processing toolbox, depending on the link you have given. (B4-B3)/(B4+B3) is the formula I used for raster calculation. But I can not think of a meaningful reason why they have different data range. I have used the Landsat 7 Image of date 3/26/11.
    – Ayda Aktas
    Nov 10, 2016 at 15:24
  • In terms of the Raster Calculator are you using the SAGA or the GDAL one? There are two available in the toolbox (in 2.16 at least, haven't got another system to check right now).
    – Phil G
    Nov 11, 2016 at 8:41
  • @PhilG I don't know if its SAGA or GDAL but I used the raster calculator under the main dropdown menu of Raster. I'm using 2.8 Wien on a Mac.
    – Ayda Aktas
    Nov 11, 2016 at 9:15
  • Testing with Landsat 7 data I get three different results between the NDVI returned by the Vegetation Index, the Raster Calculator from the Menu dropdown and the SAGA raster calculator found in the toolbox. On 2.16 for some reason the GDAL raster calculator in the toolbox crashes for me, thus I can't check with that. All values differ and there is no clear rounding identifiable. Might be worth asking the SAGA developers on their support forum.
    – Phil G
    Nov 11, 2016 at 9:31

1 Answer 1


Testing and comparing a Landsat 7 image (different area to yours, but same sensor data) reveals that the values are in fact both "correct".

You (and I) have fallen into the trap of the Raster rendering definition - effectively the Raster styling. This is found by right clicking the layer -> properties -> Style

Raster style screen

In the screen you can define how to load the min/max data values. As standard these seem to be defined by the Cumulative count cut 2.0 - 98.0%. Experiment with the settings and you will notice the values in the Min Max boxes under the Color Gradient Settings will change.

Having run the test data through both of your described methods I get the following results when querying the layers (example point):

Data values at sample point

Top to bottom these values represent:

  • 0.4603175 - The calculated value of the Raster -> Raster calc tool
  • 0.4603175 - the value returned by the SAGA -> Vegetation Index (Slope based) NDVI
  • 34 - Band 3 (Red) of Landsat 7 ETM+
  • 92 - Band 4 (NIR) of Landsat 7 ETM+

A quick manual control calculation reveals that (B4-B3)/(B4+B3) = 0.4603175 (rounded).

Lastly we can compare the maximum data values of both calculated rasters in the layer Metadata. Here we see a discrepancy between the layers though. The first image shows the Raster calc values, the second shows the Vegetation index values.

Raster calc metadata

NDVI metadata


It turns out that the discrepancy in values stems from problems with NoData and the image edges. In my test setup the outermost 3 rows of pixels were indeed different between the two rasters. Clipping them to the area of interest removed the distortion in values and both displayed identical Min/Max in the metadata.

  • Thank you very much for your time, help and explanation @Phil G . You are totally right about the raster rendering definition but still the statistics discrepancy of the layers took my interest. Due to slc-off problem I've used "fill nodata" for B3 and B4. As a result the edge of the image frame become distorted, so the edges of the NDVI image too. I cropped both the NDVI results. When I checked the statistics I saw that every feature has the same value for both of the cropped versions. I believe, this means that distorted area is the reason of this discrepancy.
    – Ayda Aktas
    Nov 11, 2016 at 13:26
  • I agree, a difference of both layers showed the edges to have different values.
    – Phil G
    Nov 11, 2016 at 13:36

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.