Download indices
Compute band math for a specified area of interest (AOI) in the given scene using the Bandmath API.
HTTP Request
curl --location --request POST 'https://api-connect.eos.com/api/gdw/api?api_key=<your_api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "bandmath",
"params": {
"view_id": "view_id",
"bm_type": "bm_type",
"geometry":{"type": "Polygon",
"coordinates": [[
[lon,lat],
[lon,lat],
.........,
[lon,lat]
]]
},
"name_alias":"alias name",
"reference": "ref_datetime"
}
}'
Request Parameters
Parameter | Value | Description |
---|---|---|
api_key | <your api key> | (Required) Apikey retrieved from developer portal |
Request Body Parameter | Description |
---|---|
type | (required) Operation name. Value is ‘bandmath’. |
params | (required) Request parameters. |
params.view_id | (required) View id of the scene returned by the Search API, see Search API. Example values: “L8/LC80110312016028LGN00”, “S2/19/T/CG/2017/7/9/0”, “MODIS/12/04/2017204/2017213034223” etc |
params.geometry | (required to crop by AOI: either bbox, geometry or cropper_ref must be set) A GeoJSON representation of a geometry describing the AOI. Supported geometry types: “Polygon”, “MultiPolygon”. If neither geometry nor bbox were provided, then process a full scene |
params.bm_type | (required) Band combination to calculate. Example: “(B5-B4)/(B5+B4),(B3-B5)/(B3+B5),(B3-B6)/(B3+B6)”, “B5-1” etc. For available band combinations please refer to Name Aliases and Supported Datasets |
params.name_alias | (optional) User name of bandmath to be used in output file name. |
params.reference | (required) Unique id to assign to the request |
HTTP Response
The above commands returns the following JSON with task status
{
"status": "status",
"task_id": "task_id",
"req_id": "req_id",
"task_timeout": task_timeout
}
After that, you need to send a request for checking task status using task_id
Result image info:
- file name:
<scene>_<combination>.TIF
, where scene - lv_id or scene_id; combination - name_alias else bm_type - number of bands equals the length of expressions list in bm_type, each band represents bandmath provided by its expression
- file format: GTiff
- depth: Float32
- tiled: yes, block=512x512
- pixel size and resolution: resample to the lowest resolution among bands in ‘args’.
- no data value == -9999
Limitation
Max supported area of AOI is 8 km2
For NAIP only R,G,B bands can participate in custom bandmath, since N band is not accessible
Examples: Download bandmath for an area of interest (AOI) for the given scene
Step 1: Create task for indices calculating with POST
request
curl --location --request POST 'https://api-connect.eos.com/api/gdw/api' \
--header 'Content-Type: text/plain' \
--header 'x-api-key: <your_api_key>' \
--data '{
"type": "bandmath",
"params": {
"view_id": "S2/13/R/EL/2023/7/19/0",
"bm_type": "(B08-B04)/(B08+B04)",
"geometry":{"type": "Polygon",
"coordinates": [
[
[-104.87931347024973, 27.166227117387663],
[-104.87190853064376,27.17371136921598],
[-104.87486446023671,27.175686643908065],
[-104.87271173924485,27.178599422270565],
[-104.87575466983847,27.180525385046096],
[-104.88103048496039,27.176643443128853],
[-104.87771956045358,27.172771682872458],
[-104.88236756436531,27.17042134807906],
[-104.87931347024973,27.166227117387663]
]
]
},
"name_alias":"NDVI",
"reference": "ref_datetime"
}
}'
Example of response:
{
"status": "created",
"task_id": "a853944b-cb24-43e4-9d1c-c81e5429cdd4",
"req_id": "6a45b628-d75b-4caf-aa33-9a3fdf6883fa",
"task_timeout": 345600
}
Step 2: Receive the result of calculation with GET
request and use task_id
from previous step
curl --location --request GET 'https://api-connect.eos.com/api/gdw/api/a853944b-cb24-43e4-9d1c-c81e5429cdd4' \
--header 'x-api-key: <your_api_key>'
Example of response:
tip
You can download the image from response in .tiff
format and open in any tool, such as QGIS