Unable to use search API with "bbox"
Closed this issue · 2 comments
I'm currently unable to get a working example of using the search API with the "bbox" filter. I am using your https://sat-api.developmentseed.org
instance of sat-api.
The /stac/search
POST example here currently gives:
{ message: 'Missing Authentication Token' }
(Note the documentation on that endpoint states "This operation does not require authentication").
I also tried the GET /search/stac
endpoint documented in this blog post, but it fails when I add a bbox
query parameter:
GET https://sat-api.developmentseed.org/search/stac?limit=3&bbox=[-110,39.5,-105,40.5]
gives HTTP 400 with response:
{"details":"[query_shard_exception] failed to create query: {\n \"bool\" : {\n \"must\" : [\n {\n \"bool\" : {\n \"should\" : [\n {\n
\"match\" : {\n \"bbox\" : {\n \"query\" : \"[-110,39.5,-105,40.5]\",\n \"operator\" : \"OR\",\n \"prefix_length\" : 0,\n \"max_expansions\" : 50,\n \"fuzzy_transpositions\" : true,\n \"lenient\" : false,\n \"zero_terms_query\" : \"NONE\",\n \"boost\" : 1.0\n }\n }\n },\n {\n \"bool\" : {\n \"must_not\" : [\n
{\n \"exists\" : {\n \"field\" : \"bbox\",\n \"boost\" : 1.0\n }\n }\n ],\n \"adjust_pure_negative\" : true,\n \"boost\" : 1.0\n }\n }\n ],\n \"adjust_pure_negative\" : true,\n \"boost\" : 1.0\n }\n },\n {\n \"bool\" : {\n \"should\" : [\n {\n \"match\" : {\n \"c:id\" : {\n \"query\" : \"landsat-8-l1\",\n \"operator\" : \"OR\",\n \"prefix_length\" : 0,\n \"max_expansions\" : 50,\n \"fuzzy_transpositions\" : true,\n \"lenient\" : false,\n \"zero_terms_query\" : \"NONE\",\n \"boost\" : 1.0\n }\n }\n },\n {\n \"match\" : {\n \"c:id\" : {\n \"query\" : \"sentinel-2-l1c\",\n \"operator\" : \"OR\",\n \"prefix_length\" : 0,\n \"max_expansions\" : 50,\n \"fuzzy_transpositions\" : true,\n \"lenient\" : false,\n \"zero_terms_query\" : \"NONE\",\n \"boost\" : 1.0\n }\n }\n }\n
],\n \"adjust_pure_negative\" : true,\n \"boost\" : 1.0\n }\n }\n ],\n \"adjust_pure_negative\" : true,\n \"boost\" : 1.0\n }\n}, with { index_uuid=\"SJ9s6To4TpOcVo5jOjgO3A\" & index=\"items\" }"}
Any ideas on how to get this to work?
p.s. thank you for all the work on this awesome library!
Hi @mhiley ,
the API at https://sat-api.developmentseed.org is an older version (STAC 0.5.0), and doesn't fully adhere to the spec. bbox is one of the things it does not support, along with queries.
Our updated sat-api (STAC 0.6.0) implements all of the STAC features and is currently running at
https://sat-api-dev.developmentseed.org
Here's the documentation for the API:
https://sharkinsspatial.github.io/sat_api_docs/?python#search-stac-items-by-full-featured-filtering-
One of the new changes is also that that search endpoint is now at 'stac/search' rather than 'search/stac'.
sat-api-dev is not fully populated with Landsat and Sentinel data. We are working on that and will be moving it over the sat-api.developmentseed.org domain in the next week.
Thanks for the great set of tools under sat-utils @matthewhanson !
In trying out the API for STAC 0.6, it's still unclear how to do a bbox search. Seems to be a syntax error on my part, or something to do with how it is validated:
for example, following (https://github.com/radiantearth/stac-spec/blob/96ee20732bc8807e8a5f8b7e26eaae185ccc8cad/api-spec/filters.md)
https://sat-api-dev.developmentseed.org/stac/search?bbox=[-125,45,-117,49]&limit=10
results in
{"code":500,"description":"[number_format_exception] For input string: \"[\""}
(similar errors show up if the square brackets are removed, complaining about negative signs and commas)
Could you include a few working URLs as examples that include bbox, a filter based on a property (like cloud cover), and sorting? It's a bit unclear from the API docs how to construct the URLs.