Select to view content in your preferred language

Mapview and hitTest with MapImageLayer ?

209
2
Jump to solution
09-09-2024 08:51 AM
LionelGOUBET
Regular Contributor

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
1 Solution

Accepted Solutions
2 Replies
LionelGOUBET
Regular Contributor

the solution is perhaps to add each feature layer of the mapimage layer to the view map ...

0 Kudos
LionelGOUBET
Regular Contributor
0 Kudos