Hi Nils,
Thank you for your quick reply. Your commands helped a lot and the import
finally works!
Is there any chance that something like this finds its way to the documentation?
Cheers
Thomas
Von: Nils Bühner [mailto:bueh...@terrestris.de]
Gesendet: Mittwoch, 7. Dezember 2016 13:28
An: Cürten, Thomas Maximilian; geoserver-users@lists.sourceforge.net
Betreff: Re: [Geoserver-users] Adding YSLD-Styles through REST
Hi Thomas,
it should be possible to import YSLD-Styles via REST.
Here are some snippets (curl commands) from a script that we were using to do
this:
Step 1: Create the style
curl \
-v \
-u $USER:$PASSWORD \
-XPOST \
-H "Content-type: text/xml" \
-d "<style>
<name>$YOURSTYLE</name>
<format>ysld</format>
<filename>$YOURSTYLE.yaml</filename>
<languageVersion>
<version>1.0.0</version>
</languageVersion>
</style>" \
http://localhost:8080/geoserver/rest/workspaces/$YOURWORKSPACE/styles
Step 2: Upload the style
curl \
-v \
-u $USER:$PASSWORD \
-XPUT \
-H "application/vnd.geoserver.ysld+yaml" \
--data-binary @$YOURSTYLE.yaml \
http://localhost:8080/geoserver/rest/workspaces/$YOURWORKSPACE/styles/$YOURSTYLE
Step 3 (optional): Assign style
curl \
-v \
-u $USER:$PASSWORD \
-XPUT \
-H "Content-type: text/xml" \
-d "<layer>
<defaultStyle>
<name>$YOURSTYLE</name>
<workspace>$YOURWORKSPACE</workspace>
</defaultStyle>
</layer>" \
http://localhost:8080/geoserver/rest/layers/$YOURWORKSPACE:$YOURLAYER
Good luck,
Nils
Am 07.12.2016 um 12:23 schrieb
thomas-maximilian.cuer...@t-systems.com<mailto:thomas-maximilian.cuer...@t-systems.com>:
Hello,
I am trying to add YSLD-Styles through Rest equivalent to this Documentation of
SLD-Imports: http://docs.geoserver.org/stable/en/user/rest/api/styles.html
At the end of the first section it says: "Other extensions (such as
css<http://docs.geoserver.org/stable/en/user/styling/css/index.html>) add
support for additional formats".
Unfortunately I haven't found any documentation for the YSLD-extension
regarding this issue.
Is there nevertheless any way to import YSLD-Styles via Rest or is that just
possible by converting them into SLDs?
I am using the GeoServer 2.10 Version.
Cheers
Thomas
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net<mailto:Geoserver-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Dipl.-Inf. Nils Bühner
- Anwendungsentwickler -
terrestris GmbH & Co. KG
Kölnstr. 99
53111 Bonn
Tel: +49 (0)228 / 96 28 99 -54
Fax: +49 (0)228 / 96 28 99 -57
Email: bueh...@terrestris.de<mailto:bueh...@terrestris.de>
Web: http://www.terrestris.de
Amtsgericht Bonn, HRA 6835
Komplementärin: terrestris Verwaltungsgesellschaft mbH
vertreten durch: Hinrich Paulsen, Till Adams
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users