Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
Stay organized with collections
Save and categorize content based on your preferences.
Computes the per-pixel spectral distance between two images. If the images are array based then only the first band of each image is used; otherwise all bands are involved in the distance computation. The two images are therefore expected to contain the same number of bands or have the same 1-dimensional array length.
Usage
Returns
Image.spectralDistance(image2, metric)
Image
Argument
Type
Details
this: image1
Image
The first image.
image2
Image
The second image.
metric
String, default: "sam"
The spectral distance metric to use. One of 'sam' (spectral angle mapper), 'sid' (spectral information divergence), 'sed' (squared Euclidean distance), or 'emd' (earth movers distance).
[[["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 2024-07-13 UTC."],[[["Computes the spectral distance between two images on a per-pixel basis, considering either a single band or all bands depending on image type."],["Images must have the same number of bands or be 1-dimensional arrays of the same length."],["Offers various spectral distance metrics including SAM, SID, SED, and EMD, with SAM as the default."],["Returns a new image representing the calculated spectral distances."],["Accessible through the `spectralDistance()` method applied to the first image, taking the second image and an optional metric as arguments."]]],[]]