Because of the character limit in the URL I used the POST request to retrieve statistical information. But I got very low NDVI values. So I used the get_data method and the POST request to compare the statistical information for the same polygon. The results are quite different. Can somebody explain me why? Thanks
Here is the configuration for the get_data method:
from sentinelhub import SHConfig, CRS, constants, FisRequest, Geometry
from shapely.geometry import Polygon
class configuration:
def use_modis():
sh_config = SHConfig()
sh_config.instance_id = <INSTANCE_ID>
sh_config.ogc_base_url = 'https://services-uswest2.sentinel-hub.com/v1/'
sh_config.save()
configuration.use_modis()
geometry1 = Geometry(Polygon([(9.888827680050385, 48.51217273580289),
(9.89264918894377, 48.51226462256068),
(9.893282254167623, 48.51638404099815),
(9.889316705153087, 48.51622619699188),
(9.888827680050385, 48.51217273580289)]),
CRS.WGS84)
fis_request = FisRequest(layer=<NDVI_LAYER>,
geometry_list=[geometry1],
time='2019-05-11',
resolution='500m',
instance_id=<INSTANCE_ID>,
data_source=constants.DataSource.MODIS
)
fis_data = fis_request.get_data(save_data=False)
fis_data
[{'C0': [{'basicStats': {'max': 0.8196691274642944,
'mean': 0.8196691274642944,
'min': 0.8196691274642944,
'stDev': 0.0},
'date': '2019-05-11'}]}]
And here is the post request:
import requests
url = 'https://services-uswest2.sentinel-hub.com/ogc/fis/'+<INSTANCE_ID>
response = requests.post(url,
headers={
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json; charset=utf-8',
'Connection': 'keep-alive'
},
json={
"layer":<NDVI_LAYER>,
"crs":"EPSG:4326",
"time":"2019-05-11/2019-05-11",
"resolution":"500m",
"geometry":"POLYGON ((9.888827680050385 48.51217273580289, 9.89264918894377 48.51226462256068, 9.893282254167623 48.51638404099815, 9.889316705153087 48.51622619699188, 9.888827680050385 48.51217273580289))",
"maxcc":100
}
)
response.json()
{'C0': [{'basicStats': {'max': 0.11925021559000015,
'mean': 0.11925021559000015,
'min': 0.11925021559000015,
'stDev': 0.0},
'date': '2019-05-11'}]}
When I download the MODIS scene and calculate the NDVI manually, I got the same value like with the FIS get_data method.