[Geoserver-users] Adding imageMosaic with time via REST

Hi all!

I’ve been trying to use geoserver’s REST API to add automatically various raster files and publish them. These raster files have a time parameter so I have to use the image mosaic plugin with the corresponding property files (indexer, timeregex and datastore)

I’ve tried doing the curl request by using a zip file with all required geotiffs and property files but it returns a 500 that, after having a look at geoserver log translates to:

http://pastebin.com/hCrvEm1L

I’ve checked the zip file and it’s not corrupted so I don’t really know how to continue that way.

Here are the curl commands i execute, the first one creates the coveragestore in a certain workspace and the second one is supposed to upload the layers:

curl -u admin:geoserver -v -XPOST -H ‘Content-Type: application/xml’
-d ‘wind_spe
edwind
true’
http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores

curl -u admin:geoserver -v -XPUT -H ‘Content-type: application/zip’
-d ‘file:/home/mgonzalez/apache-tomcat-7.0.41/webapps/geoserver/data/data/wind/wind_speed.zip’
http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores/wind_speed/file.imagemosaic?coverageName=wind_speed

I would very much appreciate if you could help me with this :slight_smile: Thank you!

Why is it that we rejoice at a birth and grieve at a funeral? It is because we
are not the person involved.
– Mark Twain, “Pudd’nhead Wilson’s Calendar”

Hi all!

I’ve been trying to use geoserver’s REST API to add automatically various raster files and publish them. These raster files have a time parameter so I have to use the image mosaic plugin with the corresponding property files (indexer, timeregex and datastore)

I’ve tried doing the curl request by using a zip file with all required geotiffs and property files but it returns a 500 that, after having a look at geoserver log translates to:

http://pastebin.com/hCrvEm1L

I’ve checked the zip file and it’s not corrupted so I don’t really know how to continue that way.

Here are the curl commands i execute, the first one creates the coveragestore in a certain workspace and the second one is supposed to upload the layers:

curl -u admin:geoserver -v -XPOST -H ‘Content-Type: application/xml’
-d ‘wind_spe
edwind
true’
http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores

curl -u admin:geoserver -v -XPUT -H ‘Content-type: application/zip’
-d ‘file:/home/mgonzalez/apache-tomcat-7.0.41/webapps/geoserver/data/data/wind/wind_speed.zip’
http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores/wind_speed/file.imagemosaic?coverageName=wind_speed

I would very much appreciate if you could help me with this :slight_smile: Thank you!

Why is it that we rejoice at a birth and grieve at a funeral? It is because we
are not the person involved.
– Mark Twain, “Pudd’nhead Wilson’s Calendar”

On Mon, Jul 22, 2013 at 11:40 AM, Mikel Gonzalez Gainza <fingolion@anonymised.com

wrote:

Hi all!

I've been trying to use geoserver's REST API to add automatically various
raster files and publish them. These raster files have a time parameter so
I have to use the image mosaic plugin with the corresponding property files
(indexer, timeregex and datastore)

I've tried doing the curl request by using a zip file with all required
geotiffs and property files but it returns a 500 that, after having a look
at geoserver log translates to:

http://pastebin.com/hCrvEm1L

I've checked the zip file and it's not corrupted so I don't really know
how to continue that way.

Here are the curl commands i execute, the first one creates the
coveragestore in a certain workspace and the second one is supposed to
upload the layers:

curl -u admin:geoserver -v -XPOST -H 'Content-Type: application/xml' \

     -d '<coverageStore><name>wind_spe
ed</name><workspace>wind</workspace>
         <enabled>true</enabled></coverageStore>' \
http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores&lt;http://localhost:8080/geoserver/rest/workspaces/cener-irena/coveragestores&gt;

curl -u admin:geoserver -v -XPUT -H 'Content-type: application/zip' \
     -d
'file:/home/mgonzalez/apache-tomcat-7.0.41/webapps/geoserver/data/data/wind/wind_speed.zip'
\

