Landsat 8-9 L1 & L2 Examples
The following examples are CURL requests and can be run from the command line or terminal. In addition, you can copy and paste these examples into Request Builder. You can translate the requests into other programming languages in the Request Builder app.
To request data using any of the request below, you will need to replace the string <your access token> with your access token. Your 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
- L1
- L2
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l1",
"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: ["B02", "B03", "B04"],
output: {
bands: 3,
sampleType: "AUTO" // default value - scales the output values from [0,1] to [0,255].
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l2",
"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: ["B02", "B03", "B04"],
output: {
bands: 3,
sampleType: "AUTO" // default value - scales the output values from [0,1] to [0,255].
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
True Color Pansharpened
- L1
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l1",
"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/png"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: [
"B02",
"B03",
"B04",
"B08",
"dataMask"
]
}],
output: {
bands: 4
}
}
}
let minVal = 0.0
let maxVal = 0.4
let viz = new HighlightCompressVisualizer(minVal, maxVal)
function evaluatePixel(samples) {
let sudoPanW = (samples.B04 + samples.B03 + samples.B02 * 0.4) / 2.4
let ratioW = samples.B08 / sudoPanW
let val = [samples.B04 * ratioW, samples.B03 * ratioW, samples.B02 * ratioW]
val = viz.processList(val)
val.push(samples.dataMask)
return val
}
'
True Color, resolution (EPSG 32633)
- L1
- L2
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"
},
"bbox": [
408553.58,
5078145.48,
466081.02,
5126576.61
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"resx": 100,
"resy": 100
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"
},
"bbox": [
408553.58,
5078145.48,
466081.02,
5126576.61
]
},
"data": [{
"type": "landsat-ot-l2",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"resx": 100,
"resy": 100
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
True Color, multi-band GeoTIff
- L1
- L2
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l1",
"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: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l2",
"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: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
True Color, mosaicking with leastRecent
- L1
- L2
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
},
"mosaickingOrder": "leastRecent"
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/png"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l2",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
},
"mosaickingOrder": "leastRecent"
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/png"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'
True color and metadata (multi-part response GeoTIFF and json)
- L1
- L2
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l1",
"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"
}
},
{
"identifier": "userdata",
"format": {
"type": "application/json"
}
}
]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
mosaicking: Mosaicking.ORBIT,
output: {
id: "default",
bands: 3
}
}
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
outputMetadata.userData = {
"scenes": scenes.orbits
}
}
function evaluatePixel(samples) {
return [2.5 * samples[0].B04, 2.5 * samples[0].B03, 2.5 * samples[0].B02]
}
'
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l2",
"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"
}
},
{
"identifier": "userdata",
"format": {
"type": "application/json"
}
}
]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
mosaicking: Mosaicking.ORBIT,
output: {
id: "default",
bands: 3
}
}
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
outputMetadata.userData = {
"scenes": scenes.orbits
}
}
function evaluatePixel(samples) {
return [2.5 * samples[0].B04, 2.5 * samples[0].B03, 2.5 * samples[0].B02]
}
'
True color multi-part response (different formats and SampleType)
- L1
- L2
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l1",
"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: ["B04", "B03", "B02"],
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.B04, 2.5 * sample.B03, 2.5 * sample.B02],
// Multiply input reflectance values by 255 to stretch them to [0, 255] unsigned 8 bit range.
true_color_8bit: [sample.B04 * 255, sample.B03 * 255, sample.B02 * 255],
// Multiply input reflectance values by 65535 to stretch them to [0, 65535] unsigned 16 bit range.
true_color_16bit: [sample.B04 * 65535, sample.B03 * 65535, sample.B02 * 65535],
// Reflectance values
true_color_32float: [sample.B04, sample.B03, sample.B02],
}
}
'
curl -X POST \
https://services-uswest2.sentinel-hub.com/process/v1 \
-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": "landsat-ot-l2",
"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: ["B04", "B03", "B02"],
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.B04, 2.5 * sample.B03, 2.5 * sample.B02],
// Multiply input reflectance values by 255 to stretch them to [0, 255] unsigned 8 bit range.
true_color_8bit: [sample.B04 * 255, sample.B03 * 255, sample.B02 * 255],
// Multiply input reflectance values by 65535 to stretch them to [0, 65535] unsigned 16 bit range.
true_color_16bit: [sample.B04 * 65535, sample.B03 * 65535, sample.B02 * 65535],
// Reflectance values
true_color_32float: [sample.B04, sample.B03, sample.B02],
}
}
'