data-store.rst 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. .. _stac_data_store:
  2. STAC data store
  3. =================
  4. Configuring a Store
  5. -------------------
  6. In addition to the parameters common to each ``DataStore`` configuration such as ``workspace``, ``name`` and ``description``, and the common HTTP connector parameters, such as connection pooling, using GZIP, user name and password, the page shows the following connection parameters in the dedicated section:
  7. * ``landingPage``: this should point to the landing page of the target STAC API
  8. * ``fetchSize``: how many items the store will try to fetch per page. The actual number is in control of the server, the store will simply try to suggest this value.
  9. * ``featureTypeItems``: how many items to read in order to guess the structure of the feature type (GeoServer in general needs a predictable structure)
  10. * ``hardLimit``: maximum amount of items to fetch from the STAC store, in any request (it's a good idea to pose a limit, as many STAC APIs host millions of items, and the data transfer is not particularly efficient due to the large size of items, and the paged transfer)
  11. .. figure:: images/configuration.png
  12. STAC datastore configuration
  13. STAC items are multi-temporal, so it's advisable to configure the time dimension when setting
  14. up the layer, using the ``datetime`` attribute. This will allow time navigation and reduce the
  15. number of items returned to a more manageable subset:
  16. .. figure:: images/time-vector.png
  17. Setting up time for the layers
  18. Mosaicking images from a STAC store
  19. -----------------------------------
  20. STAC items may point to actual image files among its "assets" data structure. Assets are a top
  21. level object, not part of the Feature properties, that the store makes available to the image mosaic
  22. for image mosaicking purposes. The images in question must be Cloud Optimized GeoTIFFs and the
  23. COG plugin must be installed in GeoServer.
  24. The STAC store can then be used as the index of an image mosaic, setting up two configuration files:
  25. * A ``datastore.properties`` pointing at the configured STAC server.
  26. * A ``indexer.properties`` indicating the collection to use, setup for the COG usage, and the location of the asset providing the images.
  27. Simple mosaic setup
  28. ~~~~~~~~~~~~~~~~~~~
  29. Here is an example ``datastore.properties``, pointing at an existing STAC store already configured in GeoServer::
  30. StoreName=stac\:dlr-eoc
  31. And here is an ``indexer.properties``::
  32. MosaicCRS=EPSG\:4326
  33. TimeAttribute=datetime
  34. AbsolutePath=true
  35. Name=WSF_2019
  36. Cog=true
  37. Heterogeneous=true
  38. HeterogeneousCRS=false
  39. TypeName=WSF_2019
  40. UseExistingSchema=true
  41. LocationAttribute=assets/wsf2019/href
  42. MaxInitTiles=10
  43. Notes about the file contents:
  44. * The time dimension is set up and linked to the ``datetime`` attribute
  45. * The mosaic is setup to allow heterogeneous resolution images, but in this particular case, assumes that all images are in the same CRS.
  46. * The ``TypeName`` property points to the target STAC collection.
  47. * The ``LocationAttribute`` uses a JSONPointer to the desired asset URL.
  48. * ``MaxInitTiles`` is configured so that the image mosaic does not try to scan the entire index to figure out
  49. a common image structure, only the first 10 items returned by the STAC API will be used for auto-configuration.
  50. Multi-band mosaic setup
  51. ~~~~~~~~~~~~~~~~~~~~~~~
  52. It's also possible to mosaic images whose bands are offered as separate images and in different
  53. coordinate reference systems, with a more complex setup. Here is an example for a false color
  54. Sentinel 2 mosaic, using a coverage view to merge the images back into a single RGB composite.
  55. The ``datastore.properties`` configures two new properties, enabling query caching (as the coverage
  56. view machinery will load each band in turn, repeating the same queries)::
  57. StoreName=stac\:dlr-loose
  58. QueryCacheMaxAge=10000
  59. QueryCacheMaxFeatures=1000
  60. The indexer must instead be provided in XML format, to configure multiple coverage and their
  61. attributes:
  62. .. code-block:: xml
  63. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  64. <Indexer>
  65. <domains>
  66. <domain name="time">
  67. <attributes><attribute>datetime</attribute></attributes>
  68. </domain>
  69. <domain name="crs">
  70. <attributes><attribute>proj:epsg</attribute></attributes>
  71. </domain>
  72. </domains>
  73. <coverages>
  74. <coverage>
  75. <name>B04</name>
  76. <domains>
  77. <domain ref="time" />
  78. <domain ref="crs" />
  79. </domains>
  80. <parameters>
  81. <parameter name="LocationAttribute" value="assets/B04/href" />
  82. </parameters>
  83. </coverage>
  84. <coverage>
  85. <name>B03</name>
  86. <domains>
  87. <domain ref="time" />
  88. <domain ref="crs" />
  89. </domains>
  90. <parameters>
  91. <parameter name="LocationAttribute" value="assets/B03/href" />
  92. </parameters>
  93. </coverage>
  94. <coverage>
  95. <name>B02</name>
  96. <domains>
  97. <domain ref="time" />
  98. <domain ref="crs" />
  99. </domains>
  100. <parameters>
  101. <parameter name="LocationAttribute" value="assets/B02/href" />
  102. </parameters>
  103. </coverage>
  104. </coverages>
  105. <parameters>
  106. <parameter name="MosaicCRS" value="EPSG:4326" />
  107. <parameter name="AbsolutePath" value="true" />
  108. <parameter name="Cog" value="true" />
  109. <parameter name="Heterogeneous" value="true" />
  110. <parameter name="HeterogeneousCRS" value="true" />
  111. <parameter name="UseExistingSchema" value="true" />
  112. <parameter name="TypeName" value="S2_L2A_MSI_COG" />
  113. <parameter name="MaxInitTiles" value="10"/>
  114. </parameters>
  115. </Indexer>
  116. Some notes about the configuration:
  117. * The time and crs attributes are declared as dimensions.
  118. * Each coverage has a different ``LocationAttribute`` specification.
  119. * The mosaic heterogeneous CRS support is enabled.
  120. Once the mosaic is configured in GeoServer, create a new coverage view setting up the bands
  121. according to the desired order:
  122. .. figure:: images/coverage-view.png
  123. Creating a coverage view from a multi-band mosaic
  124. Also remember to configure the time dimension for this layer, for the same reasons explained
  125. in the vector data section above.