.. _rest_imagemosaic:
Uploading a new image mosaic
----------------------------
**Upload a ZIP file containing a mosaic definition and granule(s)**
*Request*
.. admonition:: curl
::
curl -u admin:geoserver -XPUT -H "Content-type:application/zip" --data-binary @polyphemus.zip
http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus/file.imagemosaic
*Response*
::
200 OK
Updating an image mosaic contents
---------------------------------
**Harvest (or reharvest) a single file into the mosaic and update the mosaic index**
*Request*
.. admonition:: curl
::
curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d "file:///path/to/the/file/polyphemus_20130302.nc"
"http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/poly-incremental/external.imagemosaic"
*Response*
::
201 Created
**Harvest (or reharvest) a whole directory into the mosaic and update the mosaic index**
*Request*
.. admonition:: curl
::
curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d "file:///path/to/the/mosaic/folder"
"http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/poly-incremental/external.imagemosaic"
*Response*
::
201 Created
Listing image mosaic details
----------------------------
**Retrieve the image mosaic index structure**
*Request*
.. admonition:: curl
::
curl -v -u admin:geoserver -XGET "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus-v1/coverages/NO2/index.xml"
*Response*
.. code-block:: xml
the_geom
0
1
true
com.vividsolutions.jts.geom.Polygon
location
0
1
true
java.lang.String
imageindex
0
1
true
java.lang.Integer
time
0
1
true
java.sql.Timestamp
elevation
0
1
true
java.lang.Double
fileDate
0
1
true
java.sql.Timestamp
updated
0
1
true
java.sql.Timestamp
**Retrieve the existing granule information**
*Request*
.. admonition:: curl
::
curl -v -u admin:geoserver -XGET "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus-v1/coverages/NO2/index/granules.xml?limit=2"
*Response*
.. code-block:: xml
5.0
45.0
14.875
50.9375
5.0,45.0 5.0,50.9375 14.875,50.9375 14.875,45.0 5.0,45.0
polyphemus_20130301.nc
336
2013-03-01T00:00:00Z
10.0
2013-03-01T00:00:00Z
2013-04-11T10:54:31Z
5.0,45.0 5.0,50.9375 14.875,50.9375 14.875,45.0 5.0,45.0
polyphemus_20130301.nc
337
2013-03-01T00:00:00Z
35.0
2013-03-01T00:00:00Z
2013-04-11T10:54:31Z
Removing image mosaic granules
------------------------------
**Remove all the granules originating from a particular file**
*Request*
.. admonition:: curl
::
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'"
*Response*
::
200 OK
Uploading an empty mosaic
-------------------------
**Upload an archive with the definition of an mosaic, but with no granules**
Given a :download:`empty.zip ` file containing:
* ``datastore.properties`` (PostGIS connection parameters)
* ``indexer.xml`` (Mosaic indexer; note the ``CanBeEmpty=true`` parameter)
* ``polyphemus-test.xml`` (Auxiliary file used by the NetCDF reader to parse schemas and tables)
.. warning:: Make sure to update the ``datastore.properties`` file with your connection parameters and refresh the ZIP before uploading it.
*Request*
.. admonition:: curl
::
curl -u admin:geoserver -XPUT -H "Content-type:application/zip" --data-binary @empty.zip
http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/empty/file.imagemosaic?configure=none
.. note:: The ``configure=none`` parameter allows for future configuration after harvesting.
*Response*
::
200 OK
**Configure a coverage on the mosaic**
Given a ``coverageconfig.xml``:
.. code-block:: xml
NO2
NO2
*Request*
.. admonition:: curl
::
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"
.. note:: When specifying only the coverage name, the coverage will be automatically configured.
*Response*
::
201 Created