Examples for WorldView

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

A Postman collection with the examples can be downloaded here.

When your WorldView 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 991fe3be-4d19-4d9f-9941-879da0a5c3b3 used in the examples in "type": "byoc-991fe3be-4d19-4d9f-9941-879da0a5c3b3". 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 WorldView data returns a true color image. The bands are divided by 10000 to bring the 16-bit digital numbers to reflectance values and multiplied by 2.5 to increase the brightness.

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"bbox": [
562075.048824,
5172287.222975,
564138.069929,
5174306.794425
],
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"
}
},
"data": [
{
"type": "byoc-991fe3be-4d19-4d9f-9941-879da0a5c3b3",
"dataFilter": {
"timeRange": {
"from": "2020-11-06T00:00:00.0Z",
"to": "2020-11-06T23:59:59.9Z"
}
}
}
]
},
"output": {
"width": 512,
"height": 512
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
"bands": ["Red", "Green", "Blue", "dataMask"]
}],
output: {
bands: 4
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.Red / 10000,
2.5 * sample.Green / 10000,
2.5 * sample.Blue / 10000,
sample.dataMask
]
}'

True color, pan-sharpened

Pan-sharpening is a technique which combines a high-resolution panchromatic band with multispectral bands to obtain a colorful high-resolution image. Different algorithms exist and some can be translated into Sentinel Hub evalscript. The script below gives a good true color visualization for WorldView data.

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"bbox": [
562075.048824,
5172287.222975,
564138.069929,
5174306.794425
],
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"
}
},
"data": [
{
"type": "byoc-991fe3be-4d19-4d9f-9941-879da0a5c3b3",
"dataFilter": {
"timeRange": {
"from": "2020-11-06T00:00:00.0Z",
"to": "2020-11-06T23:59:59.9Z"
}
}
}
]
},
"output": {
"width": 512,
"height": 512
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
"bands": ["Red", "Green", "Blue", "NearIR1", "PAN", "dataMask"]
}],
output: {
bands: 4
}
}
}
function evaluatePixel(samples) {
let sudoPanW = (samples.Red + samples.Green + samples.Blue + samples.NearIR1 ) / 4
let ratioW = samples.PAN / sudoPanW / 10000 * 2.5
let val = [samples.Red * ratioW,
samples.Green * ratioW,
samples.Blue * ratioW,
samples.dataMask]
return val
}'

NDVI visualized using valueInterpolate function

The following example of WorldView data returns a visualized NDVI image, using red and NIR bands.

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"bbox": [
562075.048824,
5172287.222975,
564138.069929,
5174306.794425
],
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"
}
},
"data": [
{
"type": "byoc-991fe3be-4d19-4d9f-9941-879da0a5c3b3",
"dataFilter": {
"timeRange": {
"from": "2020-11-06T00:00:00.0Z",
"to": "2020-11-06T23:59:59.9Z"
}
}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/jpeg"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["Red", "NearIR1", "dataMask"],
output: {
bands: 4
}
}
}
function evaluatePixel(sample) {
let ndvi = (sample.NearIR1 - sample.Red) / (sample.NearIR1 + 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],
])
}'

Reflectance values for all bands and dataMask, output as a floating point GeoTIFF

In this example we return reflectance values for all available bands in a TIFF format. We have specified sampleType to be FLOAT32 and the reflectance values are prepared by dividing bands' digital numbers by 10000.

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"bbox": [
562075.048824,
5172287.222975,
564138.069929,
5174306.794425
],
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"
}
},
"data": [
{
"type": "byoc-991fe3be-4d19-4d9f-9941-879da0a5c3b3",
"dataFilter": {
"timeRange": {
"from": "2020-11-06T00:00:00.0Z",
"to": "2020-11-06T23:59:59.9Z"
}
}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["Red", "Green", "Blue", "NearIR1", "PAN", "dataMask"],
output: {
bands: 6,
sampleType: "FLOAT32"
}
}
}
function evaluatePixel(sample) {
return [sample.Red / 10000,
sample.Green / 10000,
sample.Blue / 10000,
sample.NearIR1 / 10000,
sample.PAN / 10000,
sample.dataMask
]
}'