Configuration object for the Symbology Encoding factory functions.

interface SEPainterCreateOptions {
    conflictResolution?: boolean;
    drapeTarget?: DrapeTarget;
    functionEvaluators?: {
        [name: string]: FunctionEvaluator<string | number | null | Shape | boolean>;
    };
    iconProvider?: IconProvider;
    strict?: boolean;
}

Properties

conflictResolution?: boolean

Whether the labels defined by TextSymbolizers should be decluttered or not. The default value is true.

Individual TextSymbolizers can override this default behaviour by specifying a VendorOption named "conflictResolution". For example:

<TextSymbolizer>
...
<VendorOption name="conflictResolution">false</VendorOption>
</TextSymbolizer>

Since

2021.1

drapeTarget?: DrapeTarget

The target on which Symbology Encoding styled content will be draped. If drapeTarget is undefined and the shape has zero Z, it will be draped on terrain. If it has non-zero Z, it will not be draped.

Default

undefined

Since

2022.1

functionEvaluators?: {
    [name: string]: FunctionEvaluator<string | number | null | Shape | boolean>;
}

You can provide some custom function evaluators at creation time. Custom functions allow to change the style of your features based on a function.

Using custom functions requires some coding as well as some adaptations in your sld files to start using them. To illustrate this we provide a very easy function to get the length of a string below.

  createPainterFromString(seSource, {
functionEvaluators: {
"lengthOfName": (name: string): number => {
return name.length;
}
}}).then(function(painter) {
map.layerTree.addChild(new FeatureLayer(model, {
painter: painter
}));
});

Using this function can be done like this:

<ogc:Function name="lengthOfName">
<ogc:PropertyName>NAME</ogc:PropertyName>
</ogc:Function>

We also provided a small set of pre-defined functions:

  • "vertices": a geometry function that returns all points of a geometry.
  • "startPoint": a geometry function that returns the first point of a geometry.
  • "endPoint": a geometry function that returns the last point of a geometry.
  • "startAngle": a geometry function that returns the orientation along the line starting in the first point of a geometry.
  • "endAngle": a geometry function that returns the orientation along the line starting in the last point of a geometry.
  • "Recode": a transformation function that transforms a set of discrete attribute values into another set of values.
  • "Categorize": a transformation function that transforms a continuous-valued attribute into a set of discrete values.
  • "Interpolate": a transformation function that transforms a continuous-valued attribute into another continuous range of values.
  • "strTrim": a text-altering function that returns a copy of the string with leading and trailing blank spaces omitted.

These functions don't require any coding, you can just use them by adding them in your sld files. To illustrate this, below the strTrim function in sld, which can be used to properly trim the property strings you use to label your features.

<ogc:Function name="strTrim">
<ogc:PropertyName>NAME</ogc:PropertyName>
</ogc:Function>

For more elaborate documentation on the use of pre-defined functions and on how to implement your own custom functions, see SLD custom and predefined functions - how to use them.

Type declaration

Since

2023.0

iconProvider?: IconProvider

The custom icon provider. This provider allows to provide custom icons for the Symbology Encoding file's ExternalGraphics elements.

Since

2021.1

strict?: boolean

Configures whether the factory method should fail if invalid elements are encountered. The default value is false.