When you’re styling vector data, you may have a need for thematic styling. With thematic styling, you base styling options such as the size of an icon or the fill color of an area on an object property. For example, you want to show big cities with larger icons than small cities.

Using OGC SLD/SE styling, you can achieve property-based styling through rules. A rule has an optional filter and a scale range that defines when to apply the rule and its styling options.

This example of a rule defines that a particular point styling is only applicable when a property POPULATION has a value greater than 10000:

Program: Defining a conditional point style
         <Fill><SvgParameter name="fill">#FF0000</SvgParameter>

Although this is a flexible approach to define thematic styling, you may end up with large style files if you have lots of conditions. For example, if you want to style each state in the US with a distinct fill color, you need a styling rule per state.

An alternative, more concise approach is to rely on a function. This example illustrates how you can use a function to determine the fill color based on the name of a US state, in a single rule:

Program: Defining a polygon style with a function for the fill color
<?xml version='1.0' encoding='UTF-8'?>
<FeatureTypeStyle xmlns="http://www.opengis.net/se"
  <Name>Thematic style</Name>
    <Title>Thematic US states style</Title>
    <Abstract>Renders the US states with a black outline and a different fill color per state.</Abstract>
        <SvgParameter name="fill">
          <ogc:Function name="Recode">
            <ogc:Literal>New York</ogc:Literal>
        <SvgParameter name="stroke-opacity">
        <SvgParameter name="stroke-width">
        <SvgParameter name="stroke">

The example uses the OGC Recode function, which you can use to map property values to other values - such as colors and sizes. This function is one of the built-in functions described in TLcdOGCVendorSpecificFunctions. You can also plug in your own functions. For more information, see this article.