Examples for DEM

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.

A Postman collection with examples can be downloaded here.

DEM image (png)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
13.822174072265625,
45.85080395917834,
14.55963134765625,
46.29191774991382
]
},
"data": [
{
"type": "dem"
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/png"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output: { bands: 1 }
}
}
function evaluatePixel(sample) {
return [sample.DEM/1000]
}'

Copernicus DEM (png)

curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
13.822174072265625,
45.85080395917834,
14.55963134765625,
46.29191774991382
]
},
"data": [
{
"type": "dem",
"dataFilter": {
"demInstance": "COPERNICUS_90"
}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/png"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output: { bands: 1 }
}
}
function evaluatePixel(sample) {
return [sample.DEM/1000]
}'

DEM values, orthometric heights (tif)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
13.822174072265625,
45.85080395917834,
14.55963134765625,
46.29191774991382
]
},
"data": [
{
"type": "dem"
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output:{
id: "default",
bands: 1,
sampleType: SampleType.FLOAT32
}
}
}
function evaluatePixel(sample) {
return [sample.DEM]
}'

DEM values, ellipsoidal heights

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
13.822174072265625,
45.85080395917834,
14.55963134765625,
46.29191774991382
]
},
"data": [
{
"type": "dem",
"processing":{"egm":true}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output:{
id: "default",
bands: 1,
sampleType: SampleType.FLOAT32
}
}
}
function evaluatePixel(sample) {
return [sample.DEM]
}'

DEM image at sea level (png)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
10.082016,42.625876,10.496063,42.927268
]
},
"data": [
{
"type": "dem"
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/png"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output: { bands: 3 }
}
}
function evaluatePixel(sample) {
if (sample.DEM > 0) {
return [0, sample.DEM / 1000, 0]
} else {
return [0, 0, -sample.DEM / 100]
}
}'

DEM image at sea level, clampNegatives (png)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
10.082016,42.625876,10.496063,42.927268
]
},
"data": [
{
"type": "dem",
"processing":{"clampNegative":true}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/png"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output: { bands: 3 }
}
}
function evaluatePixel(sample) {
if (sample.DEM > 0) {
return [0, sample.DEM / 1000, 0]
} else {
return [0, 0, -sample.DEM / 100]
}
}'

DEM values at sea level, orthometric heights, clampNegatives (tif)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
10.082016,42.625876,10.496063,42.927268
]
},
"data": [
{
"type": "dem",
"processing":{"egm":false, "clampNegative":true}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output:{
id: "default",
bands: 1,
sampleType: SampleType.FLOAT32
}
}
}
function evaluatePixel(sample) {
return [sample.DEM ]
}'

DEM values at sea level, orthometric heights including negative values (tif)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'content-type: multipart/form-data' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
10.082016,42.625876,10.496063,42.927268
]
},
"data": [
{
"type": "dem",
"processing":{"clampNegative":false}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
}
}' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["DEM"],
output:{
id: "default",
bands: 1,
sampleType: SampleType.FLOAT32
}
}
}
function evaluatePixel(sample) {
return [sample.DEM]
}'