enablePermanentHighlight in esri Feature Layer

191 views Asked by At
let marker = L.marker(new L.LatLng(lat, lon), { icon: markerIcon });
map.addLayer(marker);

Just like the normal marker, how can we use enablePermanentHighlight() on features of FeatureLayer. Any alternative?

This is how I use this on marker,

marker.enablePermanentHighlight();

or

marker.options.highlight = "permanent";

I have used the same method on feature layer, but that layer was not highlighting/blinking.

foundFeatureLayer.eachActiveFeature((layer) => {
    if (layer.feature || layer instanceof L.Marker) {
        layer.enablePermanentHighlight();
    }
});
1

There are 1 answers

0
john gravois On

you need to wait for your featureLayer to load before you can loop through individual features.

fl.on("load", function (e) {
  fl.eachActiveFeature((layer) => {
    if (layer.feature || layer instanceof L.Marker) {
        layer.enablePermanentHighlight();
    }
  });
});

http://jsbin.com/nuxawek/edit?html,output