database.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. .. _opensearch_database:
  2. The JDBC store database structure
  3. =================================
  4. The JDBC store uses a conventional relational structure, depicted in the following picture:
  5. .. figure:: images/dbschema.png
  6. So a ``collection`` has its own primary search attributes, as well as:
  7. * Zero or more OGC links pointing to where the collection is published
  8. * Layer publishing information (for auto-generation of mosaic, layer and eventual coverage view in case the actual data resides locally)
  9. * One or more products
  10. A ``product`` in turn is associated to:
  11. * A thumbnail image, in PNG or JPEG format
  12. * Zero or more OGC links pointing to where the product is published
  13. The ``granule`` table is designed to contain per product file information in case there
  14. is a desire to publish the actual data from the same local GeoServer (but in general, OGC services
  15. might be missing or provided by a separate server).
  16. Collections
  17. -----------
  18. The collection table currently looks as follows (check the SQL file in the installation instructions for
  19. a more up to date version of it):
  20. .. code-block:: sql
  21. create table collection (
  22. "id" serial primary key,
  23. "name" varchar,
  24. "primary" boolean,
  25. "htmlDescription" text,
  26. "footprint" geography(Polygon, 4326),
  27. "timeStart" timestamp,
  28. "timeEnd" timestamp,
  29. "productCqlFilter" varchar,
  30. "masked" boolean,
  31. "eoIdentifier" varchar unique,
  32. "eoProductType" varchar,
  33. "eoPlatform" varchar,
  34. "eoPlatformSerialIdentifier" varchar,
  35. "eoInstrument" varchar,
  36. "eoSensorType" varchar check ("eoSensorType" in ('OPTICAL', 'RADAR', 'ALTIMETRIC', 'ATMOSPHERIC', 'LIMB')),
  37. "eoCompositeType" varchar,
  38. "eoProcessingLevel" varchar,
  39. "eoOrbitType" varchar,
  40. "eoSpectralRange" varchar,
  41. "eoWavelength" int,
  42. "eoSecurityConstraints" boolean,
  43. "eoDissemination" varchar,
  44. "eoAcquisitionStation" varchar,
  45. "queryables" varchar[],
  46. "workspaces" varchar[]
  47. );
  48. Most of the attributes should be rather self-explanatory to those familiar with OGC Earth Observation terminology.
  49. Each attribute prefixed by "eo" is exposed as a search attribute in OpenSearch, the structure can be modified
  50. by adding extra attributes and they will show up and made searchable.
  51. Specific attributes notes:
  52. * A ``primary`` collection is normally linked to a particular satellite/sensor and contains its own products.
  53. Setting "primary" to false makes the collection "virtual" and the ``productCQLFilter`` field should be filled with
  54. a CQL filter that will collect all the products in the collection (warning, virtual collections are largely
  55. untested at the moment)
  56. * The ``footprint`` field is used for spatial searches, while ``timeStart`` and ``timeEnd`` are used for
  57. temporal ones
  58. * The ``htmlDescription`` drives the generation of the visible part of the Atom OpenSearch response, see the
  59. dedicated section later to learn more about filling it
  60. * The ``workspaces`` field is an array used to specify the GeoServer workspaces that the collection is associated with.
  61. If the field is left empty or null, or if the array contains a null value, the collection will be associated with all
  62. workspaces. If the field is populated, the collection will only be associated with the specified workspaces and will
  63. be hidden from workspace specific STAC calls.
  64. The ``collection_ogclink`` table contains the OGC links towards the services providing visualization and
  65. download access to the collection contents. See the "OGC links" section to gather more information about it.
  66. Products
  67. --------
  68. The product table currently looks as follows (check the SQL file in the installation instructions for
  69. a more up to date version of it):
  70. .. code-block:: sql
  71. -- the products and attributes describing them
  72. create table product (
  73. "id" serial primary key,
  74. "htmlDescription" text,
  75. "footprint" geography(Polygon, 4326),
  76. "timeStart" timestamp,
  77. "timeEnd" timestamp,
  78. "originalPackageLocation" varchar,
  79. "originalPackageType" varchar,
  80. "thumbnailURL" varchar,
  81. "quicklookURL" varchar,
  82. "crs" varchar,
  83. "eoIdentifier" varchar unique,
  84. "eoParentIdentifier" varchar references collection("eoIdentifier") on delete cascade,
  85. "eoProductionStatus" varchar,
  86. "eoAcquisitionType" varchar check ("eoAcquisitionType" in ('NOMINAL', 'CALIBRATION', 'OTHER')),
  87. "eoOrbitNumber" int,
  88. "eoOrbitDirection" varchar check ("eoOrbitDirection" in ('ASCENDING', 'DESCENDING')),
  89. "eoTrack" int,
  90. "eoFrame" int,
  91. "eoSwathIdentifier" text,
  92. "optCloudCover" int check ("optCloudCover" between 0 and 100),
  93. "optSnowCover" int check ("optSnowCover" between 0 and 100),
  94. "eoProductQualityStatus" varchar check ("eoProductQualityStatus" in ('NOMINAL', 'DEGRADED')),
  95. "eoProductQualityDegradationStatus" varchar,
  96. "eoProcessorName" varchar,
  97. "eoProcessingCenter" varchar,
  98. "eoCreationDate" timestamp,
  99. "eoModificationDate" timestamp,
  100. "eoProcessingDate" timestamp,
  101. "eoSensorMode" varchar,
  102. "eoArchivingCenter" varchar,
  103. "eoProcessingMode" varchar,
  104. "eoAvailabilityTime" timestamp,
  105. "eoAcquisitionStation" varchar,
  106. "eoAcquisitionSubtype" varchar,
  107. "eoStartTimeFromAscendingNode" int,
  108. "eoCompletionTimeFromAscendingNode" int,
  109. "eoIlluminationAzimuthAngle" float,
  110. "eoIlluminationZenithAngle" float,
  111. "eoIlluminationElevationAngle" float,
  112. "sarPolarisationMode" varchar check ("sarPolarisationMode" in ('S', 'D', 'T', 'Q', 'UNDEFINED')),
  113. "sarPolarisationChannels" varchar check ("sarPolarisationChannels" in ('horizontal', 'vertical')),
  114. "sarAntennaLookDirection" varchar check ("sarAntennaLookDirection" in ('LEFT', 'RIGHT')),
  115. "sarMinimumIncidenceAngle" float,
  116. "sarMaximumIncidenceAngle" float,
  117. "sarDopplerFrequency" float,
  118. "sarIncidenceAngleVariation" float,
  119. "eoResolution" float
  120. );
  121. Notes on the attributes:
  122. * The ``footprint`` field is used for spatial searches, while ``timeStart`` and ``timeEnd`` are used for
  123. temporal ones
  124. * The ``htmlDescription`` drives the generation of the visible part of the Atom OpenSearch response, see the
  125. dedicated section later to learn more about filling it
  126. * The ``crs`` attribute is optional and is used only for automatic layer publishing for collections having
  127. heterogeneous CRS products. It must contain a "EPSG:XYWZ" expression (but the product footprint still
  128. need to be expressed in WGS84, east/north oriented).
  129. * The EO search attributes need to be filled according to the nature of the product, ``eo`` prefixes generic
  130. EOP attributes, ``opt`` optical ones, ``sar`` radar ones, ``atm`` altimetric, ``lmb`` limbic, ``ssp``
  131. Synthesis and Systematic Product. New attributes can be added based on the above prefixes (at the time
  132. of writing only optical and sar attributes have been tested)
  133. The ``product_thumb`` table contains the product thumbnail, in PNG or JPEG format, for display
  134. in the OpenSearch Atom output.
  135. The ``product_ogclink`` table contains the OGC links towards the services providing visualization and
  136. download access to the collection contents. See the "OGC links" section to gather more information about it.
  137. OGC links
  138. ---------
  139. The OpenSearch module implements "OGC cross linking" by adding pointers to OGC services
  140. for to collection/product visualization and download.
  141. .. code-block:: sql
  142. -- links for collections
  143. create table collection_ogclink (
  144. "lid" serial primary key,
  145. "collection_id" int references collection("id") on delete cascade,
  146. "offering" varchar,
  147. "method" varchar,
  148. "code" varchar,
  149. "type" varchar,
  150. "href" varchar
  151. );
  152. -- links for products
  153. create table product_ogclink (
  154. "lid" serial primary key,
  155. "product_id" int references product("id") on delete cascade,
  156. "offering" varchar,
  157. "method" varchar,
  158. "code" varchar,
  159. "type" varchar,
  160. "href" varchar
  161. );
  162. This is done by adding a set of ``owc:offering`` elements in the Atom response, mapping directly
  163. from the table contents:
  164. .. code-block:: xml
  165. <owc:offering code="http://www.opengis.net/spec/owc/1.0/req/atom/wcs">
  166. <owc:operation method="GET" code="GetCapabilities" href="http://localhost/sentinel2/sentinel2-TCI/ows?service=WCS&amp;version=2.0.1&amp;request=GetCapabilities" type="application/xml"/>
  167. </owc:offering>
  168. <owc:offering code="http://www.opengis.net/spec/owc/1.0/req/atom/wmts">
  169. <owc:operation method="GET" code="GetCapabilities" href="http://localhost/sentinel2/sentinel2-TCI/gwc/service/wmts?REQUEST=GetCapabilities" type="application/xml"/>
  170. </owc:offering>
  171. <owc:offering code="http://www.opengis.net/spec/owc/1.0/req/atom/wms">
  172. <owc:operation method="GET" code="GetCapabilities" href="http://localhost/sentinel2/sentinel2-TCI/ows?service=wms&amp;version=1.3.0&amp;request=GetCapabilities" type="application/xml"/>
  173. <owc:operation method="GET" code="GetMap" href="http://localhost/sentinel2/sentinel2:sentinel2-TCI/wms?SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;FORMAT=image%2Fjpeg&amp;STYLES&amp;LAYERS=sentinel2%3Asentinel2-TCI&amp;SRS=EPSG%3A4326&amp;WIDTH=800&amp;HEIGHT=600&amp;BBOX=-180%2C-90%2C180%2C90" type="image/jpeg"/>
  174. </owc:offering>
  175. The contents of the tables need to be filled with the sane named elements of a OWC offering,
  176. the ``href`` one can contain a ``${BASE_URL}`` variable that GeoServer will replace with its
  177. own base URL.
  178. The granule table
  179. -----------------
  180. The granule table can be filled with information about the actual raster files making up
  181. a certain product in order to publish the collection as a GeoServer image mosaic:
  182. .. code-block:: sql
  183. -- the granules table (might be abstract, and we can use partitioning)
  184. create table granule (
  185. "gid" serial primary key,
  186. "product_id" int not null references product("id") on delete cascade,
  187. "band" varchar,
  188. "location" varchar not null,
  189. "the_geom" geometry(Polygon, 4326) not null
  190. );
  191. The granules associated to a product can have different topologies:
  192. * A single raster file containing all the information about the product
  193. * Multiple raster files splitting the products spatially in regular tiles
  194. * Multiple raster files splitting the product wavelength wise
  195. * A mix of the two above
  196. Notes about the columns:
  197. * The ``band`` column need to be filled only for products split in several files by bands, at the time of
  198. writing it needs to be a progressive integer starting from 1 (the module will hopefully allow more meaningful band names in the future)
  199. * The ``location`` is the absolute path of the file
  200. * The ``the_geom`` field is a polygon in WGS84, regardless of what the actual footprint of the file is. The polygon must represent the rectangular extend of the raster file,
  201. not its valid area (masking is to be treated separately, either with sidecar mask files or with NODATA pixels)