GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — as_sld function · Issue #15 · azavea/python-sld

as_sld function #15

New issue
Copy link
New issue
Copy link
Open
Open
as_sld function#15
Copy link

Description

@mkeller3
mkeller3
opened on Jan 11, 2019
Issue body actions

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

  1. dzwarg commented on Feb 17, 2021

    @dzwarg
    dzwarg
    on Feb 17, 2021
    Contributor
    More actions

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.