Examples for BYOC
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.ayJzdWIiOiI0MmYwODZjCy1kMzI3LTRlOTMtYWMxNS00ODAwOGFiZjI0YjIiLCJhdWQiOiJlY2I1MGM1Zi1iMWM1LTQ3ZTgtYWE4NC0zZTU4NzJlM2I2MTEiLCJqdGkiOiI5MzYxMWE4ODEyNTM4Y2M0MmU0NDJjYjUyMTY0YmJlNyIsImV4cCI6MTU1NTQyMzk3MiwibmFtZSI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLCJlbWFpbCI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLCJzaWQiOiIzZjVjZDVkNS04MjRiLTQ3ZjYtODgwNy0wNDMyNWY4ODQxZmQifQ.U7FPOy_2jlEOFxXSjyN5KEdBROna3-Dyec0feShIbUOY1p9lEXdNaMmR5euiINi2RXDayX9Kr47CuSTsvq1zHFvZs1YgkFr1iH6kDuX-t_-wfWpqu5oPjoPVKZ4Rj0Ms_dxAUTQFTXR0rlbLuO-KSgnaeLVb5iiv_qY3Ctq2XKdIRcFRQLFziFcP4yZJl-NZMlwzsiiwjakcpYpI5jSYAdU2hpZLHRzceseeZt5YfZOe5Px1kZXro9Nd0L2GPC-qzOXw_V1saMGFa2ov8qV6Dvk92iv2SDDdGhOdII_JOf8XkK4E3g2z0EEFdWhG9F4Iky4ukNsqBPgE8LRb31s0hg
and can be obtained as described in the Authentication chapter.
Check collection bands in catalog
This example uses the publicly available Analysis-Ready PlanetScope Sandbox Data collection.
To use your own collection, replace the ID used in the URL with byoc-<your-collection-id>.
curl -X GET https://services.sentinel-hub.com/api/v1/catalog/1.0.0/collections/byoc-3f605f75-86c4-411a-b4ae-01c896f0e54e \--header 'Authorization: Bearer <your access token>'
Bands can be found in the returned json object under summaries.eo:bands. An example of the returned summaries object that can be found in the above request's response:
{"summaries": {"eo:bands": [{"name": "blue"},{"name": "cloud_mask"},{"name": "green"},{"name": "nir"},{"name": "red"},{"name": "scene_mask"}],"raster:bands": [{"data_type": "int16","nodata": 0},{"data_type": "int16","nodata": -999},{"data_type": "int16","nodata": 0},{"data_type": "int16","nodata": 0},{"data_type": "int16","nodata": 0},{"data_type": "int16","nodata": -999}]}}
Create a True Color image from the gathered bands
As mentioned above, this example uses an Analysis-Ready PlanetScope Sandbox collection.
To use your own collection, replace the collection ID in input.data.type,
specify the desired input and output bands in the setup function
(you can use any subset of the input bands found in the summaries object for your collection),
and then map the input bands to the output raster in the evaluatePixel function.
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/OGC/1.3/CRS84"},"bbox": [-0.8,44.65,-0.55,44.82]},"data": [{"type": "byoc-3f605f75-86c4-411a-b4ae-01c896f0e54e","dataFilter": {"timeRange": {"from": "2023-04-18T00:00:00Z","to": "2023-04-18T23:59:59Z"}}}]},"output": {"width": 512,"height": 512}}' \-F 'evalscript=//VERSION=3function setup() {return {input: ["blue", "green", "red", "dataMask"],output: {bands: 4}};}let factor = 1/2000;function evaluatePixel(sample) {return [factor * sample.red,factor * sample.green,factor * sample.blue,dataMask]}'