1

I am trying to automate the geoserver configuration process and I am using curl and the geoserver REST API.

I am able to create workspaces and for instance a WMS datastore, but I am not able to create an image pyramid datastore.

Is this possible at all?

I haven't found any examples online. I have tried the suggestion from Creating Store in GeoServer workspace using REST API?. I tried to get information from another datastore and modifying the result to post it again. I created a file using statement below:

curl -v -u username:password -XGET -H 'Accept:text/xml' http://myserver:8080/geoserver/rest/workspaces/workspacename/coveragestores/datastorename_X/ > logfile.log

I modified the name and path of the coverage store and tried to upload it again using:

curl -v -u username:password -XPUT -H 'Accept:text/xml' -H 'Content-type:text/xml' -d @logfile.log http://myserver:8080/geoserver/rest/workspaces/workspacename/coveragestores/datastorename_Y/

< HTTP/1.1 500 Internal Server Error
< Server: Apache-Coyote/1.1
< Transfer-Encoding: chunked
< Date: Tue, 18 Apr 2017 13:20:19 GMT
< Connection: close
<
coverages : coverages : coverages : coverages
 ---- Debugging information ----
 message             : coverages : coverages
 cause-exception     :         com.thoughtworks.xstream.mapper.CannotResolveClassException
 cause-message       : coverages : coverages
 class               : org.geoserver.catalog.impl.CoverageStoreInfoImpl
 required-type       : org.geoserver.catalog.impl.CoverageStoreInfoImpl
 line number         : 1
 * Closing connection #0
  • 1
    please show us what you have tried so far and what happened – Ian Turton Apr 18 '17 at 11:22
1

After some time I have succeeded in creating a imagepyramid datastore.

I will write it down here so someone else can make use of it.

To create the datastore, first create a xml file yourdatastore.xml like this:

<coverageStore> <name>yourdatastore</name> <type>ImagePyramid</type> <enabled>true</enabled> <url>file:/your/path/goes/here</url> </coverageStore>

Then upload it.
curl -v -u username:password -XPOST -T yourdatastore.xml -H "Content-type: text/xml" http://localhost:8080/geoserver/rest/workspaces/yourworkspace/coveragestores

Finally create a layer:
curl -v -u username:password-XPOST -H "Content-type: text/xml" -d "<coverage><nativeName>yourfolder</nativeName><name>yourlayername</name><srs>EPSG:yourSRS</srs></coverage>" http://localhost:8080/geoserver/rest/workspaces/yourworkspace/coveragestores/yourdatastore/coverages

Using the REST interface your can then fill in the rest of the configuration of your layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.