Wednesday 17 July 2019

rest - Programming Geoserver 2.0.2 to add a raster data store and layer without the UI


I have a directory of raster imagery that will be updated continually. From this imagery, I am making Image Pyramids using the Geotool's PyramidBuilder utility. I need to setup a cron job to automatically add raster datastores and layers to Geoserver without using the UI.


After looking at the REST section of the Geoserver manual I was able to add my workspace, "testWS", but trying the create an ImagePyramid datastore did not work.


Since I have access to the datastore, I expanded on the shapefile example and tried to


curl -u admin:geoserver -XPUT -H 'Content-type: text/plain' \ 

-d '/opt/geoserver_data_dir/2.0.2/data/test_pyramid.pyr' \
"http://localhost:8080/geoserver/rest/workspaces/testWS/datastores/test_pyramid.pyr/external.imagepyramid?configure=all"

Where test_pyramid.pyr is the base of my ImagePyramid at this location.


This gave me an error of "No such datastore: test_pyramid"


Is there a better way to add a new datastore and layer to Geoserver without manually adding each one via the UI? I need help in crafting the proper REST statement that will add an extisting ImagePyramid as a datastore and layer.


Is there some Java code that could do this? I looked at the Geoserver python extensions but they did not have this either.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...