Examples for Harmonized Landsat Sentinel Collection

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 will look something like this:

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

and can be obtained as described in the Authentication chapter.

True Color

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["Blue", "Green", "Red"],
output: {
bands: 3,
sampleType: "AUTO" // default value - scales the output values from [0,1] to [0,255].
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.Red, 2.5 * sample.Green, 2.5 * sample.Blue]
}
'

True Color, full 30 meter resolution (EPSG 32633)

curl -X POST \
https://services-uswest2.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/32633"
},
"bbox": [
284281.024812,
4637026.521832,
301547.842435,
4652124.141629
]
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"resx": 30,
"resy": 30
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["Red", "Green", "Blue", "dataMask"],
output: {
bands: 4
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.Red, 2.5 * sample.Green, 2.5 * sample.Blue, sample.dataMask]
}
'

NDVI as jpeg image with bounds given as polygon

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
12.480661,
41.965872
],
[
12.523909,
41.96817
],
[
12.553084,
41.931401
],
[
12.525968,
41.906365
],
[
12.491645,
41.894355
],
[
12.449084,
41.896911
],
[
12.433295,
41.926292
],
[
12.442219,
41.950043
],
[
12.480661,
41.965872
]
]
]
}
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/jpeg" }
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["NIR_Narrow", "Red", "dataMask"],
output: { bands: 4 }
}
}
function evaluatePixel(sample) {
var ndvi = (sample.NIR_Narrow - sample.Red) / (sample.NIR_Narrow + sample.Red)
if (ndvi<-0.5) return [0.05,0.05,0.05,sample.dataMask]
else if (ndvi<-0.2) return [0.75,0.75,0.75,sample.dataMask]
else if (ndvi<-0.1) return [0.86,0.86,0.86,sample.dataMask]
else if (ndvi<0) return [0.92,0.92,0.92,sample.dataMask]
else if (ndvi<0.025) return [1,0.98,0.8,sample.dataMask]
else if (ndvi<0.05) return [0.93,0.91,0.71,sample.dataMask]
else if (ndvi<0.075) return [0.87,0.85,0.61,sample.dataMask]
else if (ndvi<0.1) return [0.8,0.78,0.51,sample.dataMask]
else if (ndvi<0.125) return [0.74,0.72,0.42,sample.dataMask]
else if (ndvi<0.15) return [0.69,0.76,0.38,sample.dataMask]
else if (ndvi<0.175) return [0.64,0.8,0.35,sample.dataMask]
else if (ndvi<0.2) return [0.57,0.75,0.32,sample.dataMask]
else if (ndvi<0.25) return [0.5,0.7,0.28,sample.dataMask]
else if (ndvi<0.3) return [0.44,0.64,0.25,sample.dataMask]
else if (ndvi<0.35) return [0.38,0.59,0.21,sample.dataMask]
else if (ndvi<0.4) return [0.31,0.54,0.18,sample.dataMask]
else if (ndvi<0.45) return [0.25,0.49,0.14,sample.dataMask]
else if (ndvi<0.5) return [0.19,0.43,0.11,sample.dataMask]
else if (ndvi<0.55) return [0.13,0.38,0.07,sample.dataMask]
else if (ndvi<0.6) return [0.06,0.33,0.04,sample.dataMask]
else return [0,0.27,0,sample.dataMask]
}'

Exact NDVI values using a floating point GeoTIFF

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
12.480661,
41.965872
],
[
12.523909,
41.96817
],
[
12.553084,
41.931401
],
[
12.525968,
41.906365
],
[
12.491645,
41.894355
],
[
12.449084,
41.896911
],
[
12.433295,
41.926292
],
[
12.442219,
41.950043
],
[
12.480661,
41.965872
]
]
]
}
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return{
input: [{
bands: ["Red", "NIR_Narrow", "dataMask"]
}],
output: {
id: "default",
bands: 2,
sampleType: SampleType.FLOAT32
}
}
}
function evaluatePixel(sample) {
let ndvi = (sample.NIR_Narrow - sample.Red) / (sample.NIR_Narrow + sample.Red)
return [ ndvi, sample.dataMask ]
}'

