opengeospatial / styles-and-symbology

OGC Styles & Symbology Standards
Other
11 stars 6 forks source link

Choropleth or graduated map #19

Open ebocher opened 1 year ago

ebocher commented 1 year ago

Existing conformance classes required for this use case:

Example stylesheet:

Below a CSS encoding to describe a graduated map to display fraction of vegation on a grid (HIGH_VEGETATION_FRACTION property).

*{
  stroke: #000000;
  stroke-width: 1px;
  [HIGH_VEGETATION_FRACTION>=0 OR HIGH_VEGETATION_FRACTION<=0.200]
  {
     fill: yellow;
  };
  [HIGH_VEGETATION_FRACTION>0.200 OR HIGH_VEGETATION_FRACTION<0.500]
  {
     fill: orange;
  };
  [HIGH_VEGETATION_FRACTION>0.500]
  {
     fill: red;
  };
}

Describe any capability not already addressed by existing conformance classes:

Example image illustrating the portrayal use case:

choropleth_filter_grid_impervious_fraction

about #17

maxcollombin commented 1 year ago

Mapbox JSON encoding

{
  "version": 8,
  "name": "Default Styler",
  "layers": [
    {
      "filter": [
        ">",
        "HIGH_VEGETATION_FRACTION",
        0.5
      ],
      "id": "",
      "type": "fill"
    },
    {
      "filter": [
        "<=",
        "HIGH_VEGETATION_FRACTION",
        0.5
      ],
      "id": "",
      "type": "fill"
    }
  ]
}
maxcollombin commented 1 year ago

SLD encoding

<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor
    xmlns="http://www.opengis.net/sld"
    xmlns:sld="http://www.opengis.net/sld"
    xmlns:gml="http://www.opengis.net/gml"
    xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">
    <sld:NamedLayer>
        <sld:Name>Default Styler</sld:Name>
        <sld:UserStyle>
            <sld:Name>Default Styler</sld:Name>
            <sld:FeatureTypeStyle>
                <sld:Name>name</sld:Name>
                <sld:Rule>
                    <ogc:Filter>
                        <ogc:PropertyIsGreaterThan>
                            <ogc:PropertyName>HIGH_VEGETATION_FRACTION</ogc:PropertyName>
                            <ogc:Literal>0.5</ogc:Literal>
                        </ogc:PropertyIsGreaterThan>
                    </ogc:Filter>
                    <sld:PolygonSymbolizer>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#ff0000</sld:CssParameter>
                        </sld:Fill>
                        <sld:Stroke/>
                    </sld:PolygonSymbolizer>
                </sld:Rule>
                <sld:Rule>
                    <ogc:Filter>
                        <ogc:PropertyIsLessThanOrEqualTo>
                            <ogc:PropertyName>HIGH_VEGETATION_FRACTION</ogc:PropertyName>
                            <ogc:Literal>0.5</ogc:Literal>
                        </ogc:PropertyIsLessThanOrEqualTo>
                    </ogc:Filter>
                    <sld:PolygonSymbolizer>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#ffff00</sld:CssParameter>
                        </sld:Fill>
                        <sld:Stroke/>
                    </sld:PolygonSymbolizer>
                </sld:Rule>
                <sld:VendorOption name="ruleEvaluation">first</sld:VendorOption>
            </sld:FeatureTypeStyle>
        </sld:UserStyle>
    </sld:NamedLayer>
</sld:StyledLayerDescriptor>
jerstlouis commented 1 year ago

CCSSS Encoding version:

{
  stroke: { black; width: 1px }
  [highVegetationFract between 0 and 0.200]     { fill: { yellow }; };
  [highVegetationFract between 0.200 and 0.500] { fill: { orange }; };
  [highVegetationFract > 0.500]                 { fill: { red } };
}