I have a feature class that I applied complex labelling rules. In order for those labelling rules to translate on a map, I had to publish the feature class as a MapImageLayer. I have search for the javascript equivalent labellingInfo setting but it seems that they do not existing yet in the 4.x JS library.
Right now, I am dealing with highlighting by creating individual graphics and added it either into a graphics layer or MapView.graphics. Is there a native way such as layerView.highlight() for MapImageLayer?
Forgive me if I am misunderstanding - would you be looking to use the labellingInfo setting in the Sublayer class for a MapImageLayer?
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html
Hi Luke
Thanks for writing back. Unfortunately, that is not what I am looking for.
I'm looking for highlighting methods similar to FeatureLayerView.highlight() but for LayerView create for MapImageLayer.
I have explored directly changing labellingInfo but it just does not have the same parameters that produces the same labelling results. That is why I am using MapImageLayer for my map to retain the labelling parameters I defined in ArcGIS Pro.
Ah okay, no worries - if it helps I think I handle my highlighting of MapImageLayers in a similar same way by managing the related Graphics - I would interested if there is a native way, but I doubt it...
I was considering overlaying the same layer again just for the highlighting purpose. But with the amount of rendering involved, the map would be very inefficient.
Hi @gpei_ahuang
Have you found a solution yet? I'm having the exact same question.
There is still no solution specific to highlighting MapImageLayer. I don't think highlighting for MapImageLayer is part of the core function.
I ended up adding another the feature class layer from the MapImageLayer that I want highlight:
- remove all the labels
- redefine the rendering symbology
- define definitionExpression to use as a filter or (layerView.filter if you offload processing on client side)
- visible: false to start and toggle on and off as needed to visualize highlight
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