mapbox/carto

Condense rules with 'or' filters

Offen

#206 geöffnet am 24.10.2012

 (8 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (132 Forks)auto 404
enhancementhelp wantedperformance

Repository-Metriken

Stars
 (658 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

The example style below will result in an XML file with 9 separate rules. But Mapnik XML supports 'or' in filters like ([type] = 'foo' or [type] = 'bar') and it really only needs to be one rule.

Ideally Carto could just condense these automatically, but alternatively there could be some kind of key in value1, value2, ... syntax. Thoughts?

#areas {
  [type='camp_site'],
  [type='common'],
  [type='national_park'],
  [type='nature_reserve'],
  [type='park'],
  [type='protected_area'],
  [type='recreation_ground'],
  [type='village_green'],
  [type='zoo'] {
    polygon-fill: green;
  }
}
<Style name="areas" filter-mode="first" >
  <Rule>
    <Filter>([type] = 'camp_site')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'common')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'national_park')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'nature_reserve')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'park')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'protected_area')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'recreation_ground')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'village_green')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
  <Rule>
    <Filter>([type] = 'zoo')</Filter>
    <PolygonSymbolizer fill="#008000" />
  </Rule>
</Style>

Contributor Guide