Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment
up vote 2 down vote accepted

I was able to did it with 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`m working on how to get bbox of just created layer.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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