(API 3.X) How to have FeatureLayer.selectFeatures display the same symbol as Map.Popup's onClick handler?

544
3
02-25-2019 05:24 AM
GeoprocessamentoCarusoJR
New Contributor III

So, I realized that FeatureLayer.selectFeatures does not adds the default lightblue highlight, you need to set the layer's selection symbol, so I copied the popup's one so that it looks the same :

function setFeatureToDefaultHighlightSymbol(fl){
const type = fl.geometryType;
if(type === 'esriGeometryPoint'){
fl.setSelectionSymbol(this.map.infoWindow.markerSymbol);
}else if(type === 'esriGeometryPolyline'){
fl.setSelectionSymbol(this.map.infoWindow.lineSymbol);
}else{
fl.setSelectionSymbol(this.map.infoWindow.fillSymbol);
}
}

So, I call the above before calling the selectFeatures method, problem is, instead of adding a symbol on top of layer symbol, it substitutes for this one, so it ONLY show the lightblue highlight border.

My question is, how can I have the same behaviour as when I click a feature? My guess is that the Popup adds the selection symbol on the Map graphics layer on top of the clicked feature, but can I do this without having to manage graphics added to another layer?

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
But can I do this without having to manage a new layer?

You will have to maintain a new layer. There is not a way to do this without a new layer that I am aware of, without editing the originals layers symbology for the the selected feature.

0 Kudos
GeoprocessamentoCarusoJR
New Contributor III

How about asking the Popup to "select" multiples features at once, is this possible?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Nope. The popup will only select one feature at a time.

0 Kudos