We need to automatize process of creating datastore and publishing geotiff layer. Also, before publishing we need to change Declared SRS and to save Native Bounding Box to our database.

Geotiff file will be uploaded to the file system by our customer.

Yes, I`ve seen Create a Layer in GeoServer using REST, also I see that there is publishGeoTIFF(...) methods in Geoserver-manager in GeoServerRESTPublisher.java.

Another solution that I see - is to make all the operations with bot written with selenium or htmlUnit.

Could you please suggest us, what approach is more elegant and suitable for us. Is there any actions in our workflow that we will not be able to do with Geoserver-manager.

P.S.: we also have seen at gsrcj project, but it can`t create programmatically geotiff layer.

Thank you in advance, Dmitry.


I was able to do it using geoserver-manager.

The code is:

GeoServerRESTPublisher geoServerRESTPublisher = new GeoServerRESTPublisher("http://localhost:8090/geoserver", "admin", "geoserver");
geoServerRESTPublisher.publishGeoTIFF("myWS", "myTiff", "myTiff",
        new File("d:\\work\\myTiff.tif"), "EPSG:900913",
        GSResourceEncoder.ProjectionPolicy.REPROJECT_TO_DECLARED, defaultRasterStyle, null);

Now I am working on how to get bbox of just the created layer.


Unless your app is written in Java then the REST approach is the most elegant as it can be coded in any language that has an HTTP lib (all of them).

Any solution using selenium or something similar should be an absolute last resort, changes to the REST API will likely remain backward compatible so you can upgrade GeoServer with confidence, the UI will frequently change meaning you will need to review what you've done with Selenium on every update, it's a very brittle solution.

  • What would be the solution if my app is written in java ? I am looking for something like a java api to geoserver or embedding the geoserver completely – jah Dec 5 '17 at 16:03

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.