3

I have a directory of 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 new 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.

rb92
  • 31
  • 3
  • Looks as if this question has been asked on the gis stackechange also: http://gis.stackexchange.com/questions/6479/programming-geoserver-2-0-2-to-add-a-new-data-store-and-layer-without-the-ui – DaveParillo Feb 23 '11 at 23:08
  • I think this question may be off-topic because because have been crossposted to gis.stackexchange http://gis.stackexchange.com/questions/6479/programming-geoserver-2-0-2-to-add-a-raster-data-store-and-layer-without-the-ui – Francisco Puga Jan 21 '15 at 17:44

1 Answers1

2

You need to explore the RESTConfig module. It is included in GeoServer 2.1 but is a separate plugin in for 2.0. See http://docs.geoserver.org/2.0.0/user/extensions/rest/index.html for details.

Ian Turton
  • 10,018
  • 1
  • 28
  • 47