Version 1.1 of the Symbology Encoding Implementation Specification defines SLD functions that you can use as expressions in your style definitions. SLD functions allow you to express complex but often-needed styling logic in just a few lines. For instance, you can use such an SLD function to transform continuous property values into discrete values, or to apply date and number formatting.

The LuciadLightspeed API supports these SLD functions through TLcdSLDFunction and its subclasses:

Table 1. Transformation functions
Transformation function Description

TLcdSLDCategorize

Transforms continuous values into discrete values, to assign specific colors to specific value ranges, for example

TLcdSLDInterpolate

Transforms continuous values into another continuous value range, to assign a continuous color range to a value range, for example

TLcdSLDRecode

Transforms discrete values into other discrete values, to assign colors to specific values, for example

Table 2. String functions
String function Description

TLcdSLDChangeCase

Changes the case of a string

TLcdSLDConcatenate

Concatenates strings

TLcdSLDStringLength

Returns the length of a string

TLcdSLDStringPosition

Returns the position of the first occurrence of a lookup string in a string value

TLcdSLDSubstring

Returns sub-strings of a given string

TLcdSLDTrim

Trims trailing and leading characters from a string value

Table 3. Formatting functions
Formatting function Description

TLcdSLDFormatDate

Formats dates according to well-known date formatting patterns

TLcdSLDFormatNumber

Formats numbers into a human-readable format

Using the string and formatting functions, you can adjust the content of labels in style definitions, while the transformation functions can help you with thematic styling. This example illustrates how you can use the SLD recode function to determine the fill color for US states based on their FIPS codes:

Program: Defining a polygon style with an SLD recode function for the fill color
<FeatureTypeStyle xmlns="http://www.opengis.net/se"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://www.opengis.net/se http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd"
                  version="1.1.0">
  <Rule>
    <MinScaleDenominator>0.0</MinScaleDenominator>
    <MaxScaleDenominator>INF</MaxScaleDenominator>
    <PolygonSymbolizer>
      <Fill>
        <SvgParameter name="fill">
          <Recode>
            <LookupValue>
              <ogc:PropertyName>STATE_FIPS</ogc:PropertyName>
            </LookupValue>
            <MapItem>
              <!-- Washington -->
              <Data>53.0</Data>
              <Value>#FF0000</Value>
            </MapItem>
            <MapItem>
              <!-- New York -->
              <Data>36.0</Data>
              <Value>#00FF00</Value>
            </MapItem>
             ...
          </Recode>
        </SvgParameter>
      </Fill>
      <Stroke>
        <SvgParameter name="stroke-opacity">
          <ogc:Literal>1.0</ogc:Literal>
        </SvgParameter>
        <SvgParameter name="stroke-width">
          <ogc:Literal>2</ogc:Literal>
        </SvgParameter>
        <SvgParameter name="stroke">
          <ogc:Literal>#000000</ogc:Literal>
        </SvgParameter>
      </Stroke>
    </PolygonSymbolizer>
  </Rule>
</FeatureTypeStyle>

Luciad offers equivalents for some of these functions in its OGC filter API, the string trim function and the recode function for example. There can be small differences between the SLD and filter functions. For instance, while you can only map numbers with the SLD recode function, you can also map strings with the OGC filter recode function. See TLcdOGCVendorSpecificFunctions for more information about the OGC filter functions.
The SLD functions are part of the SE Implementation Specification 1.1 and the SLD XML schema, and LuciadLightspeed therefore has them built-in. The vendor-specific functions in the OGC Filter API, on the other hand, are custom Luciad extensions of the OGC filter XML schema.