Many thanks, Peter - this is what I needed.
As of now I will go with reindexing the whole layer. It seems that the
operation is taking less than a second so this is pretty fine for my
requirements.
Cheers,
Ivan
Date: Wed, 1 Jun 2016 08:50:29 +0200
From: Peter Kovac <peter.kovac@anonymised.com>
Subject: Re: [Geoserver-users] Reload ImageMosaic store via Rest API
To: geoserver-users@lists.sourceforge.net
Message-ID: <bdf8269e-5bf2-7158-bd7c-10a75a5d089b@anonymised.com>
Content-Type: text/plain; charset="windows-1252"
Hi Ivan,
what you want to do is what ImageMosaic calls "reindexing granules".
You can reindex the whole layer, but it is time consuming and
inefficient, because GeoServer will reexamine each granule (individual
GeoTIFF raster) and delete it from the index or add it to the index. It
might take a couple of minutes and performance for ordinary WMS requests
drops badly during that period.
curl -v -u username:password -XPOST -H "Content-type: text/plain" \
-d "file:/path/to/dir/with/geotiff/files/" \
"http://localhost:8080/geoserver/rest/workspaces/<MY\-WORKSPACE>/coveragestores/<my\-store>/external\.imagemosaic
<http://localhost:8080/geoserver/rest/workspaces/POVAPSYS/coveragestores/aladin_test3temperature/external.imagemosaic>"
Much better approach (at least in my scenario) is to index each granule
individually just when the file is ready and is copied to the ImageMosaic
directory.
curl -v -u username:password -XPOST -H "Content-type: text/plain" \
-d "file:/path/to/dir/with/geotiff/files/your_file.tiff" \
"http://localhost:8080/geoserver/rest/workspaces/<MY\-WORKSPACE>/coveragestores/<my\-store>/external\.imagemosaic"
Use another REST call to delete old granules. You can use filter to e.g.
delete all granules older than 1st January 2016 (assuming you use the time
dimension).
curl -u "user:pass" -XDELETE
"http://localhost:8080/geoserver/rest/workspaces/<MY\-WORKSPACE>/coveragestores/<my\-store>/coverages/<my\-layer>/index/granules\.xml?filter=time%20BEFORE%202016\-01\-01T00:00:00Z
<http://localhost:8080/geoserver/rest/workspaces/RADMON/coveragestores/radmon_short_range/coverages/short_range/index/granules.xml?filter=time%20BEFORE%202016-01-01T00:00:00Z>"
Useful resources are online tutorial by GeoSolutions (
http://geoserver.geo-solutions.it/multidim/en/index.html ) and REST API
docs (
http://docs.geoserver.org/stable/en/user/rest/api/coverages.html#structured-coverages
).
Peter
On 31. 5. 2016 16:14, Ivan Kotev wrote:
Hello All,
This might be quite trivial but I cannot seem to be able to figure it
out based on the Rest API documentation.I have several ImageMosaic stores (each of them has exactly 1 layer)
which are in turn backed by GeoTIFF data files. Every few hours I
refresh the data by uploading new GeoTIFF files and removing the old
ones (external operation to GeoServer).I am looking for a Rest API based approach to the reload the data for
a particular ImageMosaic store. Currently what I am doing is:"POST /geoserver/rest/reload", followed by:
"POST /geoserver/rest/reset"This seems to be working but it reloads the data for *all* datastores
which is a bit of overkill.Is there a Rest API to reload the data for a given ImageMosaic
store/layer?Thanks much in advance.
Cheers,
Ivan