Select to view content in your preferred language

IdentifyTask does not seem to honor IdentifyParameters .layerDefinitions

1073
2
04-14-2011 11:41 AM
JasonMielke
Occasional Contributor
I am trying to limit the results returned by the IdentifyTask by setting the IdentifyParameters.layerDefinitions.  However it seems to ignore this and rather continues to return all found features from the ArcGISDynamicMapService.  For instance if set...
identifyParams.layerDefinitions[0] = "prod_gas = 'Yes'";


and then execute the IdentifyTask.  The petroleum field polygon features where prod_gas = 'No' are still returned in the results set.

Here's a link to an esri sample server (v10) rest services directory that demonstrates this... http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer/identify?geo...

Am I not setting the .layerDefinitions correctly or is this a bug?

thanks, jason
0 Kudos
2 Replies
HemingZhu
Frequent Contributor
I am trying to limit the results returned by the IdentifyTask by setting the IdentifyParameters.layerDefinitions.  However it seems to ignore this and rather continues to return all found features from the ArcGISDynamicMapService.  For instance if set...
identifyParams.layerDefinitions[0] = "prod_gas = 'Yes'";


and then execute the IdentifyTask.  The petroleum field polygon features where prod_gas = 'No' are still returned in the results set.

Here's a link to an esri sample server (v10) rest services directory that demonstrates this... http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer/identify?geo...

Am I not setting the .layerDefinitions correctly or is this a bug?

thanks, jason


put {"0": "prod_gas = 'Yes'"} in http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer//0 should work. Same way put identifyParams.layerDefinitions = {"0": "prod_gas = 'Yes'"}; should do the trick.
0 Kudos
JasonMielke
Occasional Contributor
thanks Heming!  Your reply was helpful.

Oddly enough the JS app still did not like:
identifyParams.layerDefinitions = {"0": "prod_gas = 'Yes'"}; 


However I was able to get this to work using the following in my app:
var layerDefAry = [];
layerDefAry.push("prod_gas = 'Yes'");
identifyParams.layerDefinitions = layerDefAry; 


thanks again, jason
0 Kudos