To style data with OGC SLD/SE styling definitions, use the factory methods in the SEPainterFactory
module to create a FeaturePainter
.
You can use that FeaturePainter
like any other FeaturePainter
implementation, and install it on a FeatureLayer
:
//Use the factory method from the SEPainterFactory module to create the painter
//As input we use the url of the SLD file
const seURL = "http://foo.com/se/CitiesSymbolizer.xml";
createPainterFromURL(seURL)
.then(function(sePainter) {
//Create a new layer which uses the created painter
const layer = new FeatureLayer(citiesModel, {
label: "Cities Layer",
painter: sePainter
});
//Add the layer to the map
map.layerTree.addChild(layer);
},
function(error) {
console.log("could not create a painter from symbology encoding at " + seURL);
}
);