Hello everyone,
After clicking on map ,my identify task doesnt returns result from layers where the exact map point is. Sometimes it works for all feature layers in one service.But mostly it doesnt work as expected. It returns result from some of the feature layers and not from all feature layer whose features are present at click point.
Check your layer option, default value is LAYER_OPTION_TOP, you may have to change it to LAYER_OPTION_ALL.
identifyparameters-amd | API Reference | ArcGIS API for JavaScript
Are you saying the point you click on the map is not where the identify is returning the features? Or is the location correct, but not all the features are being returned?
It would be helpful if you posted your code or create a example that shows the issue using jsbin.com or jsfiddle.net
https://community.esri.com/thread/106054?sr
Hello Ken Buja Yes I am not getting the result at exact location where it is clicked.
As mentioned by Riyas Deen I tried with different options. Also if I set tolerance value low for getting result form one service,then I dont get results from another service. One service need low tolerance while other need high tolerance.
Also I am facing problem with populating results in info-window for multiple services with mutiple feature layers.
Plz check the above link,I have posted my code there.
Looks like you want to execute identify on multiple map services. What you need here is dojo.deferredList
Below extracts from one of my old project where i have used deferred list for wiring multiple selection operation. You should be able to build up on this.
// 1. Populate your deferred array
var deferredQuery = this._queryTask.execute(args.spatialQuery);
this._deferredQueryArray[this._deferredQueryArray.length] = deferredQuery;
// 2. Hook up your deferred list then action
if (this._deferredQueryArray.length > 0) {
this._deferredQueryList = new dojo.DeferredList(this._deferredQueryArray);
this._deferredQueryList.then(
dojo.hitch(this, this.handleDeferredResults, extent, businessData, queryLayerMap),
dojo.hitch(this, function (err) {
alert(err);
}));
}
// 3. Handle your deferred
handleDeferredResults: function (extent, businessData, queryLayerFieldMaps, results) {
console.log("Entered Method: " + arguments.callee.nom);
if (results.length != queryLayerFieldMaps.length) {
alert("Somethings not right, contact application support. Business data and spatial results don't match");
}
this.removeFiredFromDeferred(this._deferredQueryArray);
// Do whatever you would normally do with your identify result.
}
// 4. Clear Your fired deferred from your deferred list
removeFiredFromDeferred: function (deferredArray) {
for (var idx = deferredArray.length -1; idx >= 0; idx--) {
if (deferredArray[idx].fired > -1) {
deferredArray.splice(idx, 1);
}
}
}
Riyas Deen yes ..was looking for the similar kind of code,using differed list.
Ken Buja ,Riyas Deen ,
Here I found the cause of my problem-
After clicking identify button I had changed my cursor(custom cursor), thus clicking on map with changed cursor resulted in shifting my original map point. Also if I change my cursor to any of the standard cursor value provided in api, it takes the exact map point.
But now the problem is I cant use custom cursor. Any solution for this?