0

I have been following this post-Is there a symbols level option/solution for SLD? about stacking symbols but I have been stuck in using <FeatureTypeStyle> with GeoServer rendering transformations.

I have tried the following but it doesn't even validate in GeoServer

<NamedLayer>
<Name>location_site</Name>
<UserStyle>
<!-- Styles can have names, titles and abstracts -->
  <Title>Stacked Point for location</Title>
  <Abstract>Styles volcanoes using stacked points</Abstract>
  <FeatureTypeStyle>
    <Transformation>
      <ogc:Function name="vec:PointStacker">
        <ogc:Function name="parameter">
          <ogc:Literal>data</ogc:Literal>
        </ogc:Function>
        <ogc:Function name="parameter">
          <ogc:Literal>cellSize</ogc:Literal>
          <ogc:Literal>10</ogc:Literal>
        </ogc:Function>
        <ogc:Function name="parameter">
          <ogc:Literal>outputBBOX</ogc:Literal>
          <ogc:Function name="env">
            <ogc:Literal>wms_bbox</ogc:Literal>
          </ogc:Function>
        </ogc:Function>
        <ogc:Function name="parameter">
          <ogc:Literal>outputWidth</ogc:Literal>
          <ogc:Function name="env">
            <ogc:Literal>wms_width</ogc:Literal>
          </ogc:Function>
        </ogc:Function>
        <ogc:Function name="parameter">
          <ogc:Literal>outputHeight</ogc:Literal>
          <ogc:Function name="env">
            <ogc:Literal>wms_height</ogc:Literal>
          </ogc:Function>
        </ogc:Function>
      </ogc:Function>
    </Transformation>
    </FeatureTypeStyle>
    <FeatureTypeStyle>
    <Rule>
      <Name>1 Site</Name>
      <Title>1 site</Title>
      <ogc:Filter>
        <ogc:PropertyIsLessThanOrEqualTo>
          <ogc:PropertyName>count</ogc:PropertyName>
         <ogc:Literal>1</ogc:Literal>
        </ogc:PropertyIsLessThanOrEqualTo>
      </ogc:Filter>
      <MaxScaleDenominator>1800000</MaxScaleDenominator>
      <PointSymbolizer>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#238f1c</CssParameter>
            </Fill>
          </Mark>
          <Size>8</Size>
        </Graphic>
      </PointSymbolizer>
    </Rule>
    </FeatureTypeStyle>
    <FeatureTypeStyle>
    <Rule>
      <Name>1-100 sites</Name>
      <Title>1-100 sites</Title>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:And>
          <ogc:PropertyIsGreaterThan>
            <ogc:PropertyName>count</ogc:PropertyName>
            <ogc:Literal>1</ogc:Literal>
          </ogc:PropertyIsGreaterThan>
          <ogc:PropertyIsLessThanOrEqualTo>
            <ogc:PropertyName>count</ogc:PropertyName>
            <ogc:Literal>100</ogc:Literal>
          </ogc:PropertyIsLessThanOrEqualTo>
        </ogc:And>
      </ogc:Filter>
      <PointSymbolizer>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#e8e251</CssParameter>
            </Fill>
          </Mark>
          <Size>12</Size>
        </Graphic>
      </PointSymbolizer>
    </Rule>
    </FeatureTypeStyle>
    <FeatureTypeStyle>
    <Rule>
      <Name>100-500</Name>
      <Title>100-500 sites</Title>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:And>
          <ogc:PropertyIsGreaterThan>
            <ogc:PropertyName>count</ogc:PropertyName>
            <ogc:Literal>100</ogc:Literal>
          </ogc:PropertyIsGreaterThan>
          <ogc:PropertyIsLessThanOrEqualTo>
            <ogc:PropertyName>count</ogc:PropertyName>
            <ogc:Literal>500</ogc:Literal>
          </ogc:PropertyIsLessThanOrEqualTo>
        </ogc:And>
      </ogc:Filter>
      <PointSymbolizer>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#bd9524</CssParameter>
            </Fill>
          </Mark>
          <Size>25</Size>
        </Graphic>
      </PointSymbolizer>

    </Rule>
   </FeatureTypeStyle>

</UserStyle>

1

The PointerStacker is implementing a "point clustering" transformation, has nothing to do with drawing order.

Feature drawing order is controlled by FeatureTypeStyle and the z-ordering vendor options instead, see also: https://docs.geoserver.org/latest/en/user/styling/sld/extensions/z-order/index.html

  • I know what the point clustering transformation does. What I am asking is how to include symbols levels in an SLD including transformations – kartoza-geek Feb 20 at 5:17
  • I don't understand what you mean then, I'd suggest to clarify your question adding an example of what you'd like to get as a result. – Andrea Aime Feb 20 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.