Announcement: On November 13, 2024, all users will need to use a Cloud project in order to access Earth Engine. After this date, continued individual access without a Cloud project will require an exception.
Stay organized with collections
Save and categorize content based on your preferences.
Computes the normalized difference between two bands. If the bands to use are not specified, uses the first two bands. The normalized difference is computed as (first − second) / (first + second). Note that the returned image band name is 'nd', the input image properties are not retained in the output image, and a negative pixel value in either input band will cause the output pixel to be masked. To avoid masking negative input values, use ee.Image.expression() to compute normalized difference.
Usage
Returns
Image.normalizedDifference(bandNames)
Image
Argument
Type
Details
this: input
Image
The input image.
bandNames
List, default: null
A list of names specifying the bands to use. If not specified, the first and second bands are used.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["Computes the normalized difference between two specified or default bands of an image using the formula (first − second) / (first + second)."],["Returns an image with the normalized difference, named 'nd', without retaining original image properties."],["Negative pixel values in either input band result in the output pixel being masked; for alternative handling, consider `ee.Image.expression()`."],["Commonly used for calculating vegetation indices like NDVI, as demonstrated with a Landsat 8 example."]]],[]]