[Geoserver-users] geoserver REST API imagemosaic

Hi all,

I am using geoserver 2.6.1 and spent some time on getting used with the REST API. I basically followed REST examples for cURL from here:
http://docs.geoserver.org/stable/en/user/rest/examples/curl.html

I managed to define and configure a new image mosaic via

curl -u admin:geoserver -XPUT -H "Content-type:application/zip" --data-binary @testmosaic.zip http://<IPaddress>/geoserver/rest/workspaces/myworkspace/coveragestores/testmosaic/file.imagemosaic

The difference to the curl example from the geoserver docs is just the location of the geoserver. I run the curl command from my local machine. The geoserver is running on another machine within the local network. But everything worked fine.
But it another story when I want to harvest another file to an existing imagemosaic. The geoserver docs give the following command, which I adapted for my configuration:

curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d file:///path/to/the/file/newfile.tif http://<IPaddress>/geoserver/rest/workspaces/myworkspace/coveragestores/testmosaic/external.imagemosaic

Here I get an error that the file 'file:///path/to/the/file/newfile.tif ’ was not found, when I run the command from my local machine with a file path on my local machine.

If I transfer the image file to the geoserver machine and run the command directly on the geoserver machine the file is harvested to the imagemosaic without problems.

My question: is there a possibility to harvest new files from my local machine to an existing imagemosaic when the geoserver is not running on the local machine but on another machine within the local network? Or is that procedure not intended?

Kind regards,
Sabine Ohlendorf

Hi Sabine,

sorry for the delay. If you want to harvest a local file from to a GeoServer located into another machine you can use two methods:

  • Mount a storage pointing to your local machine on the GeoServer machine and harvest the file using the “external.imagemosaic” extension.
  • Zip the file to harvest and then harvest it using the “file.imagemosaic” extension. You have to use the zip file because otherwise you can’t mantain the filename and this could be bad in cas of ImageMosaic with external dimensions. Note that you have to set the Content-type to “application/zip”
    Using the “external.imagemosaic” extension requires that the file is reachable from the GeoServer machine; using “file.imagemosaic” instead allows to move your files into the Store directory.

Hoping it could help.

Regards,
Nicola Lagomarsini.

···

2015-01-16 15:07 GMT+01:00 Sabine Ohlendorf <sabine.ohlendorf@anonymised.com>:

Hi all,

I am using geoserver 2.6.1 and spent some time on getting used with the REST API. I basically followed REST examples for cURL from here:
http://docs.geoserver.org/stable/en/user/rest/examples/curl.html

I managed to define and configure a new image mosaic via

curl -u admin:geoserver -XPUT -H "Content-type:application/zip" --data-binary @testmosaic.zip http://<IPaddress>/geoserver/rest/workspaces/myworkspace/coveragestores/testmosaic/file.imagemosaic

The difference to the curl example from the geoserver docs is just the location of the geoserver. I run the curl command from my local machine. The geoserver is running on another machine within the local network. But everything worked fine.
But it another story when I want to harvest another file to an existing imagemosaic. The geoserver docs give the following command, which I adapted for my configuration:

curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d file:///path/to/the/file/newfile.tif http://<IPaddress>/geoserver/rest/workspaces/myworkspace/coveragestores/testmosaic/external.imagemosaic

Here I get an error that the file 'file:///path/to/the/file/newfile.tif ’ was not found, when I run the command from my local machine with a file path on my local machine.

If I transfer the image file to the geoserver machine and run the command directly on the geoserver machine the file is harvested to the imagemosaic without problems.

My question: is there a possibility to harvest new files from my local machine to an existing imagemosaic when the geoserver is not running on the local machine but on another machine within the local network? Or is that procedure not intended?

Kind regards,
Sabine Ohlendorf


New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Nicola Lagomarsini
Junior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

Hi Nicola,

thank you very much for your response. I managed to harvest a file as a zipfile by using the "file.imagemosaic" extension. Great!

Just a comment for all who also want to harvest files to a GeoServer located on another machine: It is necessary to use the @-sign within the curl command.
curl -v -u admin:geoserver -XPOST -H "Content-type:application/zip" --data-binary @///path/to/the/zipfile/update.zip http://<IPaddress>/geoserver/rest/workspaces/myworkspace/coveragestores/testmosaic/file.imagemosaic

Otherwise the zipfile is not fully uploaded which results in an error.

Regards,
Sabine

Gesendet: Mittwoch, 21. Januar 2015 um 14:00 Uhr
Von: "Nicola Lagomarsini" <nicola.lagomarsini@anonymised.com>
An: "Sabine Ohlendorf" <sabine.ohlendorf@anonymised.com>
Cc: "geoserver-users@lists.sourceforge.net" <geoserver-users@anonymised.comrceforge.net>
Betreff: Re: [Geoserver-users] geoserver REST API imagemosaic

Hi Sabine,

sorry for the delay. If you want to harvest a local file from to a GeoServer located into another machine you can use two methods:

Mount a storage pointing to your local machine on the GeoServer machine and harvest the file using the "external.imagemosaic" extension.
Zip the file to harvest and then harvest it using the "file.imagemosaic" extension. You have to use the zip file because otherwise you can't mantain the filename and this could be bad in cas of ImageMosaic with external dimensions. Note that you have to set the Content-type to "application/zip"
Using the "external.imagemosaic" extension requires that the file is reachable from the GeoServer machine; using "file.imagemosaic" instead allows to move your files into the Store directory.

Hoping it could help.

Regards,
Nicola Lagomarsini.