Christian Mayer, meggsimum
FOSSGIS 2014, Berlin
z.B.
http://<geoserver-url>/rest/
http://<geoserver-url>/rest/workspaces/
http://<geoserver-url>/rest/workspaces/xyz/datastores/
http://<geoserver-url>/rest/layers/xyz:abc
curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<workspace><name>fossgis2014</name></workspace>" http://localhost:10080/geoserver243/rest/workspaces
curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip" --data-binary @bands.zip http://localhost:10080/geoserver243/rest/workspaces/fossgis2014/datastores/bands/file.shp
curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<style><name>bands</name><filename>bands.sld</filename></style>" http://localhost:10080/geoserver243/rest/styles
Import eines SLD in neuen Style
curl -v -u admin:geoserver -XPUT -H "Content-type: application/vnd.ogc.sld+xml" -d @bands.sld http://localhost:10080/geoserver243/rest/styles/bands
curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d "<layer><defaultStyle><name>bands</name></defaultStyle></layer>" http://localhost:10080/geoserver243/rest/layers/fossgis2014:bands
#!/bin/bash
echo "-------------------------------------------------------------"
echo "create style $1 and add it as default style to layer $2 ..."
echo "-------------------------------------------------------------"
echo ""
curl -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<style><name>$1</name><filename>$1.sld</filename></style>" http://localhost:10080/geoserver243/rest/styles
echo " - added the new style $1"
curl -u admin:geoserver -XPUT -H "Content-type: application/vnd.ogc.sld+xml" -d @$1.sld http://localhost:10080/geoserver243/rest/styles/$1
echo " - uploaded $1.sld in new style $1"
curl -u admin:geoserver -XPUT -H "Content-type: text/xml" -d "<layer><defaultStyle><name>$1</name></defaultStyle></layer>" http://localhost:10080/geoserver243/rest/layers/fossgis2014:$2
echo " - set $1 as default style for layer $2"
echo "... done cause GeoServer REST API rocks!"
>> add-default-style.bat newbandstyle bands
(web) www.meggsimum.de
(twitter) @geofootballer
(github) @chrismayer
Diese Folien sind unter CC BY-SA veröffentlicht.
/