Refer to the Esri sample https://developers.arcgis.com/javascript/latest/sample-code/identify/live/. which is based on import * as identify from "@arcgis/core/rest/identify";
In the above sample, change the line number 70.
From:
params.layerIds = [0, 1, 2, 3, 4];
To:
params.layerIds = [0];
Actually, layer id 0 represents Roads layer. After the above code change, Identify should work only on Road layer, but it's not the case here.
Additional observation is, for payload of the network transaction, could not see the provided layer ids at all. Refer to the below screenshot.
Solved! Go to Solution.
Hi @Ranga_Tolapi, this is a known issue that will be fixed at the next release (4.23). It should also be ready to test on next soon: https://github.com/Esri/feedback-js-api-next
This bug in 4.22 is related to the new IdentifyParameters.sublayers property added in 4.22. The way they've implemented it, layerIds will be ignored if you do not supply a value for sublayers. Nonetheless, this is very easy to work around if you don't want to wait until 4.23 is released.
If you're identifying against a MapImageLayer, as is the case in the sample, you can simply set the IdentifyParameters instance's sublayers property to the MapImageLayer instance's sublayers property. In this case, I did this on line 85:
// Executes each time the view is clicked
function executeIdentify(event) {
// Set the geometry to the location of the view click
params.sublayers = identifyLayer.sublayers; //added line
params.geometry = event.mapPoint;
params.mapExtent = view.extent;
Technically, to make this work as desired, all that's required is to at minimum supply an array containing a single object having an "id" property that matches a value in what you're supplying for layerIds:
// Executes each time the view is clicked
function executeIdentify(event) {
// Set the geometry to the location of the view click
params.sublayers = [{id:params.layerIds[0]}]; //added line
params.geometry = event.mapPoint;
params.mapExtent = view.extent;
Hi @Ranga_Tolapi, this is a known issue that will be fixed at the next release (4.23). It should also be ready to test on next soon: https://github.com/Esri/feedback-js-api-next
This bug in 4.22 is related to the new IdentifyParameters.sublayers property added in 4.22. The way they've implemented it, layerIds will be ignored if you do not supply a value for sublayers. Nonetheless, this is very easy to work around if you don't want to wait until 4.23 is released.
If you're identifying against a MapImageLayer, as is the case in the sample, you can simply set the IdentifyParameters instance's sublayers property to the MapImageLayer instance's sublayers property. In this case, I did this on line 85:
// Executes each time the view is clicked
function executeIdentify(event) {
// Set the geometry to the location of the view click
params.sublayers = identifyLayer.sublayers; //added line
params.geometry = event.mapPoint;
params.mapExtent = view.extent;
Technically, to make this work as desired, all that's required is to at minimum supply an array containing a single object having an "id" property that matches a value in what you're supplying for layerIds:
// Executes each time the view is clicked
function executeIdentify(event) {
// Set the geometry to the location of the view click
params.sublayers = [{id:params.layerIds[0]}]; //added line
params.geometry = event.mapPoint;
params.mapExtent = view.extent;
Thank you @JoelBennett, your workaround worked like a charm 👍