Select to view content in your preferred language

MapImageLayer Click Highlight

413
1
09-23-2023 01:07 AM
Wade
by
New Contributor III

I would like to ask, when using MapImageLayer, identify clicks on the feature, how can I make the data in MapImageLayer have a highlight display?

The following is the general usage of featurelayer.

 

view.whenLayerView(feature).then(function (layerView) {
     highlight?.remove();
     highlight = layerView.highlight(id);
});

 

 

1 Reply
WongChunKang
New Contributor III

The following hack worked for me

 

// Tested in ArcGIS JS SDK 4.27.6

const map = new Map({ ... });
const view = new MapView({ ... });
const mapImageLayer = new MapImageLayer({ ... });

map.add(mapImageLayer);
await mapImageLayer.load();

// In TypeScript, be prepared to use `any` type from here onwards
const layerView = view.layerViews.find((lv) => lw.layer.id === mapImageLayer.id);
layerView.highlight([ ... ]); // An array of Graphic object

 

 

0 Kudos