Skip to content

Parse only specific style rules from SLD schema #995

@ktsangop

Description

@ktsangop

Is there a way to request for a specific styles from multiple available for a Layer during parsing?

We have multiple "Selected Styles" exported from GeoServer for a specific Layer.
The SldStyleParser.readStyle() method correctly parses the XML document, and builds its own style object, but it merges all downloaded styles to a single one, including the rules of all the styles.

For example our SLD structure is :

<?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_layer_name</sld:Name>
        <sld:UserStyle>
            <sld:Name>my_style_1</sld:Name>
            <sld:Rule>...</sld:Rule>
            <sld:Rule>...</sld:Rule>
        </sld:UserStyle>
        <sld:UserStyle>
            <sld:Name>my_style_2</sld:Name>
            <sld:Rule>...</sld:Rule>
            <sld:Rule>...</sld:Rule>
        </sld:UserStyle>
        .... more styles here...
    </sld:NamedLayer>
</sld:StyledLayerDescriptor>

And the GeoStyler Style object we get when we parse this has the name of the 1st style e.g. my_style_1 and all the rules of the rest of the styles.

I am trying to find a way to parse only a specific style with its own rules from the XML by Name possibly e.g.
SldStyleParser.readStyle('my_style_2')
Is this possible?

I have also tried to find a way to do this using the WMS GetStyle API requst, but I always get the full list of styles in the response.

Thanks in advance.

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions