0

I am trying to create a SLD for symbology in a map. The map contains 9 counties with cultural assets by category and type. Current symbology is based on type. I would like to duplicate the map for each county and only show the assets in that county while still using the primary dataset filtered by the county field: ogc:PropertyNamecounty</ogc:PropertyName> ogc:LiteralArcher</ogc:Literal>.

    <sld:Rule>
      <sld:Title>Monuments</sld:Title>
      <ogc:Filter>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>type</ogc:PropertyName>
          <ogc:Literal>Monuments</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
      <sld:MinScaleDenominator>105.0</sld:MinScaleDenominator>
      <sld:MaxScaleDenominator>108335.0</sld:MaxScaleDenominator>
      <sld:PointSymbolizer>
        <sld:Graphic>
          <sld:Mark>
            <sld:WellKnownName>circle</sld:WellKnownName>
            <sld:Fill>
              <sld:CssParameter name="fill">#2d8bc2</sld:CssParameter>
            </sld:Fill>
            <sld:Stroke>
              <sld:CssParameter name="stroke">#FFFFFF</sld:CssParameter>
              <sld:CssParameter name="stroke-width">2</sld:CssParameter>
            </sld:Stroke>
          </sld:Mark>
          <sld:Size>14</sld:Size>
        </sld:Graphic>
      </sld:PointSymbolizer>
    </sld:Rule>

At a loss as to where to insert the county filter. Can you create a county rule and nest all the symbology within based on type, or have to insert >type< and >county< for each.

Tried searching for nested rules and nested filters.

plbata
  • 13
  • 2

2 Answers2

1

Rule and filter nesting is not possible in SLD. If you're looking into writing more compact styles, and your target is GeoServer, then have a look at GeoCSS instead, among other things, it supports free rule nesting:

https://docs.geoserver.org/latest/en/user/styling/css/tutorial.html#applying-rule-nesting

Andrea Aime
  • 1,706
  • 11
  • 16
0

I would create a new layer for each county by adding a CQL filter in the box labelled Restrict the features on layer by CQL filter at the very bottom of the layer creation page. Then you could apply the same SLD to each layer.

Ian Turton
  • 10,018
  • 1
  • 28
  • 47