Skip to main content

Classification Area

The API allows you to calculate the area (m2) that belongs to a particular class inside of the field. The user sets the field, the spectral index for the analysis and the threshold values of the classes.

For example, for a selected field,you can find out the area of the flooded lands, the area of the forests damaged by wildfire etc. by providing the range of values of the spectral index that outlines those conditions.

HTTP Request​

POST 'https://api-connect.eos.com/api/analytic/classification_area/<field_id>?api_key=<your_api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"params": {
"index": "NDVI",
"view_id": "S2/36/U/UA/2020/2/22/0",
"data_source": "S2L1C",
"colors": ["red", "green"],
"thresholds": [[-1,0], [0,1]]
},
"callback_url": "https://example.com"
}'

Request Parameters​

Request Path ParameterDescription
api_key(Required) Apikey retrieved from developer portal
field_id(Required) The field identifier;
Request Body ParameterDescription
params.index(required) Band math expression based on which the statistics are computed. Exactly one expression has to be specified. (NDVI, RECI, NDRE, MSAVI)
params.view_id(required) Scene id in ("S2/35/U/QR/2020/4/5/1", "S2/35/U/QR/2020/4/2/0", "MODIS/30/12/2021100/2021109132942", etc).
params.data_source(required) Use for this parameter one value from the list of sensor abbreviation ("S2L1C", "S2L2A", "L8"). Default value is "S2L2A".
params.colors(optional) This fields describes the colors of the classes. Format:["red", "green", "blue"]. The number of colors must match the number of thresholds classes.
params.thresholds(optional) This fields describes the edges of the classes. Format:[[float_min, float_max],…,[float_min, float_max]]. The first element of the range must be less than or equal to the second. All but the last (righthand-most) bin is half-open. In other words, if bins is: [1, 2, 3, 4], then the first bin is [1, 2) (including 1, but excluding 2) and the second [2, 3). The last bin, however, is [3, 4], which includes 4.
callback_url(optional) URL to which the calculation result will be sent.

Example: Get the classification area for field​

Step 1:​

curl --location --request POST 'https://api-connect.eos.com/classification-area/9793351' \
--header 'Content-Type: text/plain' \
--header 'x-api-key: <your_api_key>' \
--data '{
"params": {
"index": "NDVI",
"view_id": "S2/13/R/EL/2023/5/10/0",
"data_source": "S2L2A",
"thresholds": [
[
0.1,
0.4
],
[
0.4,
0.8
],
[
0.8,
1
]
]
}
}'

Response

{
"status": "pending",
"request_id": "a6542ad8-24f0-4477-96b4-fd87c7659363"
}
Response parameters​
ParameterDescription
statusTask status;
request_idUnique task identifier;

Step 2:​

Get classification area for field​

This endpoint is used for getting classification area information for the field.

HTTP Request​

curl --location --request GET 'https://api-connect.eos.com/classification-area/9793351/a6542ad8-24f0-4477-96b4-fd87c7659363' \
--header 'x-api-key: <your_api_key>' \
--data ''

Request Parameters​

Request Path ParameterDescription
api_key(Required) Apikey retrieved from developer portal
field_id(Required) The field identifier;
request_id(Required) Classification area task identifier;

HTTP Response​

{
"result": [
{
"edges": [
0.1,
0.4
],
"area": 27370.86611419546
},
{
"edges": [
0.4,
0.8
],
"area": 339717.6927955635
},
{
"edges": [
0.8,
1.0
],
"area": 401834.9512674968
},
{
"cloud": 0
}
],
"task_timeout": 345506
}