Landsat Thermal Band as jpeg image with bounds given as bounding box

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
},
"constellation": "LANDSAT"
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/png"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
let minVal = -50
let maxVal = 50
let viz = ColorGradientVisualizer.createBlueRed(minVal, maxVal)
function setup() {
return {
input: [{
bands: [
"ThermalInfrared1",
"dataMask"
]
}],
output: {
bands: 4
}
}
}
function evaluatePixel(samples) {
let val = samples.ThermalInfrared1
val = viz.process(val)
val.push(samples.dataMask)
return val
}
'

Landsat Thermal band Kelvin values using a FLOAT32 GeoTIFF

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
},
"constellation": "LANDSAT"
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: [
"ThermalInfrared1", "dataMask"
]
}],
output: {
bands: 2,
sampleType: "FLOAT32"
}
}
}
function evaluatePixel(samples) {
return [samples.ThermalInfrared1, samples.dataMask]
}
'

Sentinel Red Edge Composite

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2022-07-01T00:00:00Z",
"to": "2022-07-31T00:00:00Z"
},
"constellation": "SENTINEL"
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/png"
}
}]
}
}
' \
-F 'evalscript=
//VERSION=3
function setup() {
return {
input: [{
bands: [
"RedEdge3", "RedEdge2", "RedEdge1", "dataMask"
]
}],
output: {
bands: 4
}
}
}
function evaluatePixel(samples) {
return [3*samples.RedEdge3, 3*samples.RedEdge2, 3*samples.RedEdge1, samples.dataMask]
}
'

Sentinel True color and metadata (multi-part response GeoTIFF and json)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'accept: application/tar' \
-F 'request={
"input": {
"bounds": {
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2022-07-01T00:00:00Z",
"to": "2022-07-31T00:00:00Z"
},
"constellation": "SENTINEL"
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
},
{
"identifier": "userdata",
"format": {
"type": "application/json"
}
}
]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["Blue", "Green", "Red", "dataMask"],
mosaicking: Mosaicking.ORBIT,
output: {
id: "default",
bands: 4
}
}
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
outputMetadata.userData = {
"scenes": scenes.orbits
}
}
function evaluatePixel(samples) {
return [2.5 * samples[0].Red, 2.5 * samples[0].Green, 2.5 * samples[0].Blue, samples.dataMask]
}
'

True color multi-part response (different formats and SampleType)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'Accept: application/tar' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "hls",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "true_color",
"format": {
"type": "image/jpeg"
}
},
{
"identifier": "true_color_8bit",
"format": {
"type": "image/png"
}
},
{
"identifier": "true_color_16bit",
"format": {
"type": "image/tiff"
}
},
{
"identifier": "true_color_32float",
"format": {
"type": "image/tiff"
}
}
]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: ["Red", "Green", "Blue"],
units: "REFLECTANCE" // default units
}],
output: [{
id: "true_color",
bands: 3,
sampleType: "AUTO" // default - scales the output values from input values [0,1] to [0,255].
},
{
id: "true_color_8bit",
bands: 3,
sampleType: "UINT8"
},
{
id: "true_color_16bit",
bands: 3,
sampleType: "UINT16" //floating point values are automatically rounded to the nearest integer by the service.
},
{
id: "true_color_32float",
bands: 3,
sampleType: "FLOAT32"
}
]
}
}
function evaluatePixel(sample) {
return {
// output band values are scaled from [0,1] to [0,255]. Multiply by 2.5 to increase brightness
true_color: [2.5 * sample.Red, 2.5 * sample.Green, 2.5 * sample.Blue],
// Multiply input reflectance values by 255 to stretch them to [0, 255] unsigned 8 bit range.
true_color_8bit: [sample.Red * 255, sample.Green * 255, sample.Blue * 255],
// Multiply input reflectance values by 65535 to stretch them to [0, 65535] unsigned 16 bit range.
true_color_16bit: [sample.Red * 65535, sample.Green * 65535, sample.Blue * 65535],
// Reflectance values
true_color_32float: [sample.Red, sample.Green, sample.Blue],
}
}
'