Aaron,
This seems to work fine for me. I just took the IdentifyTask sample online and changed the layer type to MapImageLayer and then added your url and your code.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>IdentifyTask - 4.13</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
.esri-popup .esri-popup-header .esri-title {
font-size: 18px;
font-weight: bolder;
}
.esri-popup .esri-popup-body .esri-popup-content {
font-size: 14px;
}
</style>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.13/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.13/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/MapImageLayer",
"esri/tasks/IdentifyTask",
"esri/tasks/support/IdentifyParameters"
], function(Map, MapView, MapImageLayer, IdentifyTask, IdentifyParameters) {
var identifyTask, params;
var parcelURL =
"https://gis.easthartfordct.gov:6443/arcgis/rest/services/Sanitation_Routes/MapServer";
var parcelsLayer = new MapImageLayer({
url: parcelURL,
opacity: 0.85
});
var map = new Map({
basemap: "osm"
});
map.add(parcelsLayer);
var view = new MapView({
map: map,
container: "viewDiv",
center: [-72.6537, 41.7569],
zoom: 14
});
view.when(function(){
view.on("click", executeIdentifyTask);
identifyTask = new IdentifyTask(parcelURL);
params = new IdentifyParameters();
params.tolerance = 1;
params.layerIds = [0];
params.layerOption = "visible";
params.returnGeometry = true;
params.width = view.width;
params.height = view.height;
});
function executeIdentifyTask(event) {
params.geometry = event.mapPoint;
params.mapExtent = view.extent;
document.getElementById("viewDiv").style.cursor = "wait";
identifyTask
.execute(params)
.then(function(response){
var results = response.results;
return results.map(function(result){
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = layerName;
feature.popupTemplate = {
title: "<b>Your property is elligible for sanitation service: Day Week",
content:
"<b>Pickup Day:</b> {DayA_B}"
};
return feature;
});
})
.then(showPopup);
function showPopup(response){
if (response.length > 0){
view.popup.dockOptions = {
buttonEnabled: false,
breakpoint: false,
position: "bottom-right"
};
view.popup.open({
features: response,
location: event.mapPoint,
});
}
document.getElementById("viewDiv").style.cursor = "auto";
}
}
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>