Hi Jean,

I tried adding a granule the way you did it with "PUT" and Curl and it replaced 
my ImageMosaic completely (which is what a PUT request is supposed to do).  
After deleting and recreating the ImageMosaic I tried "POST" instead and it 
worked in the sense that it updated my spatial index for my existing 
ImageMosaic.

So I used your URL with the following alterations:

1.       Used "POST" HTTP method instead of "PUT"

2.       Added query parameter to the end of the URL:  
?recalculate=nativebbox,latlonbbox

I think I know what is happening in your case.  Instead of adding a granule you 
are effectively replacing the ImageMosaic with the contents of the zip file 
that you provide and the ImageMosaic takes that zip file's base folder as its 
new working folder, that is, where the indexer, datastore, and regex property 
files are expected to be.  So try "POST" instead and it should work for you too.

Hope that solves it for you and thanks, you helped me solve my problem too!
--Steve

From: Jean Pommier [mailto:[email protected]]
Sent: Thursday, September 11, 2014 11:59 AM
To: Stephen Brooke; Max Stephan; [email protected]
Subject: Re: [Geoserver-users] Add data (granule) to an imagemosaic+time

Hi Steve,

Thanks for your answer, it gives me hope.
My issue is complementary with yours :
1) I manage to upload the granule using HTTP PUT. In cURL, it would read:
curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip" 
--data-binary @20130101_DV.tif.zip 
"http://localhost:8081/geoserver26RC1/rest/workspaces/pigeo/coveragestores/ndvi/file.imagemosaic";<http://localhost:8081/geoserver26RC1/rest/workspaces/pigeo/coveragestores/ndvi/file.imagemosaic>
Note that you have to put your files into a zip archive (saw it in the docs)
It does copy the file in my imagemosaic folder.

you would have expected it would update the index, but it doesn't

2) It did try the same request as you outlined, but in cURL. It's not much 
different, and indeed documented. But on my instance, it doesn't do anything at 
all. I do get a 202, no error, but nothing happens
I'll try tomorrow with other sets of data, maybe it my geotiff files having 
something weird inside (but the initial image mosaic generation is fine, so I 
would say the files are fine)

If you try the PUT request (upload), I'd be interested to know what it does on 
your instance. Will it recompute the index on the fly ?
Next episode tomorrow...

Jean
Le 11/09/2014 18:30, Stephen Brooke a écrit :
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:%5CData%5CImagery> 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:%5CData%5Cimagery%5CGranule_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:[email protected]]
Sent: Thursday, September 11, 2014 2:58 AM
To: Max Stephan; 
[email protected]<mailto:[email protected]>
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 
<[email protected]><mailto:[email protected]>
Gesendet: Donnerstag, 11. September 2014 08:44
An: 
[email protected]<mailto:[email protected]>
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:[email protected]]

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : (+33) 6 09 23 21 36
E-mail : [email protected]<mailto:[email protected]>
Web : www.pi-geosolutions.fr<http://www.pi-geosolutions.fr>

--
[cid:[email protected]]

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : (+33) 6 09 23 21 36
E-mail : [email protected]<mailto:[email protected]>
Web : www.pi-geosolutions.fr<http://www.pi-geosolutions.fr>

--
[cid:[email protected]]

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : (+33) 6 09 23 21 36
E-mail : [email protected]<mailto:[email protected]>
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to