Get true color PNG image with All S2L2A raw bands

I am getting white PNG image in the multi-part response.

If I changed the units to REFLECTANCE (default) in the evalscript setup() I get correct True Image PNG but but the returned GeoTIFF is black.

How can I get in one request the three files correctly.

This is the full request curl:

curl --location 'https://services.sentinel-hub.com/api/v1/process' \
--header 'Accept: application/tar' \
--header 'Authorization: Bearer <access_token>' \
--form 'request="{
\"input\": {
        \"bounds\": {
\"properties\": {
                \"crs\": \"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"
            },
            \"bbox\":[
  39.193357,
  21.493884,
  39.236285,
  21.532452
]
        },
        \"data\": [
            {
                \"type\": \"sentinel-2-l2a\",
                \"dataFilter\": {
                    \"timeRange\": {
                        \"from\": \"2024-01-01T08:04:08Z\",
                        \"to\": \"2024-01-01T08:04:08Z\"
                    }
                }
            }
        ]
    },
    \"output\": {
        \"width\": 512,
        \"height\": 512,
\"responses\": [
            {
                \"identifier\": \"True_Color\",
                \"format\": {
                    \"type\": \"image/png\"
                }
            },
            {
                \"identifier\": \"userdata\",
                \"format\": {
                    \"type\": \"application/json\"
                }
            },
           {
                \"identifier\": \"GeoTIFF\",
                \"format\": {
                    \"type\": \"image/tiff\"
                }
            }
        ]
    }
}"' \
--form 'evalscript="//VERSION=3
function setup() {
  return {
    input: [{
      bands: [\"B01\", \"B02\", \"B03\", \"B04\", \"B05\", \"B06\", \"B07\", \"B08\", \"B8A\", \"B09\", \"B11\", \"B12\"],
	  units: \"DN\"
    }],
    mosaicking: Mosaicking.ORBIT,
    output: [
	{
      id: \"True_Color\",
      bands: 3,
      sampleType: \"AUTO\" // default  - scales the output values from input values [0,1] to [0,255].
	},
	{
      id: \"GeoTIFF\",
      bands: 12,
      sampleType: SampleType.UINT16
    }
   ]
  }
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
   outputMetadata.userData = { \"scenes\":  scenes.orbits }
}
function evaluatePixel(samples) {
  return {
		//  output band values are scaled from [0,1] to [0,255]. Multiply by 2.5 to increase brightness
		//True_Color: [2.5*sample.B04, 2.5*sample.B03,  2.5*sample.B02],
        True_Color: [ 2.5 * samples[0].B04, 2.5 * samples[0].B03, 2.5 * samples[0].B02 ],
		GeoTIFF: [ samples[0].B01, samples[0].B02, samples[0].B03, samples[0].B04, samples[0].B05, samples[0].B06, samples[0].B07, samples[0].B08, samples[0].B8A, samples[0].B09, samples[0].B11, samples[0].B12]
   }
}"'

Hi,

This example in the docs should help you out in writing your multi-response request:

Thanks @william.ray for your reply.

I’ve checked the examples already but there is no example for getting multi-part response for all raw bands GeoTIFF and true color PNG together.

You should be able to combine the existing examples to create what you need. You just need to add additional bands to the GeoTIFF output as well as adding those additional bands to your inputs in the setup() function of the evalscript.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.