Skip to content

Instantly share code, notes, and snippets.

@uniomni
Created January 14, 2011 04:56
Show Gist options
  • Save uniomni/779194 to your computer and use it in GitHub Desktop.
Save uniomni/779194 to your computer and use it in GitHub Desktop.
Geoserver REST command examples

REST commands, generated by Risk-in-a-Box and known to work

Upload shapefile + associated style. Then activate style and make it default.

PUT -H "Content-type: application/zip" "http://localhost:8080/geoserver/rest/workspaces/exposure/datastores/AIBEP_schools/file.shp" --data-binary "@AIBEP_schools.zip"
POST -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/styles" --data-ascii "<style>AIBEP_schoolsAIBEP_schools.sld</style>"
PUT -H "Content-type: application/vnd.ogc.sld+xml" "http://localhost:8080/geoserver/rest/styles/AIBEP_schools" --data-binary "@AIBEP_schools.sld"
PUT -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/layers/AIBEP_schools" --data-ascii "AIBEP_schoolstrue"

Upload raster + associated style. Then activate style and make it default.
PUT -H "Content-type: image/tif" "http://localhost:8080/geoserver/rest/workspaces/exposure/coveragestores/Population_2010/file.geotiff" --data-binary "@Population_2010.tif"
POST -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/styles" --data-ascii "<style>Population_2010Population_2010.sld</style>"
PUT -H "Content-type: application/vnd.ogc.sld+xml" "http://localhost:8080/geoserver/rest/styles/Population_2010" --data-binary "@Population_2010.sld"
PUT -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/layers/Population_2010" --data-ascii "Population_2010true"

Create workspace
POST -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/workspaces" --data-ascii "futnuh"

Get workspace
GET -H "Content-type: text/xml" "http://localhost:8080/geoserver/rest/workspaces/futnuh"

Coverage download
http://localhost:8080/geoserver/wcs?version=1.0.0&service=wcs&request=getcoverage&identifier=shakemap_padang_20090930&format=GeoTIFF&BoundingBox=-5.519000,96.956000,2.289000,104.641000,urn:ogc:def:crs:EPSG::4326&store=false&coverage=shakemap_padang_20090930&crs=EPSG:4326&bbox=96.956000,-5.519000,104.641000,2.289000&resx=0.030741064&resy=0.030741064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment