简体   繁体   English

SLD 和/或嵌套过滤器中的嵌套规则

[英]Nested Rules in SLD and/or nested filters

I am trying to create a SLD for symbology in a map. The map contains 9 counties with cultural assets by category and type.我正在尝试在 map 中为符号系统创建一个 SLD。map 包含 9 个县的文化资产类别和类型。 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>.我想为每个县复制 map 并仅显示该县的资产,同时仍使用县字段过滤的主要数据集: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.您能否创建县规则并根据类型将所有符号系统嵌套在其中,或者必须为每个插入 >type< 和 >county<。

Tried searching for nested rules and nested filters.尝试搜索嵌套规则和嵌套过滤器。

Rule and filter nesting is not possible in SLD. 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:如果您正在考虑编写更紧凑的 styles,并且您的目标是 GeoServer,那么请查看 GeoCSS,除其他外,它支持自由规则嵌套:

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

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.我将通过在图层创建页面最底部标记为Restrict the features on layer by CQL filter的框中添加 CQL 过滤器来为每个县创建一个新图层。 Then you could apply the same SLD to each layer.然后您可以将相同的 SLD 应用于每一层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM