Search¶
In the previous section, we explored how to discover what sort content the catalog provides.
Now we will see how to query the different types of collection : index, series and data packages
The Terradue catalog presents information based on the widely used OpenSearch standard which splits searches into two universally usable steps:
- Requests for description documents that defines search templates, and
- Search Requests based on the templates from a description document.
Description document¶
Every point of access for any type of collection must expose a description document. It is a self-descriptive XML document that declares the entry points (or templates) for the search and the parameters that can be searched.
Let’s query the raw XML using cURL (xmllint is used for a better formatting):
curl "https://catalog.terradue.com/mrossi/description" | xmllint --format -
Alternatively we can use the opensearch-client to format it in a human-readable way. The following command lists search parameters that can be used with entries in the sentinel2 index:
opensearch-client -d atom "https://catalog.terradue.com/sentinel2/description"
Search URL type: application/atom+xml (format: atom)
Parameters
Name Description/title M O R P S (mandatory, options, range, pattern, step)
---- ----------------- ---------
- count number of search results per page des... - - R - -
- startPage page number of the set of search resu... - - - - -
- startIndex index of the first search result desired - - - - -
- q EO Free Text Search - - - - -
- lang desired language of the results - - - - -
- update date after which dataset are updated ... - - - - -
- do a string that identifies the download... - - - - -
- start start of the temporal interval (RFC-3... - - R - -
- stop stop of the temporal interval (RFC-3339) - - R - -
- trel Temporal relation (possible values ar... - O - - -
- bbox Rectangular bounding box - - - - -
- uid The identifier of the resource within... - - - - -
- geom Geometry in WKT - - - - -
- rel Spatial relation (possible values are... - O - - -
- cat The identifier of a category. Recomme... - - - - -
- pt A string identifying the product type - O - - -
- psn A string with the platform short name - O - - -
- psi A string with the Platform serial ide... - O - - -
- isn A string identifying the instrument - O - - -
- st A string identifying the sensor type - O - - -
- pl A string identifying the processing l... - O - - -
- ot A string identifying the orbit type - O - - -
- title A name given to the resource - - - - -
- pi A string identifying the collection o... - O - - -
- od A string identifying the orbit direction - O - - -
- track A number, set or interval requesting ... - - - - -
- cc A number, set or interval requesting ... - - R - -
- lc A number, set or interval requesting ... - - - - -
- dcg Set to apply a finer geometry filtering - - - - -
Specific information about individual search parameters (such as possible options) can be shown by specifying the parameter, in this example for rel, the spatial relation parameter for the spatial match of search geometry and product footprint:
opensearch-client -d atom.rel "https://catalog.terradue.com/sentinel2/description"
Search URL type: application/atom+xml (format: atom)
- Parameter: rel
Description/title: Spatial relation (possible values are “intersects”, “contains”, “disjoint”). The default is intersects.
Options:
Value Label/description
----- -----------------
- intersects Intersects
- contains Contains
- disjoint Disjoint
Warning
Do not confuse query filters and properties keywords.
Even if they may have a relationship, the name used for query filters do not always correspond exactly to the properties keywords extractor used in opensearch-client.
For instance, when you filter on the identifier, you use the filter uid
, when you request the identifier, you use identifier
.
Query with filters¶
We will perform the query using parameters
With cURL:
curl "https://catalog.terradue.com/mrossi/search?format=atom&q=processing&bbox=60,-30,70,-20"
The equivalent request with opensearch-client:
opensearch-client -f atom -p q=processing -p bbox=60,-30,70,-20 "https://catalog.terradue.com/mrossi/search?format=json&q=processing&bbox=60,-30,70,-20" {}
Both previous commands will return the atom feed with the result queried.
Query specific properties¶
With opensearch-client, it is possible to query some specific entry properties according to the metadata model of the resource.
Note
See the opensearch-client doc section to learn how to list all the metadata properties extractor available per metadata model.
Let’s take again our previous resource and ask for the identifiers, the spatial WKT and the publication date:
opensearch-client -f atom -p q=processing -p bbox=60,-30,70,-20 "https://catalog.terradue.com/mrossi/search?format=json&q=processing&bbox=60,-30,70,-20" identifier,wkt,published