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, spectral index and threshold values to define the classes. For example, for a selected field, you can find out the area of flooded land or the area of damaged forests (e,g, by wildfire etc.) by providing a range of values for the spectral index (e.g. NDVI) that outlines those conditions.

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 classification are for the AOI​

Step 1:​

curl --location --request POST 'https://api-connect.eos.com/api/gdw/api?api_key=<your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"type": "cl_stats",
"params": {
"bm_type": "NDVI",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
30.522472328,
50.467365324
],
[
30.524182429,
50.466308463
],
[
30.523852837,
50.464506003
],
[
30.521969259,
50.463216701
],
[
30.520645819,
50.464056067
],
[
30.518678022,
50.465086588
],
[
30.520404455,
50.465827863
],
[
30.521141451,
50.466306635
],
[
30.522472328,
50.467365324
]
]
]
},
"reference": "6811385",
"scene_id": "S2-36-U-UB-2019-12-19-0",
"thresholds": [
[
"min",
0
],
[
0,
0.05
],
[
0.05,
0.11
],
[
0.11,
0.16
],
[
0.16,
0.2
],
[
0.2,
0.26
],
[
0.26,
0.32
],
[
0.32,
0.37
],
[
0.37,
0.42
],
[
0.42,
0.47
],
[
0.47,
0.53
],
[
0.53,
0.58
],
[
0.58,
0.63
],
[
0.63,
0.68
],
[
0.68,
0.74
],
[
0.74,
0.79
],
[
0.79,
0.84
],
[
0.84,
0.89
],
[
0.89,
0.95
],
[
0.95,
1
]
],
"exclude_cover_pixels": true,
"cloud_masking_level": 3
}
}'

Response:

{
"status": "pending",
"request_id": "567169e1-b302-40d5-8367-da59c462261a"
}

Step 2:​

curl --location --request GET 'https://api-connect.eos.com/api/gdw/api/567169e1-b302-40d5-8367-da59c462261a?api_key=<your_api_key>'

Response:

{
"result": [
{
"edges": [
"min",
0
],
"area": 54282.034365114116
},
{
"edges": [
0,
0.05
],
"area": 14738.207871003156
},
{
"edges": [
0.05,
0.11
],
"area": 12806.334543187346
},
{
"edges": [
0.11,
0.16
],
"area": 7234.332544577893
},
{
"edges": [
0.16,
0.2
],
"area": 1828.1635650261305
},
{
"edges": [
0.2,
0.26
],
"area": 1657.2925612929976
},
{
"edges": [
0.26,
0.32
],
"area": 800.0
},
{
"edges": [
0.32,
0.37
],
"area": 0.0014861382551316638
},
{
"edges": [
0.37,
0.42
],
"area": 0
},
{
"edges": [
0.42,
0.47
],
"area": 0
},
{
"edges": [
0.47,
0.53
],
"area": 0
},
{
"edges": [
0.53,
0.58
],
"area": 0
},
{
"edges": [
0.58,
0.63
],
"area": 0
},
{
"edges": [
0.63,
0.68
],
"area": 0
},
{
"edges": [
0.68,
0.74
],
"area": 0
},
{
"edges": [
0.74,
0.79
],
"area": 0
},
{
"edges": [
0.79,
0.84
],
"area": 0
},
{
"edges": [
0.84,
0.89
],
"area": 0
},
{
"edges": [
0.89,
0.95
],
"area": 0
},
{
"edges": [
0.95,
1
],
"area": 0
},
{
"cloud": 0
}
],
"task_timeout": 345588
}