I have a hosted ImageTileLayer. Using ArcGIS js 4.27 I'd like to be able to show pixel values in a popup. I have popups enabled on the layer and it loads into the map view. At the initial zoom level the popup works as expected. If I zoom in no popup is shown but that value is still retreived (logged in the console). If i zoom out, click to activate the popup and then zoom in the popup persists. Why might my popups not be opening at higher zoom levels?
Here's how the popups are handled:
// Function to handle raster layer clicks
function handleRasterLayerClick(event) {
const point = view.toMap({ x: event.x, y: event.y });
myImageryTileLayer
.identify(point)
.then((results) => {
if (results.value) {
console.log("Popup value: ", results.value[0]);
console.log("Identify Results:", results);
view.openPopup({
title: "Info",
content: `<b>Value:</b> ${results.value[0]}`,
location: point,
});
} else {
console.log("No value returned: resetting UI");
resetUI();
}
})
.catch((err) => {
console.error("Error identifying pixel data:", err);
});
}
Update: I figured this out. Before the view.on("click") event it was necessary to use view.popupEnabled = false;
Here's a fiddle with working code.
https://jsfiddle.net/Ojaybee/humj38qe/30/