automation.rst 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. .. _opensearch_automation:
  2. Automation with the administration REST API
  3. ============================================
  4. The OpenSearch module supports full automation REST API that can be used to
  5. create collections, ingest products and eventually their granules.
  6. The full API is available at this URL:
  7. * :api:`/oseo <opensearch-eo.yaml>`
  8. In general terms, one would:
  9. * Create a collection, along with thumbnail, OGC links
  10. * Then create a product, along with thumbnail, OGC links
  11. * Finally, and optionally, specify the granules composing the product (actually needed only
  12. if the OpenSearch subsystem is meant to be used for publishing OGC services layers too,
  13. instead of being a simple search engine.
  14. Understanding the zip file uploads
  15. ----------------------------------
  16. The description of a collection and product is normally made of various components, in order to expedite
  17. data creation and reduce protocol chattines, it is possible to bulk-upload all files composing
  18. the description of collections and products as a single zip file.
  19. Collection components
  20. `````````````````````
  21. A collection.zip, sent as a PUT request to ``rest/collections`` would contain the following files:
  22. .. list-table::
  23. :widths: 10 10 80
  24. :header-rows: 1
  25. * - Name
  26. - Optional
  27. - Description
  28. * - collection.json
  29. - N
  30. - The collection attributes, matching the database structure (the prefixes are
  31. separated with a colon in this document)
  32. * - description.html
  33. - Y
  34. - The HTML description for the collection
  35. * - thumbnail.png, thumbnail.jpg or thumbnail.jpeg
  36. - Y
  37. - The collection thumbnail
  38. * - owsLinks.json
  39. - Y
  40. - The list of OWS links to OGC services providing access to the collection contents
  41. (typically as a time enabled layer)
  42. Product components
  43. ``````````````````
  44. A product.zip, sent as a POST request to ``rest/collections/<theCollection>/products`` would contain the following files:
  45. .. list-table::
  46. :widths: 10 10 80
  47. :header-rows: 1
  48. * - Name
  49. - Optional
  50. - Description
  51. * - product.json
  52. - N
  53. - The product attributes, matching the database structure (the prefixes are
  54. separated with a colon in this JSON document)
  55. * - description.html
  56. - Y
  57. - The HTML description for the product
  58. * - thumbnail.png, thumbnail.jpg or thumbnail.jpeg
  59. - Y
  60. - The collection thumbnail
  61. * - owsLinks.json
  62. - Y
  63. - The list of OWS links to OGC services providing access to the product contents
  64. (typically, a specific time slice in the collection layer, but other organizations are possible too)
  65. * - granules.json
  66. - Y
  67. - The list of actual files making up the product, along with their bounding boxes, file location
  68. and eventual band name, for products splitting bands in different files.
  69. Could be a single file, a list of files split by area, or a list of files representing the
  70. various bands of a multispectral product.
  71. It is also possible to send the zip file on the ``rest/collections/<theCollection>/products/<theProduct>``
  72. resource as a PUT request, it will update an existing product by replacing the parts contained
  73. in the file. Parts missing from the file will be kept unchanged, to remove them run an explicit
  74. DELETE request on their respective REST resources.
  75. Usage of the API for search and integrated OGC service publishing
  76. -----------------------------------------------------------------
  77. In this case the user intend to both use the OpenSearch module for search
  78. purposes, but also to publish actual mosaics for each collection.
  79. In this case the following approach should is recommended:
  80. * Create a collection via the REST API, using the ZIP file POST upload
  81. * Create at least one product in the collection in the REST API, using the
  82. ZIP file POST upload and providing a full ``granules.json`` content with all
  83. the granules of said product
  84. * Post a layer publishing description file to ``/oseo/collection/{COLLECTION}/layers``
  85. to have the module setup a set of mosaic configuration files, store, layer with
  86. eventual coverage view and style
  87. A collection can have multiple layers:
  88. * Getting the ``/oseo/collection/{COLLECTION}/layers`` resource returns a list of the available ones
  89. * ``/oseo/collection/{COLLECTION}/layers/{layer}`` returns the specific configuration (PUT can be used to modify it, and DELETE to remove it).
  90. * Creation of a layer configuration can be done either by post-ing to ``/oseo/collection/{COLLECTION}/layers`` or by put-int to ``/oseo/collection/{COLLECTION}/layers/{layer}``.
  91. The layer configuration fields are:
  92. .. list-table::
  93. :widths: 30 70
  94. :header-rows: 1
  95. * - Attribute
  96. - Description
  97. * - workspace
  98. - The workspace that will contain the store and layer to be published
  99. * - layer
  100. - The name of the layer that will be created
  101. * - separateBands
  102. - A boolean value, true if the underlying granule table has the "band" column populated with values, meaning the
  103. product bands are split among different files, false if a single product is stored in a single file
  104. * - heterogeneousCRS
  105. - A boolean value, indicating if the products in the collection share the same CRS (false) or are expressed in different CRSses (true)
  106. * - timeRanges
  107. - A boolean value, indicating if the products are associated to a single time (false) or have have a time range of validity (true)
  108. * - bands
  109. - The list of bands used in this layer (to be specified only if "separateBands" is used)
  110. * - browseBands
  111. - An array of 1 or 3 band names used to create the default display for the layer
  112. * - mosaicCRS
  113. - The identifier of the CRS used by the mosaic (must match the granules table one)
  114. * - defaultLayer
  115. - A flag indicating if the layer is considered the default one for the collection (thus also appearing at ``/oseo/collection/{COLLECTION}/layer``
  116. The layer configuration specification will have different contents depending on the collection structure:
  117. * Single CRS, non band split, RGB or RGBA files, time configured as an "instant" (only ``timeStart`` used):
  118. .. code-block:: json
  119. {
  120. "workspace": "gs",
  121. "layer": "test123",
  122. "separateBands": false,
  123. "heterogeneousCRS": false,
  124. "timeRanges": false
  125. }
  126. * Single CRS, multiband in single file, with a gray browse style, product time configured as a range between ``timeStart`` and ``timeEnd``:
  127. .. code-block:: json
  128. {
  129. "workspace": "gs",
  130. "layer": "test123",
  131. "separateBands": false,
  132. "browseBands": ["test123[0]"],
  133. "heterogeneousCRS": false,
  134. "timeRanges": true
  135. }
  136. * Heterogeneous CRS, multi-band split across files, with a RGB browse style ("timeRanges" not specified, implying it's handled as an instant):
  137. .. code-block:: json
  138. {
  139. "workspace": "gs",
  140. "layer": "test123",
  141. "separateBands": true,
  142. "bands": [
  143. "VNIR",
  144. "QUALITY",
  145. "CLOUDSHADOW",
  146. "HAZE",
  147. "SNOW"
  148. ],
  149. "browseBands": [
  150. "VNIR[0]", "VNIR[1]", "SNOW"
  151. ],
  152. "heterogeneousCRS": true,
  153. "mosaicCRS": "EPSG:4326"
  154. }
  155. In terms of band naming the "bands" parameter contains coverage names as used in the "band" column
  156. of the granules table, in case a granule contains multiple bands, they can be referred by either
  157. using the full name, in which case they will be all picked, or by using zero-based indexes like
  158. ``BANDNAME[INDEX]``, which allows to pick a particular band.
  159. The same syntax is meant to be used in the ``browseBands`` property. In case the source is not
  160. split band, the ``browseBands`` can still be used to select specific bands, using the layer
  161. name as the coverage name, e.g. "test123[0]" to select the first band of the coverage.
  162. COG Mosaic creation
  163. ```````````````````
  164. It's also possible to configure a layer on top of a COG ImageMosaic, provided that the :ref:`cog_plugin` plugin has been installed in GeoServer.
  165. Additional fields for the layer configuration are:
  166. .. list-table::
  167. :widths: 30 70
  168. :header-rows: 1
  169. * - Attribute
  170. - Description
  171. * - cog
  172. - Set it to true to specify the layer is made of COG datasets
  173. * - cogUser
  174. - (Optional) Credential to be set whenever basic HTTP authentication is needed to access the COG Datasets or an S3 Access KeyID is required
  175. * - cogPassword
  176. - (Optional) Password for the above user OR Secret Access Key for the above S3 KeyId.
  177. * - cogRangeReader
  178. - (Optional) Specify the desired RangeReader implementation. (default is HTTP based)
  179. See :ref:`cog_plugin_rangereader` from the COG plugin documentation, for the list of supported RangeReader implementations.