Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultSortOrder + sortby in POST requests (from STAC) #377

Open
m-mohr opened this issue Jul 22, 2024 · 2 comments
Open

defaultSortOrder + sortby in POST requests (from STAC) #377

m-mohr opened this issue Jul 22, 2024 · 2 comments

Comments

@m-mohr
Copy link
Contributor

m-mohr commented Jul 22, 2024

At some point in the past we decided to align STAC and OGC API sort functionality.

This was discussed for GET at that point. POST is not a thing in OGC APIs (yet) so it was not discussed, I think.
I'd hope that if POST becomes a thing in OGC APIs, this would be aligned with STAC again.

It seems later a defaultSortOrder was added to OGC APIs, which is not really aligned anymore. At least it would be pretty consistent to use the POST sort schema from STAC for the default sort order instead of creating a new way to express that.

It would make sense to change to https://github.com/stac-api-extensions/sort?tab=readme-ov-file#http-post-json-entity

The difference right now is:

STAC:

{
    "sortby": [
        {
            "field": "properties.created",
            "direction": "asc"
        },
        {
            "field": "properties.eo:cloud_cover",
            "direction": "desc"
        },
        {
            "field": "id",
            "direction": "desc"
        },
        {
            "field": "collection",
            "direction": "desc"
        }
    ]
}

OGC API - Records:

{
    "sortby": ["properties.created", "-properties.eo:cloud_cover", "-id", "-collection"]
}

Surely, one of them is shorter, but the other doesn't need string parsing to extract the - and +.
Making that consistent would be great, I think.
(I might be too late but just stumbled across it now after seeing opengeospatial/ogcapi-processes#429 )

@m-mohr m-mohr changed the title Sort + STAC defaultSortOrder + sortby in POST requests (from STAC) Jul 22, 2024
@pvretano
Copy link
Contributor

@m-mohr so if I understand you want us to change the schema of "defaultSortOrder" to match the JSON encoding that STAC has developed for "sortBy". Is that correct? If yes, I don't have a problem with that ...

@m-mohr
Copy link
Contributor Author

m-mohr commented Jul 22, 2024

Yes, I think that would make the sort interface more consistent, assuming you'd adopt the POST JSON format from STAC whenever you have a need for it.

By the way: sortby is correct (in STAC), not sortBy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants