sat-utils/sat-api

Sort not working

Opened this issue · 0 comments

Searching with a sort field doesn't seem to have an affect on the search results. I'm using the satsearch Python library, but the Post body it sends looks correct so I'm assuming the issue is either with the api or that I'm simply entering my sort argument incorrectly.

My search kwargs are:

{'bbox': [-110, 39.5, -105, 40.5],
 'datetime': '2020-07-01/2020-07-05',
 'query': {'eo:cloud_cover': {'lt': 10, 'gt': 0}},
 'collections': ['sentinel-s2-l2a-cogs'],
 'sort': [{'field': 'eo:cloud_cover', 'direction': 'desc'}],
 'limit': 500}

I'm using the Element84 url: "https://earth-search.aws.element84.com/v0"

However the items returned look like:

[S2A_13SED_20200705_0_L2A,
 S2A_13TEE_20200705_0_L2A,
 S2B_12TXK_20200703_0_L2A,
 S2B_12TYK_20200703_0_L2A,
 S2B_13TBE_20200703_0_L2A,
 S2A_13SED_20200702_0_L2A,
 S2A_13TDE_20200702_0_L2A,
 S2A_13TEE_20200702_0_L2A]

It looks like the result is sorted by date rather than cloud cover as requested. I've also tried changing field to datetime and altering the direction, but this has no effect.