http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores/wind_speed/file.imagemosaic?coverageName=wind_speed&lt;http://localhost:8080/geoserver/rest/workspaces/cener-irena/coveragestores/wind_speed/file.imagemosaic?coverageName=wind_speed&gt;

I would very much appreciate if you could help me with this :slight_smile: Thank you!

Uploading a mosaic by zip file was simply not supported up until a few
weeks ago. This new functionality has been added to
the 2.4.x series, the 2.4 beta release is getting out these days, it would
be great if could check it out and see if it works
as you expect

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

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

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

-------------------------------------------------------

Hi Andrea,

Thanks for help! I tried with the last geoserver version (checked it was in fact 2.4) but i still get the same error. I dont know if it makes any difference that I’m using ubuntu. I’ll be glad to test any other thing regarding this subject tho, if you wish.

Still, I’d like to avoid using an unstable version of geoserver as of now since I want to automate the uploading in a production machine (under 2.2). Is there any way I can upload the Mosaic layer with time parameter via REST and publish it?

Thank you again for your help :slight_smile:

···

Why is it that we rejoice at a birth and grieve at a funeral? It is because we
are not the person involved.
– Mark Twain, “Pudd’nhead Wilson’s Calendar”

On 22 July 2013 11:52, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Mon, Jul 22, 2013 at 11:40 AM, Mikel Gonzalez Gainza <fingolion@anonymised.com> wrote:

Hi all!

I’ve been trying to use geoserver’s REST API to add automatically various raster files and publish them. These raster files have a time parameter so I have to use the image mosaic plugin with the corresponding property files (indexer, timeregex and datastore)

I’ve tried doing the curl request by using a zip file with all required geotiffs and property files but it returns a 500 that, after having a look at geoserver log translates to:

http://pastebin.com/hCrvEm1L

I’ve checked the zip file and it’s not corrupted so I don’t really know how to continue that way.

Here are the curl commands i execute, the first one creates the coveragestore in a certain workspace and the second one is supposed to upload the layers:

curl -u admin:geoserver -v -XPOST -H ‘Content-Type: application/xml’
-d ‘wind_spe
edwind
true’
http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores

curl -u admin:geoserver -v -XPUT -H ‘Content-type: application/zip’
-d ‘file:/home/mgonzalez/apache-tomcat-7.0.41/webapps/geoserver/data/data/wind/wind_speed.zip’
http://localhost:8080/geoserver/rest/workspaces/wind/coveragestores/wind_speed/file.imagemosaic?coverageName=wind_speed

I would very much appreciate if you could help me with this :slight_smile: Thank you!

Uploading a mosaic by zip file was simply not supported up until a few weeks ago. This new functionality has been added to
the 2.4.x series, the 2.4 beta release is getting out these days, it would be great if could check it out and see if it works
as you expect

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

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

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


On Mon, Jul 22, 2013 at 1:52 PM, Mikel Gonzalez Gainza
<fingolion@anonymised.com>wrote:

Hi Andrea,

Thanks for help! I tried with the last geoserver version (checked it was
in fact 2.4) but i still get the same error. I dont know if it makes any
difference that I'm using ubuntu. I'll be glad to test any other thing
regarding this subject tho, if you wish.

I am on Ubuntu as well (12.04), mosaic uploads are working fine for me. By
the looks of your url it seems
you are mixing external and file mode, because you are providing a path to
the file, not the file itself.

Here is an example of what I'm using:
curl -u admin:geoserver -XPUT -H "Content-type:application/zip"
--data-binary @polyphemus-test.zip
http://tuamotu.eoc.dlr.de:9090/repository/rest/workspaces/testWorkspace/coveragestores/polyphemus-test/file.imagemosaic

Still, I'd like to avoid using an unstable version of geoserver as of now
since I want to automate the uploading in a production machine (under 2.2).
Is there any way I can upload the Mosaic layer with time parameter via REST
and publish it?

You cannot do a true upload on the stable series, sorry. What you can try
out, if you want,
is to upload the data by some other means, and then use the external mode
pointing
GeoServer to the unzipped directory containing your mosaic

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

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

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

-------------------------------------------------------