Sorting

specdraftimplproposal

Sort features in a response.

Scope

Conformance Classes

Sorting implements the conformance class "Sortables" of the draft of OGC API - Features - Part 5: Schemasopen in new window as well as the conformance classes "Sorting" and "Features Sorting" of the draft of OGC API - Features - Part 8: Sortingopen in new window.

Operations

ResourcePathMethodsMedia TypesDescription
Sortables
collections/{collectionId}/sortables
GET
HTML, JSON
The Sortables resource identifies the properties that can be referenced in the "sortby" parameter to order the features of the collection in the response to a query. The response is returned as a JSON Schema document that describes a single JSON object where each property is a sortable. Note that the Sortables schema does not specify a schema of any object that can be retrieved from the API. JSON Schema is used for the Sortables to have a consistent approach for describing schema information. JSON Schema is used in other parts of the API to describe schemas for JSON responses including in OpenAPI documents.

Query Parameters

NameResourcesDescription
sortby
Features
If the parameter is specified, the features are returned sorted according to the attributes specified in a comma-separated list. The attribute name can be preceded by + (ascending, the default behavior) or - (descending). Example: sortby=type,-name.
f
Sortables
Select the output format of the response. If no value is provided, the standard HTTP rules apply, i.e., the "Accept" header will be used to determine the format.

Configuration

Options

NameDefaultDescriptionTypeSince
buildingBlock
Always SORTING.
string
v2.0
enabled
false
Enable the building block?
boolean
v2.0
included
[]
Controls which of the attributes in queries can be used for sorting data. Only direct attributes of the data types STRING, DATE, DATETIME, INTEGER and FLOAT are eligible as sortables (that is, no attributes from arrays or embedded objects) unless isSortable is set to false for the property. The special value * includes all eligible properties as sortables. By default, no property is sortable.
array
v3.4
excluded
[]
The list of properties that would be sortables based on included, but which should not be sortables.
array
v3.4
pathSeparator
DOT
The character that is used as the path separator in case of object-valued properties. Either DOT or UNDERSCORE.
string
v3.4

Examples


- buildingBlock: SORTING
  enabled: true
  included:
  - name
  - function
  - height