Hi Jean,
I have this working on GeoServer 2.5.1. Here's what I do to add a granule to
my ImageMosaic+time and with a custom domain attribute:
1. Manually copy the granule, eg Granule_005_20140902_20.tif, to folder
file:///D:/Data/Imagery<file:///D:\Data\Imagery> which is where my ImageMosaic
store points to
2. Make an HTTP POST to GeoServer REST API as follows (I'm not using Curl
so you will need to adapt my solution but this should hopefully give you the
key to getting it to work):
a. Method: POST
b. URL:
http://localhost:<geoserver-port>/geoserver/rest/workspaces/<myworkspace>/coveragestores/<my-imagemosaic-store>/external.imagemosaic?recalculate=nativebbox,latlonbbox<http://localhost:%3cgeoserver-port%3e/geoserver/rest/workspaces/%3cmyworkspace%3e/coveragestores/%3cmy-imagemosaic-store%3e/external.imagemosaic?recalculate=nativebbox,latlonbbox>
c. Body (plain/text format):
file:///D:/Data/imagery/Granule_005_20140902_20.tif<file:///D:\Data\imagery\Granule_005_20140902_20.tif>
d. After I make this request the ImageMosaic spatial index is updated in
my Postgresql/PostGIS database
This technique is captured in the GeoServer REST API documentation at:
http://docs.geoserver.org/stable/en/user/rest/api/coveragestores.html
"If the coverage store is a simple one (e.g. GeoTiff) it will return a 405, if
the coverage store is a structured one (e.g., mosaic) it will harvest the
specified files into it, which in turn will integrate the files into the store.
Harvest meaning is store dependent, for mosaic the new files will be added as
new granules of the mosaic, and existing files will get their attribute
updated, other stores might have a different behavior."
NOTE: The granule does not need to be in the folder that the ImageMosaic
points to. In the HTTP request body you can specify a different location and
the granule is just reference from that location in the spatial index relative
to the folder pointed to by the ImageMosaic.
I would also be interested to hear if anybody has been able to add granules to
an ImageMosaic by uploading them through the REST API, I was unable to get this
to work
.
Hope that helps,
--Steve
From: Jean Pommier [mailto:jean.pomm...@pi-geosolutions.fr]
Sent: Thursday, September 11, 2014 2:58 AM
To: Max Stephan; geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Add data (granule) to an imagemosaic+time
Hi Max,
Yes, that's what I meant.
Are you certain about this 'manually edit the index' stuff ?
I don't get it : using REST DELETE command, you can remove a granule, and it is
removed from the index too.
But when you add a granule, it is not inserted in the index ? Isn't it the
point of adding a granule to the mosaic ?
Seems weird, doesn't it ?
Thanks,
Jean
Le 11/09/2014 11:33, Max Stephan a écrit :
Hi Jean,
if I understand you correctly, you have an existing time enabled image mosaic
and want to add new GeoTIFFs to it, yes?
As far as I am aware the Geoserver ImageMosaic module does not provide a
mechanism to update the granule index when new granules are added to the
ImageMosaic source directory. Instead you need to add the granules manually to
your granule index in your PostGIS table. You can do this automated through a
Script for example. This script would need to extract the respective parameters
from the new granules (time dimension from filename, geographical extent from
GeoTIFF, path) and write it to a new row in your granule index table (if the
extent is the same for all of your granules you could also simply copy over the
geometry from a previous granule).
Alternatively you would have to recreate the ImageMosaic every time you add new
granules to it (which would require deleting the granule index table and
deleting the supplementary files that GeoServer creates on ImageMosaic creation
before recreating the ImageMosaic).
Regards,
Max
________________________________
Von: Jean Pommier
<jean.pomm...@pi-geosolutions.fr><mailto:jean.pomm...@pi-geosolutions.fr>
Gesendet: Donnerstag, 11. September 2014 08:44
An:
geoserver-users@lists.sourceforge.net<mailto:geoserver-users@lists.sourceforge.net>
Betreff: [Geoserver-users] Add data (granule) to an imagemosaic+time
Hi list,
I've got an imagemosaic constituted of several NDVI geotiffs (using time
dimension).
It works very well, but I'm stuck at the "add new data" step.
I've tried several ways : curl
(http://docs.geoserver.org/2.5.x/en/user/rest/examples/curl.html), gsconfig.
Digging in the REST API, I guess it should have been
curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip"
--data-binary @dv2011.zip
"http://pigeo.fr/geoserver-prod/rest/workspaces/pigeo/coveragestores/NDVI/file.imagemosaic
(the zip file containing my new geotiff file)
Actually, it did add the data in the repository, but didn't update the index.
So it's not really added, just copied in the folder.
I've even tried with several versions of geoserver (2.4.2, 2.5.2, 2.6.RC1) with
no changes. So I guess I'm mistaken somewhere in my process.
My data are geotiffs, all the same. I'm running geoserver under tomcat7, java 7
oracle.
The mosaic index is stored in a postgis DB.
Any help, please ? Do I need to install some extension ?
Have a nice day,
Jean
--
[cid:image001.png@01CFCDA0.8C1E4850]
Jean Pommier -- pi-Geosolutions
Ingénieur, consultant indépendant
Tél. : (+33) 6 09 23 21 36
E-mail : j...@pi-geosolutions.fr<mailto:j...@pi-geosolutions.fr>
Web : www.pi-geosolutions.fr<http://www.pi-geosolutions.fr>
--
[cid:image001.png@01CFCDA0.8C1E4850]
Jean Pommier -- pi-Geosolutions
Ingénieur, consultant indépendant
Tél. : (+33) 6 09 23 21 36
E-mail : j...@pi-geosolutions.fr<mailto:j...@pi-geosolutions.fr>
Web : www.pi-geosolutions.fr<http://www.pi-geosolutions.fr>
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users