Examples for 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.ayJzdWIiOiI0MmYwODZjCy1kMzI3LTRlOTMtYWMxNS00ODAwOGFiZjI0YjIiLCJhdWQiOiJlY2I1MGM1Zi1iMWM1LTQ3ZTgtYWE4NC0zZTU4NzJlM2I2MTEiLCJqdGkiOiI5MzYxMWE4ODEyNTM4Y2M0MmU0NDJjYjUyMTY0YmJlNyIsImV4cCI6MTU1NTQyMzk3MiwibmFtZSI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLCJlbWFpbCI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLCJzaWQiOiIzZjVjZDVkNS04MjRiLTQ3ZjYtODgwNy0wNDMyNWY4ODQxZmQifQ.U7FPOy_2jlEOFxXSjyN5KEdBROna3-Dyec0feShIbUOY1p9lEXdNaMmR5euiINi2RXDayX9Kr47CuSTsvq1zHFvZs1YgkFr1iH6kDuX-t_-wfWpqu5oPjoPVKZ4Rj0Ms_dxAUTQFTXR0rlbLuO-KSgnaeLVb5iiv_qY3Ctq2XKdIRcFRQLFziFcP4yZJl-NZMlwzsiiwjakcpYpI5jSYAdU2hpZLHRzceseeZt5YfZOe5Px1kZXro9Nd0L2GPC-qzOXw_V1saMGFa2ov8qV6Dvk92iv2SDDdGhOdII_JOf8XkK4E3g2z0EEFdWhG9F4Iky4ukNsqBPgE8LRb31s0hg
A Postman collection with the examples can be downloaded here. Our Postman collections are deprecated and are not being updated since July 2022.
When your 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 906b545b-4305-4968-b245-2abcb0609bc1
used in the examples in "type": "byoc-906b545b-4305-4968-b245-2abcb0609bc1"
. You will also need to adjust the values of bounds and timeRange parameters, so that they correspond to your data.
Unless specified otherwise, the PSScene
itemType with an 8-band productBundle was used in the examples below.
True Color
The following example of PlanetScope 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": {"properties": {"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"},"bbox": [562218,5174019,564201,5172501]},"data": [{"type": "byoc-906b545b-4305-4968-b245-2abcb0609bc1","dataFilter": {"timeRange": {"from": "2021-08-20T00:00:00Z","to": "2021-08-20T23:59:59Z"}}}]},"output": {"width": 512,"height": 512}}' \-F 'evalscript=//VERSION=3function setup() {return {input: [{"bands": ["blue", "green", "red"]}],output: { bands: 3}}}function evaluatePixel(sample) {return [2.5 * sample.red / 10000,2.5 * sample.green / 10000,2.5 * sample.blue / 10000]}'
True Color, full 3 meter resolution
The following example of PlanetScope data returns a true color image in full 3 meter resolution. 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": {"properties": {"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"},"bbox": [562218,5174019,564201,5172501]},"data": [{"type": "byoc-906b545b-4305-4968-b245-2abcb0609bc1","dataFilter": {"timeRange": {"from": "2021-08-20T00:00:00Z","to": "2021-08-20T23:59:59Z"}}}]},"output": {"resx": 3,"resy": 3}}' \-F 'evalscript=//VERSION=3function setup() {return {input: [{"bands": ["blue", "green", "red"]}],output: { bands: 3}}}function evaluatePixel(sample) {return [2.5 * sample.red / 10000,2.5 * sample.green / 10000,2.5 * sample.blue / 10000]}'
NDVI visualized using valueInterpolate function
The following example of PlanetScope 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": {"properties": {"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"},"bbox": [562218,5174019,564201,5172501]},"data": [{"type": "byoc-906b545b-4305-4968-b245-2abcb0609bc1","dataFilter": {"timeRange": {"from": "2021-08-20T00:00:00Z","to": "2021-08-20T23:59:59Z"}}}]},"output": {"width": 512,"height": 512,"responses": [{"identifier": "default","format": {"type": "image/png"}}]}}' \-F 'evalscript=//VERSION=3function 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],])}'
False Color, exact band values using a floating point GeoTIFF
In this example we returned a false color composite with NIR, red and green bands in a TIFF format. We have specified sampleType
to be FLOAT32
, which will return reflectance values, that we prepared by dividing the bands by 10000.
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/32633"},"bbox": [562218,5174019,564201,5172501]},"data": [{"type": "byoc-906b545b-4305-4968-b245-2abcb0609bc1","dataFilter": {"timeRange": {"from": "2021-08-20T00:00:00Z","to": "2021-08-20T23:59:59Z"}}}]},"output": {"width": 512,"height": 512,"responses": [{"identifier": "default","format": {"type": "image/tiff"}}]}}' \-F 'evalscript=//VERSION=3function setup() {return {input: [{bands: ["nir", "red", "green"]}],output: {bands: 3,sampleType: "FLOAT32"}}}function evaluatePixel(sample) {return [sample.nir / 10000,sample.red / 10000,sample.green / 10000]}'
False Color, 4 band bundle
To access data acquired in 2017, we ordered a 4 band bundle (analytic_udm2
or analytic_sr_udm2
), as 8-band bundles are not available for older dates. Note that we had to ingest 4-band data into a different collection, as different bundles are not compatible. The evalscript is the same for both bundles. The following example of PlanetScope data returns a false 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": {"properties": {"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"},"bbox": [562218,5174019,564201,5172501]},"data": [{"type": "byoc-f85cae37-0b95-4817-9b46-bd4138ca3038","dataFilter": {"timeRange": {"from": "2017-04-21T00:00:00Z","to": "2017-04-21T23:59:59Z"}}}]},"output": {"width": 512,"height": 512,"responses": [{"identifier": "default","format": {"type": "image/png"}}]}}' \-F 'evalscript=//VERSION=3function setup() {return {input: ["nir", "red", "green", "dataMask"],output: { bands: 4}}}function evaluatePixel(sample) {return [2.5 * sample.nir / 10000,2.5 * sample.red / 10000,2.5 * sample.green / 10000,sample.dataMask]}'
8-band bundle, exact band values using a floating point GeoTIFF
In this example, we returned all 8 bands in a TIFF format. We have specified sampleType
to be UINT16
, which will return reflectance values.
curl -X POST https://services.sentinel-hub.com/api/v1/process \-H 'Authorization: Bearer <your access token>' \-F 'request={"input": {"bounds": {"bbox": [562218,5174019,564201,5172501],"properties": {"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"}},"data": [{"dataFilter": {"timeRange": {"from": "2021-08-20T00:00:00Z","to": "2021-08-20T23:59:59Z"}},"type": "byoc-906b545b-4305-4968-b245-2abcb0609bc1"}]},"output": {"width": 512,"height": 398.477,"responses": [{"identifier": "default","format": {"type": "image/tiff"}}]}}' \-F 'evalscript=//VERSION=3function setup() {return {input: [{"bands": ["coastal_blue", "blue", "green_i", "green", "yellow", "red", "rededge", "nir"]}],output: { bands: 8,sampleType: SampleType.UINT16 //floating point values are automatically rounded to the nearest integer by the service.}}}function evaluatePixel(sample) {return [sample.coastal_blue, sample.blue, sample.green_i, sample.green, sample.yellow, sample.red, sample.rededge, sample.nir]}'