Select to view content in your preferred language

Mapview and hitTest with MapImageLayer ?

23
0
2 hours ago
LionelGOUBET
New Contributor III

Hi,

I have a mapView with a MapImageLayer and I try on a click on mapview the hitTest function

mapView.hitTest(event).then(function(response) {

if (response.results.length > 0) {
    response.results.forEach(function(result) {
if (result.graphic) {

console.log("Feature sous le clic:", result.graphic.attributes);
}
});
} else {
console.log("Aucun enregistrement trouvé sous le clic.");
}
});

No results ... it doesn't work

If I change the  MapImageLayer with a FeatureLayer (of my service MapImageLayer) on my mapview => it works

If I use a web map with my url from my MapImageLayer => it works

 

Is is normal ? the MapImageLayer is not  planned ?

What is the solution ? use QueryTask when I use a MapImageLayer ?

 

sample ! https://codepen.io/lgoubet/pen/YzoBaMJ and change bHitTest variable

 

Thanks for your help

 

 

0 Kudos
0 Replies