rb92
rb92

Reputation: 31

Programming Geoserver 2.0.2 to add a new data store and layer without the UI

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.

Upvotes: 3

Views: 2473

Answers (1)

Ian Turton
Ian Turton

Reputation: 10976

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.

Upvotes: 2

Related Questions