Hello all,
I'm migrating a mapping application from Javascript API v3.x to Maps SDK v4. It displays a mosaic layer of an Image Service on our ArcGIS Server 10.9. The Identify feature using esri.tasks.ImageServiceIdentifyTask() worked fine with v3.
Now, the mosaic layer with SDK uses ImageryLayer and the Identify feature uses ImageryLayer's identify() method. But it returns a 'Identify error: can't assign to property "timeExtent" on [url to image service]: not an object' error. The Image Service is not time-enabled.
My simplified code is below. IdentifyTask function is executed upon user's click on the map. The error happens before a REST request is sent. So, the Image Service itself should be fine (the v3 code still works fine and the service returns correct pixel values.). The problem should be within SDK v4 or maybe the backward incompatibility between SDK4 and the Image Service served through ArcGIS Server 10.9? The Image Service was published using the ArcGIS Desktop (from ArcGIS Catalog) not from ArcGIS Pro.
I tried to set timeExtent attribute of ImageIdentifyParameters to null, undefined or even a dummy TimeExtent object. The same setting for timeExtent attribute for ImageryaLayer parameters. But none of them solved the problem.
Any help / tips are more than welcome!
const creatMosaicLayer = () => {
const mosaicId = "...";
const mosicUrl = "...";
const where = "...";
const mosaicRule = new MosaicRule({
method: "attribute",
ascending: true,
operation: "sum",
sortField: "OBJECTID",
where: where
});
const params = {id: mosaicId,
url: mosaicUrl,
pixelFilter: maskPixels,
mosaicRule: mosaicRule,
noData: -1,
interpolation: "nearest",
format: "jpgpng",
visible: true
};
let mosaicLayer = new ImageryLayer(params);
return mosaicLayer;
};
const IdentifyTask = () => {
try {
const params = new ImageIdentifyParameters({
geometry: point,
mosaicRule: layer.mosaicRule,
rasterFunction: layer.rasterFunction,
returnGeometry: false,
returnCatalogItems: true,
returnPixelValues: true,
timeExtent: null // The error happens with/without timeExtent attribute.
});
const response = await layer.identify(layer.url, params);
} catch (error) {
throw new Error(`Identify error: ${error.message}`);
}
};