Unable to query all props of scenes.tiles for sentinel-2-l2a

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." };
	}
  }`

Hi,

Can you please provide a simpler example, I cannot get this evalscript to work within a Processing API request. Something replicable will make it far easier to solve your bug.

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?

req:

{
  "input": {
	"bounds": {
	  "bbox": [
		12.44693,
		41.870072,
		12.541001,
		41.917096
	  ]
	},
	"data": [
	  {
		"dataFilter": {
		  "timeRange": {
			"from": "2024-10-27T00:00:00Z",
			"to": "2024-11-27T23:59:59Z"
		  }
		},
		"type": "sentinel-2-l2a"
	  }
	]
  },
  "output": {
	"width": 512,
	"height": 343.697,
	"responses": [
	  {
		"identifier": "userdata",
		"format": {
		  "type": "application/json"
		}
	  }
	]
  },
  "evalscript": "//VERSION=3\n\nfunction setup() {\n  return {\n    input: [\"B02\", \"B03\", \"B04\"],\n    output: { bands: 3 }\n  };\n}\n\nfunction evaluatePixel(sample) {\n  return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02];\n}\n\nfunction updateOutputMetadata(scenes, inputMetadata, outputMetadata) {\n    if (scenes) {\n      if (scenes.tiles) {\n        if (scenes.tiles.length > 0) {\n\n          let tilesMetadata = [];\n          let dataGeoms = []\n          for (let i = 0; i < scenes.tiles.length; i++) {\n            dataGeoms.push(scenes.tiles[i].dataGeometry);\n          }\n          tilesMetadata.push({tiles: scenes.tiles});\n          tilesMetadata.push({dataGeoms: dataGeoms})\n          \n          outputMetadata.userData = { metadata: JSON.stringify(tilesMetadata) };\n\n        } else {\n          outputMetadata.userData = { metadata: \"No tiles data available.\" };\n        }\n      } else {\n        outputMetadata.userData = { metadata: \"No tiles available.\" };\n      }\n    } else {\n      outputMetadata.userData = { metadata: \"No scenes are available.\" };\n    }\n  }"
} 

eval-script:
//VERSION=3

function setup() {
  return {
	input: ["B02", "B03", "B04"],
	output: { bands: 3 },
            mosaicking: Mosaicking.TILE,
  };
}

function evaluatePixel(sample) {
  return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02];
}

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." };
	}
  }

output metadata:

{"metadata":"[{\"tiles\":[{\"shId\":28  615888,\"cloudCoverage\":78.28,\"date\":\"2024-04-02T10:16:56Z\",\"tileOriginalId\":\"S2B_OPER_MSI_L2A_TL_2BPS_20240402T125254_A036942_T32UQA_N05.10\",\"dataPath\":\"s3://sentinel-s2-l2a/tiles/32/U/QA/2024/4/2/0\",\"productId\":\"S2B_MSIL2A_20240402T100549_N0510_R022_T32UQA_20240402T125254\",\"__idx\":0},{\"shId\":28616335,\"cloudCoverage\":64.59,\"date\":\"2024-04-02T10:16:54Z\",\"tileOriginalId\":\"S2B_OPER_MSI_L2A_TL_2BPS_20240402T125254_A036942_T33UUR_N05.10\",\"dataPath\":\"s3://sentinel-s2-l2a/tiles/33/U/UR/2024/4/2/0\",\"productId\":\"S2B_MSIL2A_20240402T100549_N0510_R022_T33UUR_20240402T125254\",\"__idx\":1}]},{\"dataGeoms\":[null,null]}]"}

Hi,

You did not add TILE Mosaicking to your evalscript, the default is SIMPLE so you naturally only return one scene. Please use the following if you wish to use TILE mosaicking:

function setup() {
  return {
	input: ["B02", "B03", "B04"],
	output: { bands: 3 },
  mosaicking: Mosaicking.TILE
  };
}

function evaluatePixel(sample) {
  return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02];
}

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) };
    }
    }
  }
}

i modified the evalscript to include the type of mosaicking.
but still i receive null for dataGeom

Hi,

Having looked a bit deeper into this, unfortunately, this metadata is no longer available in the scenes object. We are currently reviewing our documentation around custom scripts and will make sure that this section is updated accordingly.

ok. so it will not be available for certain time, but later it might be available, am i right?