[Geoserver-users] GeoServer REST API cURL - add geotiff layer with SRS and default style

Hi,

Because it is REST you can acquire working examples by making the configuration first with GUI and reading what you have with GET.

http://localhost:8080/geoserver/rest/workspaces/nurc/coveragestores/worldImageSample/coverages/Img_Sample.xml

-Jukka Rahkonen-

···

Little, John wrote:

Hi all,

I am new to this list and fairly new to GeoServer, so just trying to learn…

I am using GeoServer version 2.6.2 on linux.

I am trying to add a geotiff coverage layer using the REST API and have used the two cURL commands shown below (to first add the coveragestore, and then add the layer). This successfully adds both the store (my_geotiff) and layer (my_geotiff), however when viewing the new layer in the GeoServer web gui, it appears the layer is not enabled and it does not have any native or declared SRS. (the layer works when I add this information in the geoserver gui)… I’m wondering if I’m missing something in the cURL? How can I enable the layer, include reference system (EPSG), and also specify a default style? Are there additional tags or parameters that can be included?

curl -u admin:geoserver -v -XPOST -H ‘Content-Type: application/xml’ -d ‘my_geotiffpublictrue’ http://localhost:8080/geoserver/rest/workspaces/public/coveragestores

curl -u admin:geoserver -v -XPUT -H ‘Content-type: text/plain’ -d ‘file:///data/grids/my_geotiff.tif’ http://localhost:8080/geoserver/rest/workspaces/public/coveragestores/my_geotiff/external.geotiff?configure=first&coverageName=my_geotiff

I have searched online and this list and cannot find an answer to this specific question so hoping someone can help… I’d appreciate any help I can get.

Thanks!

John Little