imagemosaic.rst 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. .. _rest_imagemosaic:
  2. Uploading a new image mosaic
  3. ----------------------------
  4. **Upload a ZIP file containing a mosaic definition and granule(s)**
  5. *Request*
  6. .. admonition:: curl
  7. ::
  8. curl -u admin:geoserver -XPUT -H "Content-type:application/zip" --data-binary @polyphemus.zip
  9. http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus/file.imagemosaic
  10. *Response*
  11. ::
  12. 200 OK
  13. Updating an image mosaic contents
  14. ---------------------------------
  15. **Harvest (or reharvest) a single file into the mosaic and update the mosaic index**
  16. *Request*
  17. .. admonition:: curl
  18. ::
  19. curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d "file:///path/to/the/file/polyphemus_20130302.nc"
  20. "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/poly-incremental/external.imagemosaic"
  21. *Response*
  22. ::
  23. 201 Created
  24. **Harvest (or reharvest) a whole directory into the mosaic and update the mosaic index**
  25. *Request*
  26. .. admonition:: curl
  27. ::
  28. curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d "file:///path/to/the/mosaic/folder"
  29. "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/poly-incremental/external.imagemosaic"
  30. *Response*
  31. ::
  32. 201 Created
  33. Listing image mosaic details
  34. ----------------------------
  35. **Retrieve the image mosaic index structure**
  36. *Request*
  37. .. admonition:: curl
  38. ::
  39. curl -v -u admin:geoserver -XGET "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus-v1/coverages/NO2/index.xml"
  40. *Response*
  41. .. code-block:: xml
  42. <Schema>
  43. <attributes>
  44. <Attribute>
  45. <name>the_geom</name>
  46. <minOccurs>0</minOccurs>
  47. <maxOccurs>1</maxOccurs>
  48. <nillable>true</nillable>
  49. <binding>org.locationtech.jts.geom.Polygon</binding>
  50. </Attribute>
  51. <Attribute>
  52. <name>location</name>
  53. <minOccurs>0</minOccurs>
  54. <maxOccurs>1</maxOccurs>
  55. <nillable>true</nillable>
  56. <binding>java.lang.String</binding>
  57. </Attribute>
  58. <Attribute>
  59. <name>imageindex</name>
  60. <minOccurs>0</minOccurs>
  61. <maxOccurs>1</maxOccurs>
  62. <nillable>true</nillable>
  63. <binding>java.lang.Integer</binding>
  64. </Attribute>
  65. <Attribute>
  66. <name>time</name>
  67. <minOccurs>0</minOccurs>
  68. <maxOccurs>1</maxOccurs>
  69. <nillable>true</nillable>
  70. <binding>java.sql.Timestamp</binding>
  71. </Attribute>
  72. <Attribute>
  73. <name>elevation</name>
  74. <minOccurs>0</minOccurs>
  75. <maxOccurs>1</maxOccurs>
  76. <nillable>true</nillable>
  77. <binding>java.lang.Double</binding>
  78. </Attribute>
  79. <Attribute>
  80. <name>fileDate</name>
  81. <minOccurs>0</minOccurs>
  82. <maxOccurs>1</maxOccurs>
  83. <nillable>true</nillable>
  84. <binding>java.sql.Timestamp</binding>
  85. </Attribute>
  86. <Attribute>
  87. <name>updated</name>
  88. <minOccurs>0</minOccurs>
  89. <maxOccurs>1</maxOccurs>
  90. <nillable>true</nillable>
  91. <binding>java.sql.Timestamp</binding>
  92. </Attribute>
  93. </attributes>
  94. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus-v1/coverages/NO2/index/granules.xml" type="application/xml"/>
  95. </Schema>
  96. **Retrieve the existing granule information**
  97. *Request*
  98. .. admonition:: curl
  99. ::
  100. curl -v -u admin:geoserver -XGET "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus-v1/coverages/NO2/index/granules.xml?limit=2"
  101. *Response*
  102. .. code-block:: xml
  103. <?xml version="1.0" encoding="UTF-8"?>
  104. <wfs:FeatureCollection xmlns:gf="http://www.geoserver.org/rest/granules" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml">
  105. <gml:boundedBy>
  106. <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
  107. <gml:coord>
  108. <gml:X>5.0</gml:X>
  109. <gml:Y>45.0</gml:Y>
  110. </gml:coord>
  111. <gml:coord>
  112. <gml:X>14.875</gml:X>
  113. <gml:Y>50.9375</gml:Y>
  114. </gml:coord>
  115. </gml:Box>
  116. </gml:boundedBy>
  117. <gml:featureMember>
  118. <gf:NO2 fid="NO2.1">
  119. <gf:the_geom>
  120. <gml:Polygon>
  121. <gml:outerBoundaryIs>
  122. <gml:LinearRing>
  123. <gml:coordinates>5.0,45.0 5.0,50.9375 14.875,50.9375 14.875,45.0 5.0,45.0</gml:coordinates>
  124. </gml:LinearRing>
  125. </gml:outerBoundaryIs>
  126. </gml:Polygon>
  127. </gf:the_geom>
  128. <gf:location>polyphemus_20130301.nc</gf:location>
  129. <gf:imageindex>336</gf:imageindex>
  130. <gf:time>2013-03-01T00:00:00Z</gf:time>
  131. <gf:elevation>10.0</gf:elevation>
  132. <gf:fileDate>2013-03-01T00:00:00Z</gf:fileDate>
  133. <gf:updated>2013-04-11T10:54:31Z</gf:updated>
  134. </gf:NO2>
  135. </gml:featureMember>
  136. <gml:featureMember>
  137. <gf:NO2 fid="NO2.2">
  138. <gf:the_geom>
  139. <gml:Polygon>
  140. <gml:outerBoundaryIs>
  141. <gml:LinearRing>
  142. <gml:coordinates>5.0,45.0 5.0,50.9375 14.875,50.9375 14.875,45.0 5.0,45.0</gml:coordinates>
  143. </gml:LinearRing>
  144. </gml:outerBoundaryIs>
  145. </gml:Polygon>
  146. </gf:the_geom>
  147. <gf:location>polyphemus_20130301.nc</gf:location>
  148. <gf:imageindex>337</gf:imageindex>
  149. <gf:time>2013-03-01T00:00:00Z</gf:time>
  150. <gf:elevation>35.0</gf:elevation>
  151. <gf:fileDate>2013-03-01T00:00:00Z</gf:fileDate>
  152. <gf:updated>2013-04-11T10:54:31Z</gf:updated>
  153. </gf:NO2>
  154. </gml:featureMember>
  155. </wfs:FeatureCollection>
  156. Removing image mosaic granules
  157. ------------------------------
  158. **Remove all the granules originating from a particular file**
  159. *Request*
  160. .. admonition:: curl
  161. ::
  162. curl -v -u admin:geoserver -XDELETE "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus-v1/coverages/NO2/index/granules.xml?filter=location='polyphemus_20130301.nc'"
  163. *Response*
  164. ::
  165. 200 OK
  166. Uploading an empty mosaic
  167. -------------------------
  168. **Upload an archive with the definition of an mosaic, but with no granules**
  169. Given a :download:`empty.zip <artifacts/empty.zip>` file containing:
  170. * ``datastore.properties`` (PostGIS connection parameters)
  171. * ``indexer.xml`` (Mosaic indexer; note the ``CanBeEmpty=true`` parameter)
  172. * ``polyphemus-test.xml`` (Auxiliary file used by the NetCDF reader to parse schemas and tables)
  173. .. warning:: Make sure to update the ``datastore.properties`` file with your connection parameters and refresh the ZIP before uploading it.
  174. *Request*
  175. .. admonition:: curl
  176. ::
  177. curl -u admin:geoserver -XPUT -H "Content-type:application/zip" --data-binary @empty.zip
  178. http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/empty/file.imagemosaic?configure=none
  179. .. note:: The ``configure=none`` parameter allows for future configuration after harvesting.
  180. *Response*
  181. ::
  182. 200 OK
  183. **Configure a coverage on the mosaic**
  184. Given a ``coverageconfig.xml``:
  185. .. code-block:: xml
  186. <coverage>
  187. <nativeCoverageName>NO2</nativeCoverageName>
  188. <name>NO2</name>
  189. </coverage>
  190. *Request*
  191. .. admonition:: curl
  192. ::
  193. curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d @"/path/to/coverageconfig.xml" "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/empty/coverages"
  194. .. note:: When specifying only the coverage name, the coverage will be automatically configured.
  195. *Response*
  196. ::
  197. 201 Created