GeezerVison is showing github.com — as_sld function · Issue #15 · azavea/python-sld
Description
When I go to print my sld out my filter ends up below my symbolizer. Is there any way to avoid since this violates sld styling policies? Here is my code.
mysld = sld.StyledLayerDescriptor()
nl = mysld.create_namedlayer('test')
ustyle = nl.create_userstyle()
fts = ustyle.create_featuretypestyle()
firstRule = fts.create_rule('test',sld.PolygonSymbolizer)
firstRule.create_filter('value', '>', 'T')
print mysld.as_sld(pretty_print=True)
Activity
dzwarg commented on Feb 17, 2021
Hello @mkeller3,
Here's the SLD that your code generates:
<sld:StyledLayerDescriptor xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0">
<sld:NamedLayer>
<sld:Name>test</sld:Name>
<sld:UserStyle>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:Title>test</sld:Title>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">#AAAAAA</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name="stroke">#000000</sld:CssParameter>
<sld:CssParameter name="stroke-width">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
<ogc:Filter>
<ogc:PropertyIsGreaterThan>
<ogc:PropertyName>value</ogc:PropertyName>
<ogc:Literal>T</ogc:Literal>
</ogc:PropertyIsGreaterThan>
</ogc:Filter>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
According to https://docs.geoserver.org/stable/en/user/styling/sld/reference/rules.html, both <ogc:Filter> and <sld:PolygonSymbolizer> elements are direct descendants of <Rule>, so this is conformant. Let me know if you are still running into issues with this library.
Metadata
Metadata
Development
No branches or pull requestsIssue actions