[Geoserver-users] Reload ImageMosaic store via Rest API

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

Hi Ivan,

We’ve had a project dig into the ImageMosaic plugin recently.

What happens if you use the GeoServer UI to re-‘save’ the ImageMosaic layer? I’ve seen that reload just the datastores and layers associated.

If that doesn’t work for the plugin, there may be a small bit of work required to clean things up so that it does.

Cheers,

Jim

···

On 05/31/2016 10:14 AM, 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

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. [https://ad.doubleclick.net/ddm/clk/305295220;132659582;e](https://ad.doubleclick.net/ddm/clk/305295220;132659582;e)
_______________________________________________
Geoserver-users mailing list
[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)

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/](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

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. [https://ad.doubleclick.net/ddm/clk/305295220;132659582;e](https://ad.doubleclick.net/ddm/clk/305295220;132659582;e)
_______________________________________________
Geoserver-users mailing list
[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@anonymised.comsourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)

-- 
Peter Kovac
IMS Programmer
MicroStep-MIS
[peter.kovac@anonymised.com](mailto:peter.kovac@anonymised.com)