MapImageLayer is faster but there seems to be no way to use hitTest.How to get the feature data of the layer when adding hitTest when using MapImageLayer? Or just use Feature Layer for query?
Thank you so much
Hi @Wade , MapImageLayer's work a little differently than the layers that support layer views, hit tests and highlighting. For a replacement for highlighting with MapImageLayer I'd suggest creating a GraphicsLayer and adding it to the map. Then with the feature returned from the Identify you can add a graphic to the GraphicsLayer. You'll also need to set the IdentifyParameters to return the geometry. I wrote a quick codepen that shows how this can be done, by modifying our normal Identify sample to add a graphic. I hope this helps, although MapImageLayers can draw faster, they do have trade offs compared to using FeatureLayers.
https://codepen.io/sagewall/pen/ExGQLGJ?editors=1010
Hi @Sage_Wall , thank you for your answer.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?
Hi @Wade, with map image layers it's probably easier to use the identify class rather than hit test. This is a sample that shows how to use the results from identify to create custom popups.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.