As shown in the below posted èvalscript
, and referring to the official documentation as shown here:
Given that, the mosaicking type is TILE
, and satellite being used is sentinelhub-2-L2A
, i am not able to query all the properties of both of the objects scenes
and scenes.tiles
.
For scenes
, i want to query the DataFrom
as well as DataTo
, but such properties return null
For scenes.tiles
, the following information:
dataGeometry (geojson - like object, see example) - an optional property, added only when requested. Represents a geometry of data coverage within the tile.
dataEnvelope (geojson - like object, see example) - an optional property, added only when requested. Represents a bbox of dataGeometry.
return null
please let me know why i am not able to query all the properties of both of the objects scenes
and scenes.tiles
as mentioned in the aforementioned link to the documentation?
`//VERSION=3
// Script to extract a time series of NDVI values using
// Sentinel 2 Level 2A data and metadata file.
function setup() {
return {
input: [{
bands: ["B04", "B08", "CLD"],
units: "DN",
dataGeometry: true,
}],
output: [
{
id: "default",
bands: 6,
sampleType: "FLOAT32",
nodataValue: NaN,
},
{
id: "averages",
bands: 1,
sampleType: "FLOAT32",
nodataValue: NaN,
},
{
id: "medians",
bands: 1,
sampleType: "FLOAT32",
nodataValue: NaN,
},
{
id: "numOfCloudFreeSamples",
bands: 1,
sampleType: "FLOAT32",
nodataValue: NaN,
},
{
id: "numOfCloudySamples",
bands: 1,
sampleType: "FLOAT32",
nodataValue: NaN,
},
{
id: "percentageOfCloudFree",
bands: 1,
sampleType: "FLOAT32",
nodataValue: NaN,
},
{
id: "percentageOfCloudy",
bands: 1,
sampleType: "FLOAT32",
nodataValue: NaN,
},
],
mosaicking: Mosaicking.${mosaickingType}
}
}
.....
.....
.....
.....
function evaluatePixel(samples) {
if (samples.length < 1) {
return {
default: [NaN, NaN, NaN, NaN, NaN, NaN],
averages: [NaN],
medians: [NaN],
numOfCloudFreeSamples: [NaN],
numOfCloudySamples: [NaN],
percentageOfCloudFree: [NaN],
percentageOfCloudy: [NaN],
};
}
const parsedSamples = samplesParser(samples);
const ndvis = calcNDVIForSamples(parsedSamples[1]);
const averages = calcAverage(ndvis);
const medians = calcMedian(ndvis);
const numOfCloudySamples = parsedSamples[0].length;
const numOfCloudFreeSamples = parsedSamples[1].length;
if(numOfCloudFreeSamples === 0) {
return {
default: [NaN, NaN, NaN, NaN, NaN, NaN],
averages: [NaN],
medians: [NaN],
numOfCloudFreeSamples: [NaN],
numOfCloudySamples: [NaN],
percentageOfCloudFree: [NaN],
percentageOfCloudy: [NaN],
};
}
const totalNumOfSamples = numOfCloudySamples + numOfCloudFreeSamples;
const percentageOfCloudy = calcPercentage(totalNumOfSamples, numOfCloudySamples);
const percentageOfCloudFree = calcPercentage(totalNumOfSamples, numOfCloudFreeSamples);
return {
default: [averages, medians, numOfCloudFreeSamples, numOfCloudySamples, percentageOfCloudFree, percentageOfCloudy],
averages: [averages],
medians: [medians],
numOfCloudFreeSamples: [numOfCloudFreeSamples],
numOfCloudySamples: [numOfCloudySamples],
percentageOfCloudFree: [percentageOfCloudFree],
percentageOfCloudy: [percentageOfCloudy],
};
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
if (scenes) {
if (scenes.tiles) {
if (scenes.tiles.length > 0) {
let tilesMetadata = [];
let dataGeoms = []
for (let i = 0; i < scenes.tiles.length; i++) {
dataGeoms.push(scenes.tiles[i].dataGeometry);
}
tilesMetadata.push({tiles: scenes.tiles});
tilesMetadata.push({dataGeoms: dataGeoms})
outputMetadata.userData = { metadata: JSON.stringify(tilesMetadata) };
} else {
outputMetadata.userData = { metadata: "No tiles data available." };
}
} else {
outputMetadata.userData = { metadata: "No tiles available." };
}
} else {
outputMetadata.userData = { metadata: "No scenes are available." };
}
}`