11.. _stac :
22
33Publishing files to a SpatioTemporal Asset Catalog
4- **************************************************
4+ ==================================================
55
66The `SpatioTemporal Asset Catalog (STAC) `_ family of specifications aim to standardize
77the way geospatial asset metadata is structured and queried. A "spatiotemporal asset"
@@ -16,9 +16,11 @@ years, and is used in numerous production deployments.
1616
1717pygeoapi built-in providers to browse STAC catalogs are described below:
1818
19+ Static catalog
20+ --------------
1921
2022FileSystem Provider
21- ===================
23+ ^^^^^^^^^^^^^^^^^^^
2224
2325The FileSystem Provider implements STAC as a geospatial file browser through the server's file system,
2426supporting any level of file/directory nesting/hierarchy.
@@ -27,7 +29,7 @@ Configuring STAC in pygeoapi is done by simply pointing the ``data`` provider pr
2729to the given directory and specifying allowed file types:
2830
2931Connection examples
30- -------------------
32+ *******************
3133
3234.. code-block :: yaml
3335
@@ -47,7 +49,7 @@ Connection examples
4749
4850
4951pygeometa metadata control files
50- --------------------------------
52+ ********************************
5153
5254pygeoapi's STAC filesystem functionality supports `pygeometa `_ MCF files residing
5355in the same directory as data files. If an MCF file is found, it will be used
@@ -57,13 +59,13 @@ pygeometa will generate the STAC item metadata from configuration and by
5759reading the data's properties.
5860
5961Publishing ESRI Shapefiles
60- --------------------------
62+ **************************
6163
6264ESRI Shapefile publishing requires to specify all required component file extensions
6365(``.shp ``, ``.shx ``, ``.dbf ``) with the provider ``file_types `` option.
6466
6567Data access examples
66- --------------------
68+ ********************
6769
6870* STAC root page
6971
@@ -72,7 +74,7 @@ Data access examples
7274From here, browse the filesystem accordingly.
7375
7476Azure Blob Storage Provider
75- ===========================
77+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
7678
7779The AzureBlobStorage Provider implements STAC as a geospatial file browser through Azure Blob Storage,
7880supporting any level of file/directory nesting/hierarchy.
@@ -81,7 +83,7 @@ Configuring STAC in pygeoapi is done by simply pointing the ``data`` provider pr
8183to the given container and specifying allowed file types:
8284
8385Connection examples
84- -------------------
86+ *******************
8587
8688.. code-block :: yaml
8789
@@ -104,7 +106,7 @@ Connection examples
104106
105107
106108Hateoas Provider
107- ================
109+ ^^^^^^^^^^^^^^^^
108110
109111HATEOAS (Hypermedia as the Engine of Application State) is a way of implementing a REST
110112application that allows the client to dynamically navigate to the appropriate resources
@@ -149,7 +151,7 @@ So, the following rules must be respected:
149151-------------
150152
151153File examples
152- -------------
154+ *************
153155
154156**Structure of the catalog.json file **
155157
@@ -213,7 +215,7 @@ The code above shows the root catalog. The sub-catalogs have an additional ``rel
213215
214216-------------------------------------
215217
216- **Structure of the collection.json file **
218+ **Structure of the `` collection.json`` file **
217219
218220Collections are similar to Catalogs with extra fields.
219221
@@ -270,10 +272,9 @@ Collections are similar to Catalogs with extra fields.
270272 }
271273
272274
275+ **Structure of the Item ``<id>.json`` file **
273276
274- **Structure of the Item <id>.json file **
275-
276- The example below shows the content of a file named *arcticdem-frontiere-0.json *.
277+ The example below shows the content of a file named ``arcticdem-frontiere-0.json ``:
277278
278279.. code-block :: json
279280
@@ -351,14 +352,14 @@ The example below shows the content of a file named *arcticdem-frontiere-0.json*
351352
352353
353354
354- HATEOAS Configuration
355- ---------------------
355+ HATEOAS configuration
356+ *********************
356357
357358Configuring HATEOAS STAC Provider in pygeoapi is done by simply pointing the ``data `` provider property
358- to the local directory or remote URL and specifying the root file name (catalog.json or collection.json) in the file_types property:
359+ to the local directory or remote URL and specifying the root file name (`` catalog.json `` or `` collection.json `` ) in the `` file_types `` property:
359360
360361Connection examples
361- -------------------
362+ *******************
362363
363364.. code-block :: yaml
364365
@@ -380,6 +381,106 @@ Connection examples
380381 data : tests/stac
381382 file_types : catalog.json
382383
384+ STAC API
385+ --------
386+
387+ `STAC API `_ support is provided as a wrapper on top of resources that have feature or record providers configured.
388+
389+ To enable STAC API support, configure a resource with a feature or record provider, and set the resource ``type `` to ``stac-collection ``:
390+
391+ .. code-block :: yaml
392+
393+ canada-metadata :
394+ type : stac-collection
395+ title :
396+ en : Open Canada sample data
397+ fr : Exemple de donn\u00e9es Canada Ouvert
398+ description :
399+ en : Sample metadata records from open.canada.ca
400+ fr : Exemples d'enregistrements de m\u00e9tadonn\u00e9es sur ouvert.canada.ca
401+ keywords :
402+ en :
403+ - canada
404+ - open data
405+ fr :
406+ - canada
407+ - donn\u00e9es ouvertes
408+ links :
409+ - type : text/html
410+ rel : canonical
411+ title : information
412+ href : https://open.canada.ca/en/open-data
413+ hreflang : en-CA
414+ - type : text/html
415+ rel : alternate
416+ title : informations
417+ href : https://ouvert.canada.ca/fr/donnees-ouvertes
418+ hreflang : fr-CA
419+ extents :
420+ spatial :
421+ bbox : [-180,-90,180,90]
422+ crs : http://www.opengis.net/def/crs/OGC/1.3/CRS84
423+ providers :
424+ - type : record
425+ name : TinyDBCatalogue
426+ data : tests/data/open.canada.ca/sample-records.tinydb
427+ id_field : externalId
428+ time_field : created
429+ title_field : title
430+
431+ STAC API queries will search all feature or record based resources configured as ``stac-collection ``. Results
432+ are decorated with the required STAC elements (unless they already exist).
433+
434+ .. note ::
435+
436+ pygeoapi STAC API support is minimally designed to leverage the OGC API - Features and OGC API - Records
437+ implementations. A typical setup would be a features or records backend of STAC Items. pygeoapi does not
438+ add or implement any STAC Catalog/Item relationships beyond what is encoded in a STAC resource.
439+
440+
441+ Data access examples
442+ --------------------
443+
444+ * landing page
445+
446+ * http://localhost:5000/stac-api
447+
448+ * query all STAC resources
449+
450+ * http://localhost:5000/stac-api/search
451+
452+ * query features (spatial)
453+
454+ * http://localhost:5000/stac-api/search?bbox=-142,52,-140,55
455+
456+ * paging
457+
458+ * http://localhost:5000/stac-api/search?offset=10&limit=10
459+
460+ * query features (temporal)
461+
462+ * http://localhost:5000/stac-api/search?datetime=2019-11-11T11:11:11Z/..
463+ * http://localhost:5000/stac-api/search?datetime=2018-11-11T11:11:11Z/2019-11-11T11:11:11Z
464+ * http://localhost:5000/stac-api/search?datetime=../2019-11-11T11:11:11Z
465+
466+ .. code-block :: bash
467+
468+ # query features (spatial)
469+ curl -X POST http://localhost:5000/stac-api/search \
470+ -H " Content-Type: application/json" \
471+ -d " {\" bbox\" : [-142, 52, -140, 55]}"
472+
473+ # paging
474+ curl -X POST http://localhost:5000/stac-api/search \
475+ -H " Content-Type: application/json" \
476+ -d " {\" offset\" : 10, \" limit\" : 10}"
477+
478+ # query features (temporal)
479+ curl -X POST http://localhost:5000/stac-api/search \
480+ -H " Content-Type: application/json" \
481+ -d " {\" datetime\" : \" 2019-11-11T11:11:11Z/..\" }"
482+
383483
384484 .. _`SpatioTemporal Asset Catalog (STAC)` : https://stacspec.org
385485.. _`pygeometa` : https://geopython.github.io/pygeometa
486+ .. _`STAC API` : https://github.com/radiantearth/stac-api-spec
0 commit comments