简体   繁体   中英

How can I change geoserver style content?

This is my geoserver style test.sld file content.
Example

<sld:NamedLayer>
  <sld:Name>Test</sld:Name>
   <sld:UserStyle>
    <sld:Name>Test</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Name>Test</sld:Name>
          <sld:Rule>
      <sld:Test>
        <sld:Test>
          <sld:CssParameter name="fill">##939A94</sld:CssParameter>
        </sld:Fill>
        <sld:Stroke>
          <sld:CssParameter name="stroke">#939A94</sld:CssParameter>
          <sld:CssParameter name="stroke-width">2</sld:CssParameter>
        </sld:Stroke>

How can I change this content in php curl commands? Put xml content.I want know geoserver edit style sumbit button api.

GeoServer provides a REST API to allow you to carry out administrative tasks including adding a style .

If you want to add the SLD file then you POST the file to the /styles endpoint, you can also use GET to retrieve an existing style to modify and then PUT the changed file back.

You may also need to POST an xml file to /rest/layers/{layer}/styles to add a style to a layer. For example, this XML will create a style called roads_style on the layer using the roads.sld file that was uploaded earlier.

<StyleInfoPost>
    <name>roads_style</name>
    <filename>roads.sld</filename>
</StyleInfoPost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM