Skip to main content

Comparing API Data with Crop-Monitoring

If you use Crop Monitoring app and want to retrieve the same images as you get there, we have some recommendations for you:

  • pay attention to the colormaps: you should use the same colormaps as CM
  • pay attention to the bands, aliases and formulas you use
  • use S2L2A sentinel image level processing instead of S2L1C sentinel2l2a
  • add parameter β€œcalibrate”: 1

Image retrieved from API VS Image retrieved from CM:​

Comparison CMComparison CM

The example of request:

{
"type": "jpeg",
"params": {
"view_id": "S2L2A/13/R/EL/2023/3/1/0",
"bm_type": "(NIR-RED)/(NIR+RED)",
"geometry":{
"type": "Polygon",
"coordinates": [
[
[-104.87931347024973, 27.166227117387663],
[-104.87190853064376, 27.17371136921598],
[-104.87342635831662, 27.174691312920004],
[-104.87486446023671, 27.175686643908065],
[-104.87349218209731, 27.17760481048809],
[-104.87300869457559, 27.178164672168464],
[-104.87271173924485, 27.178599422270565],
[-104.87442556680298, 27.179861963992707],
[-104.87575466983847, 27.180525385046096],
[-104.88103048496039, 27.176643443128853],
[-104.87879079838643, 27.17447594260605],
[-104.8773735412035, 27.173532588782123],
[-104.87798049035935, 27.173144702409814],
[-104.87771956045358, 27.172771682872458],
[-104.88236756436531, 27.17042134807906],
[-104.87947723930037, 27.16605521353941],
[-104.87931347024973, 27.166227117387663]
]
]
},
"px_size": 1,
"format":"png",
"colormap": "a9bc6eceeef2a13bb88a7f641dca3aa0",
"levels": "0,1",
"reference": "TEST-01",
"calibrate": 1
}
}
note

Before 2018 crop-monitoring used the value "sentinel2" for request parameter "dataset_id" (its same abbreviation S2) but from 2018 to present crop-monitoring is using the value "sentinel2l2a" for request parameter "datasetid" (its same abbreviation S2L2A)

There are 2 ways to get values of vegetation indices in the API: with an alias name, for example:

"bm_type":"NDVI", or with bands formula: "bm_type":"(B08-B04)/(B08+B04)"

In case you use aliases names, we would like to remind you what formulas are compatible with these indices:

NDVI =(NIR-RED)/(NIR+RED)
NDRE =(NIR-B05)/(NIR+B05)
MSAVI =(2*B09+1-sqrt((2*B09+1)^2-8*(B09-B05)))/2
RECI =(NIR/RED)-1
NDMI = (NIR-SWIR1)/(NIR+SWIR1)
info

The main reason for the discrepancies in all indexes in API and CM, the different bands (B8A and B08) in formula. For example: API NDVI = (B8A-B04)/(B8A+B04) CM NDVI = (NIR-RED)/(NIR+RED) = (B08-B04)/(B08+B04)

B08 and B8A are both located in the near-infrared (NIR) region of the electromagnetic spectrum and are used for similar remote sensing applications, particularly in vegetation monitoring and analysis. Both bands are part of the Sentinel-2 satellite imagery and can be used to calculate vegetation indices. The main difference between B8A and B08 is their spectral range and spatial resolution, with B8A having a slightly wider spectral range and a higher spatial resolution than B08. However, there are some differences between B08 and B8A that make them better suited for different tasks and solutions. B08 has a narrower spectral range (785-815 nm) and a higher spatial resolution (10 meters) compared to B8A, which has a wider spectral range (865-885 nm) and a lower spatial resolution (20 meters). B08 is particularly useful for applications that require high spatial resolution, such as mapping vegetation in small areas or detecting changes in vegetation over time. B8A, on the other hand, is better suited for applications that require a wider spectral range.

B8A band at 20 m resolution is used for NDVI computation as B8A spectral response is narrower than band B8. It's more relevant with respect to the underlying surface and less impacted by water vapor content, there are two strong absorption lines in B8, and one in B8A

info

RECI values of more than 10 into one class in CM and in API do not do that

API designed to return the RECI values without any additional processing or grouping. This may be useful for users who need more precise or detailed information about the RECI values, or who are working with the data in a different context than the web app.

Colormap and colors/threshold for comparing API data with Crop Monitoring​

NDVI - COLORMAP=a9bc6eceeef2a13bb88a7f641dca3aa0&MIN_MAX=-1,1
NDRE - COLORMAP=a9bc6eceeef2a13bb88a7f641dca3aa0&MIN_MAX=-1.0,1.0
MSAVI - COLORMAP=5792d8fc39a4598f8a2c67b300982076&MIN_MAX=-1,1
NDMI - COLORMAP=a53f2c53d3cbc1d424c35ac8dc883644&MIN_MAX=-1,1

1. For getting NDVI data you can use​

"colormap": "2b0040e4100279573a41138c8a30c1f2" 

"levels": "0,1"

or

"colors":[
"AD0028",
"C5142A",
"E02D2C",
"EF4C3A",
"FE6C4A",
"FF8D5A",
"FFAB69",
"FFC67D",
"FFE093",
"FFEFAB",
"FDFEC2",
"EAF7AC",
"D5EF94",
"B9E383",
"9BD873",
"77CA6F",
"53BD6B",
"14AA60",
"009755",
"007E47"]

"thresholds":[0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95]

2. For getting MSAVI data you can use​

"colormap": "f69be4cbf4004373db010808117d09ae"
"levels": "-1,1"

or

"colors":[ 
"A50026",
"D73228",
"F57446",
"FDB567",
"FEE796",
"F4FAB0",
"C7E77F",
"8BCD67",
"43AC5A",
"0C7E42"]

"thresholds":[-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8]

3. For getting NDRE data you can use​

"colormap": "f69be4cbf4004373db010808117d09ae"
"levels": "-1,1"

or

"colors":[ 
"A50026",
"D73228",
"F57446",
"FDB567",
"FEE796",
"F4FAB0",
"C7E77F",
"8BCD67",
"43AC5A",
"0C7E42"]

"thresholds":[-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8]

4. For getting RECI data you can use​

 "colormap": "2b0040e4100279573a41138c8a30c1f2"
"levels": "0,10"

or

"colors":[ 
"A50026",
"BC1626",
"D62F26",
"E54D34",
"F46D43",
"F98E52",
"FCAC60",
"FDC675",
"FEE08B",
"FEEFA5",
"FEFEBD",
"ECF7A5",
"D9EF8B",
"BFE37A",
"A4D869",
"84CA66",
"66BD63",
"3FAA59",
"19974F",
"0C7E42"]

"thresholds":[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5]


5. For getting NDMI data you can use​

"colormap": "4d41ff803420fb4fc0e3d0acd462bd67"
"levels": "0,1"

or

"colors":[
"F7FBFF",
"EDF4FB",
"E3EEF8",
"D9E7F5",
"CFE1F2",
"C5DAEE",
"B6D4E9",
"A6CDE3",
"93C4DE",
"7FB8DA",
"6AADD5",
"5AA3CF",
"4A97C9",
"3B8BC2",
"2D7DBB",
"2070B4",
"1764AB",
"0C57A0",
"084991",
"083C7D"]

"thresholds":[0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95]