Skip to main content

Dear Sentinelhub team,


I wish you a Happy New year!


Currently working with Planetscope data, the ingestion is working very well using the productBundle ‘analytic’ (top of atmosphere).


However, I wish I could download the surface reflectance product and when I order the query using the product bundle “analytic_sr” or “analytic_sr_udm2”, I get the following error message “requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://services.sentinel-hub.com/api/v1/dataimport/orders”.


Should we change the url if we are using surface reflectance products?


Many thanks and have a great day,

Johann

Hi @desloires.johann,

might it be that you are trying to import analytic_sr data in the same collection, where you previously have “analytic”? This will not work as it would cause inconsistency.

If you, however, change the collection (or create a new one), there should be no problems.


If this is not helping your issue, I would kindly ask for more detailed description of your process flow, so that we can repeat it.


Best,

Grega


Hi @gmilcinski,


Thanks for your message.


Indeed, everything is working fine until I order the query.


The payload data is as follows to order my itemIds (working for productBundle ‘analytic’):


payload = {'name': 'planet products ',
'input': {'provider': 'PLANET',
'bounds': {'properties': {'crs': 'http://www.opengis.net/def/crs/EPSG/0/32631'},
'geometry': {'type': 'Polygon',
'coordinates': s':409964.0490900841, 5345608.346626982],
409964.0490900841, 5345878.0089169],
410182.42239297874, 5345878.0089169],
410182.42239297874, 5345608.346626982],
409964.0490900841, 5345608.346626982]]]}},
'data': a{'itemType': 'PSScene4Band',
'productBundle': 'analytic_sr_udm2',
'itemIds': s'20200723_100439_81_2223',
'20200206_103002_103e']}],
'planetApiKey': 'MASK'}}


response = oauth.post(“https://services.sentinel-hub.com/api/v1/dataimport/orders”, json=payload)

response.raise_for_status()



Hi @desloires.johann,


if I run this request myself, I get a descriptive error:


{
"error": {
"status": 400,
"reason": "Bad Request",
"message": "Field harmonizeTo must be set to NONE for productBundle ANALYTIC_SR_UDM2",
"code": "COMMON_BAD_PAYLOAD"
}
}

This is a consistency check, described here.


If I add the parameter, as described in the error, the order works for me:


{
"name": "planet products",
"input": {
"provider": "PLANET",
"planetApiKey": "MASK",
"bounds": {"properties": {"crs": "http://www.opengis.net/def/crs/EPSG/0/32631"},
"geometry": {"type": "Polygon",
"coordinates": [[[409964.0490900841, 5345608.346626982],
[409964.0490900841, 5345878.0089169],
[410182.42239297874, 5345878.0089169],
[410182.42239297874, 5345608.346626982],
[409964.0490900841, 5345608.346626982]]]}},

"data": [
{
"itemType": "PSScene4Band",
"productBundle": "analytic_sr_udm2",
"harmonizeTo": "NONE",
"itemIds": [
"20200723_100439_81_2223",
"20200206_103002_103e"

]
}
]
}
}

Hi @gmilcinski,


Many thanks for your answer.


One last thing, when I order the query using


response = oauth.post("https://services.sentinel-hub.com/api/v1/dataimport/orders", json=payload) 
response.raise_for_status()

I get an error which did not appear using the productBundle “analytic”



requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://services.sentinel-hub.com/api/v1/dataimport/orders



Regarding the documentation, it seems that I should rather do the subscribing (https://docs.sentinel-hub.com/api/latest/api/data-import/examples/#subscribe)


url = "https://services.sentinel-hub.com/api/v1/dataimport/subscriptions"

payload = {'name': 'my subscription',
'input': {'provider': 'PLANET',
'bounds': {'properties': {'crs': 'http://www.opengis.net/def/crs/EPSG/0/32631'},
'geometry': {'type': 'Polygon',
'coordinates': s':409964.0490900841, 5345608.346626982],
409964.0490900841, 5345878.0089169],
410182.42239297874, 5345878.0089169],
410182.42239297874, 5345608.346626982],
409964.0490900841, 5345608.346626982]]]}},
'data': a{'itemType': 'PSScene4Band',
'harmonizeTo': 'NONE',
'productBundle': 'analytic_sr_udm2',
'itemIds': s'20200723_100439_81_2223',
'20200206_103002_103e']}],
'planetApiKey': 'MASK'}}

response = oauth.post(url, json=payload)
response.raise_for_status()

which returns an error



requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://services.sentinel-hub.com/api/v1/dataimport/subscriptions





desloires.johann:


I get an error which did not appear using the productBundle “analytic”



404 error is typically when you are hitting an end-point that does not exist.

I did not get this error when I submitted the order above, so can you be more specific in what you are trying to do?

Make sure to use POST request type (rather than GET or similar).

This should for sure work. It is being used by many users daily and they have no problem.


Subscriptions are indeed another way to order PlanetScope data, hopefully very useful one.

I don’t think there should be itemIds in the subscription request. Where did you find such example?


Hi @gmilcinski,


Thanks for your support.


Finally, I found what happened … We must specify as well the productBundle in the search query, which is by default set to “analytic”…

Therefore, I was specifying “analytic_sr_udm2” in the order query while the search one had its default value.


Have a great day and sorry for the incovenience.


Best regards,

Johann


Reply