I have an SLD called my_data.sld
(created in QGIS 3.2.x) with looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" version="1.1.0" xmlns:se="http://www.opengis.net/se" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc">
<NamedLayer>
<se:Name>my_data</se:Name>
<UserStyle>
<se:Name>my_data</se:Name>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Single symbol</se:Name>
<se:PointSymbolizer>
<se:Graphic>
<se:Mark>
<se:WellKnownName>circle</se:WellKnownName>
<se:Fill>
<se:SvgParameter name="fill">#e15989</se:SvgParameter>
</se:Fill>
<se:Stroke>
<se:SvgParameter name="stroke">#232323</se:SvgParameter>
<se:SvgParameter name="stroke-width">0.5</se:SvgParameter>
</se:Stroke>
</se:Mark>
<se:Size>7</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
If I upload SLD file via the GeoServer control panel, then apply it to a layer, the layer is correctly styled, no problem.
However, I want to add upload this style to a workspace and apply it via the rest API, which I do via these commands (following the curl examples):
curl -v -u admin:pass -XPOST -H "Content-type: text/xml" -d "<style><name>my_data</name><filename>my_data.sld</filename></style>" https://localhost/geoserver/rest/workspaces/my_workspace/styles
curl -v -u admin:pass -XPUT -H "Content-type: application/vnd.ogc.sld+xml" -d @/home/sam/my_data.sld https://localhost/geoserver/rest/workspaces/my_workspace/styles/my_data
Both commands appear to work giving < HTTP/1.1 200 OK
codes. I have the new style in my workspace but there's a problem with the content of the style. Inspecting the new style in the GeoServer Style Editor control panel shows:
<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">
<sld:NamedLayer>
<sld:Name>my_data</sld:Name>
<sld:UserStyle>
<sld:Name>my_data</sld:Name>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Name>Single symbol</sld:Name>
<sld:PointSymbolizer>
<sld:Graphic>
<sld:Mark>
<sld:WellKnownName>circle</sld:WellKnownName>
<sld:Fill/>
<sld:Stroke/>
</sld:Mark>
<sld:Size>7</sld:Size>
</sld:Graphic>
</sld:PointSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
Clearly tags with se:SvgParameter have not been translated into whatever format the style is in now.
I've tried to modify the <StyledLayerDescriptor>
to match the manual upload that worked, without success.
I thought the issue might be related to the "Content-type:application/vnd.ogc.sld+xml"
but can't find an appropriate content type either.
What should I try next?