-
Notifications
You must be signed in to change notification settings - Fork 85
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
add support for sorting query results #157
Comments
@tomkralidis You should probably also review the sorting clause in the Filter encoding specification (http://docs.opengeospatial.org/is/09-026r2/09-026r2.html and https://portal.opengeospatial.org/files/?artifact_id=66226). I wrote both the CSW and FES sections on sorting so they should be fairly similar. |
Thanks @pvretano. Looks like the main difference in HTTP GET context is that CSW's sort uses a colon to seperate the sort property from the sort order, whereas WFS uses a space. I'd vote for the colon (or anything not a space). |
@tomkralidis sure ... sounds OK to me. |
Say one implements an INSPIRE app-schema or CityGML, and wants to sort on an attribute. That would require an xpath which uses colon. This is a problem IMHO, either consider a char escaping approach or quoting... This is needed whatever char is used for seoaratio, but maybe best use one very unlikely to appear in attribute references. |
I presume there's a reason, but why comma-separate attributes when repeating querystring/post parameters is perfectly find under HTTP? Another concept I've seen a few places (Django uses):
Pretty unlikely attributes will start with |
just a nit pick, but in KVP, the & closes the pair, not opens it so:
=> ORDER BY attr DESC, other, afield& |
@rcoup just have to be extra careful with repeating parameters ( |
cc @hgs-truthe01 In STAC we just added sorting - currently on dev for 0.6.0, and I believe Tim has an implementation of it. We'd be happy to align with WFS3, but are going to ship this first version pretty soon. |
The following is transferred from #23. In WFS3 Core there's no way to specify the sorting order. Therefore paging is only really useful for "streaming" through the response in When sorting extension is added paging becomes much more meaningful. Then you can access the last page by flipping the sorting order and accessing the first page, so I'd still vote no for Originally posted by @jampukka in #23 (comment) Without explicit sorting, does pagination have much meaning? Pagination of an unsorted (or at least, not-explicitly-sorted) result seems like a useful way to break up a request that would otherwise be too large for client or server, but random page access to unsorted records doesn't seem like a use case for anything apart from achieving these small sequential payloads. A client cannot sort without access to the full collection. Given that sorting is not mentioned in the Core (I think; I've only just read the specification), is there a contract that a particular page has coherent content with its linked adjacent Sorting features of a collection by time (if temporal) and then secondarily by primary key seems like a suitable implementation for some servers and datasets, but obviously primary keys are not necessarily in any kind of semantic and/or alpha-numeric order so ideally function only as tie-breakers when sorting on some other property. Is time a default sort condition? And if so, what of features without temporal information: is it determined by their name? What of features with durations? Being able to bypass a server's maximum Another solution might be the ability to return a list of all pages upfront, thereby giving a client the opportunity to request pages in parallel rather than sequentially. This has advantages to the client beyond reducing the probability of data in a collection changing while paginating: including client-side latency, and UI advantages when aiming to render a Hypothetically, pages could include some information about their range (e.g. temporal extent if relevant), which would provide additional benefits to both human and computer interaction. For large collections this is still probably not feasible, since it may not be able to efficiently compute where page boundaries lie in a sorted collection beyond previous/next relations. However, given that a collection's feature count is known at request, as is the page Pages themselves could even take on an explicit spatial property, perhaps if pages are organised (features are sorted) into some kind of tessellated grid, like DGGS—at this point perhaps a client would prefer vector tiles. These are more rambling and obvious thoughts than coherent contributions. My point is really the same as @jampukka's:
To this I'd add:
Originally posted by @alpha-beta-soup in #23 (comment) |
Note relevant work in STAC: radiantearth/stac-spec#513 which could be of use. |
Sorting is currently specified by Records, see http://docs.opengeospatial.org/DRAFTS/20-004.html#clause-sorting. This should eventually be moved to Common. Features can simply specify support for sorting by adding a requirements class that binds the |
Any news on this ? Trying so sort data in the gml file doesn't seem appropriate. |
@apfelnymous what specifically are you asking about? If your question is about when sorting will be specified in the Features specifications then ... Sorting is still on the roadmap to be moved from Records to Features (and eventually Common) but right now we are concentrating on finishing CQL2 and the other active Parts of the Features suite of specifications. For the time being, as @cportele mentioned above, if you have a sorting requirement then simply implement the sortBy query parameter at the |
@pvretano |
Overview
Allow for sorting of query results against
items
endpoints.In pygeoapi we are considering adopting the OGC CSW 2.0.2 implementation of
sortby
.From Table 65:
From 10.8.4.12:
Examples:
title
, ascending:sortby=title
orsortby=title:A
country
, descending:sortby=country:D
title
, ascending, then propertycountry
, descending:sortby=title,country:D
The text was updated successfully, but these errors were encountered: