Examples for Analysis-Ready PlanetScope

To request data using any of the request below, you will need to replace the string <your access token> with your Sentinel Hub access token. Sentinel Hub access token can be obtained as described in the Authentication chapter. It will look something like this:

ayJhbGciOiJSUzI1NiJ9.ayJzdWIiOiI0MmYwODZjCy1kMzI3LTRlOTMtYWMxNS00ODAwOGFiZjI0YjIiLCJhdWQiOiJlY2I1MGM1Zi1i
MWM1LTQ3ZTgtYWE4NC0zZTU4NzJlM2I2MTEiLCJqdGkiOiI5MzYxMWE4ODEyNTM4Y2M0MmU0NDJjYjUyMTY0YmJlNyIsImV4cCI6MTU1N
TQyMzk3MiwibmFtZSI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLCJlbWFpbCI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLC
JzaWQiOiIzZjVjZDVkNS04MjRiLTQ3ZjYtODgwNy0wNDMyNWY4ODQxZmQifQ.U7FPOy_2jlEOFxXSjyN5KEdBROna3-Dyec0feShIbUOY
1p9lEXdNaMmR5euiINi2RXDayX9Kr47CuSTsvq1zHFvZs1YgkFr1iH6kDuX-t_-wfWpqu5oPjoPVKZ4Rj0Ms_dxAUTQFTXR0rlbLuO-KS
gnaeLVb5iiv_qY3Ctq2XKdIRcFRQLFziFcP4yZJl-NZMlwzsiiwjakcpYpI5jSYAdU2hpZLHRzceseeZt5YfZOe5Px1kZXro9Nd0L2GPC
-qzOXw_V1saMGFa2ov8qV6Dvk92iv2SDDdGhOdII_JOf8XkK4E3g2z0EEFdWhG9F4Iky4ukNsqBPgE8LRb31s0hg

When your Analysis-Ready PlanetScope data is imported into Sentinel Hub using our Third Party Data Import API, you will receive the collection ID, with which you need to replace the collection ID 3f605f75-86c4-411a-b4ae-01c896f0e54e used in the examples in "type": "byoc-3f605f75-86c4-411a-b4ae-01c896f0e54e". You will also need to adjust the values of bounds and timeRange parameters, so that they correspond to your data.

True Color

The following example of PlanetScope data returns a true color image in full 3 meter resolution.

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32630"
},
"bbox": [
691648,
4946024,
693663,
4947639
]
},
"data": [
{
"type": "byoc-3f605f75-86c4-411a-b4ae-01c896f0e54e",
"dataFilter": {
"timeRange": {
"from": "2023-04-20T00:00:00Z",
"to": "2023-04-20T23:59:59Z"
}
}
}
]
},
"output": {
"resx": 3,
"resy": 3
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["blue", "green", "red", "dataMask"],
output: {
bands: 4
}
}
}
let factor = 1/2000
function evaluatePixel(sample) {
return [
factor * sample.red,
factor * sample.green,
factor * sample.blue,
sample.dataMask
]
}'

False Color

In this example we return a false color composite with nir, red and green bands in a PNG format.

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32630"
},
"bbox": [
691648,
4946024,
693663,
4947639
]
},
"data": [
{
"type": "byoc-3f605f75-86c4-411a-b4ae-01c896f0e54e",
"dataFilter": {
"timeRange": {
"from": "2023-04-20T00:00:00Z",
"to": "2023-04-20T23:59:59Z"
}
}
}
]
},
"output": {
"resx": 3,
"resy": 3
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["nir", "green", "blue", "dataMask"],
output: { bands: 4 }
}
}
function evaluatePixel(sample) {
return [sample.nir / 3000, sample.green / 3000, sample.blue / 3000, sample.dataMask]
}'

NDVI visualized using valueInterpolate function

In the following example, we calculate normalized differences vegetation index (NDVI) using red and nir bands, then we use built-in valueInterpolate function for visualization of NDVI values.

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32630"
},
"bbox": [
691648,
4946024,
693663,
4947639
]
},
"data": [
{
"type": "byoc-3f605f75-86c4-411a-b4ae-01c896f0e54e",
"dataFilter": {
"timeRange": {
"from": "2023-04-20T00:00:00Z",
"to": "2023-04-20T23:59:59Z"
}
}
}
]
},
"output": {
"resx": 3,
"resy": 3
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["red", "nir", "dataMask"],
output: { bands: 4}
}
}
function evaluatePixel(sample) {
var NDVI = index(sample.nir , sample.red)
return valueInterpolate(NDVI,
[0.0, 0.3, 1.0],
[
[1, 0, 0, sample.dataMask],
[1, 1, 0, sample.dataMask],
[0.1, 0.3, 0, sample.dataMask],
])
}'

Exact band values output as GeoTIFF

In this example, we returned all bands in a GeoTIFF format. We have specified sampleType to be INT16, which will return the values as originally provided by the data provider (note: Negligible differences in comparison to original values are possible due to resampling).

curl -X POST https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32630"
},
"bbox": [
691648,
4946024,
693663,
4947639
]
},
"data": [
{
"type": "byoc-3f605f75-86c4-411a-b4ae-01c896f0e54e",
"dataFilter": {
"timeRange": {
"from": "2023-04-20T00:00:00Z",
"to": "2023-04-20T23:59:59Z"
}
}
}
]
},
"output": {
"resx": 3,
"resy": 3,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{"bands": ["blue", "green", "red", "nir", "cloud_mask","scene_mask"]}],
output: {
bands: 6,
sampleType: SampleType.INT16
}
}
}
function evaluatePixel(sample) {
return [sample.red,
sample.green,
sample.blue,
sample.nir,
sample.cloud_mask,
sample.scene_mask]
}'