cadastral.identifyTask = new esri.tasks.IdentifyTask(mapUrl); cadastral.identifyParams = new esri.tasks.IdentifyParameters(); cadastral.identifyParams.tolerance = 0; cadastral.identifyParams.returnGeometry = true; var identifyArray = [9]; cadastral.identifyParams.layerIds = identifyArray; cadastral.identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE; //.LAYER_OPTION_ALL; cadastral.identifyParams.geometry = evt.mapPoint; cadastral.identifyParams.mapExtent = cadastral.map.extent; cadastral.identifyTask.execute(cadastral.identifyParams, function (idResults) { cadastral.identify.setupIdentifyResults(idResults, evt); }, function (idResults) { cadastral.showError(idResults, evt); });
What I am finding out is that the identifyTask does not return results once my scale reaches a certain point. At large scales it works fine. At small scales past about 50,000 it no longer works.
My spatial reference is webmercator(102100) if that helps, and the layer I am trying to identify on has a min scale set at 72225. So, it would seem that after 72225 it would no longer work but should work up until then.
I am using esri.geometry.getScale to determine the scale and I assume that the scale returned is correct.
Anyone have any ideas? Thanks.
Here is my identify code:cadastral.identifyTask = new esri.tasks.IdentifyTask(mapUrl); cadastral.identifyParams = new esri.tasks.IdentifyParameters(); cadastral.identifyParams.tolerance = 0; cadastral.identifyParams.returnGeometry = true; var identifyArray = [9]; cadastral.identifyParams.layerIds = identifyArray; cadastral.identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE; //.LAYER_OPTION_ALL; cadastral.identifyParams.geometry = evt.mapPoint; cadastral.identifyParams.mapExtent = cadastral.map.extent; cadastral.identifyTask.execute(cadastral.identifyParams, function (idResults) { cadastral.identify.setupIdentifyResults(idResults, evt); }, function (idResults) { cadastral.showError(idResults, evt); });
cadastral.identifyTask = new esri.tasks.IdentifyTask(mapUrl); cadastral.identifyParams = new esri.tasks.IdentifyParameters(); cadastral.identifyParams.tolerance = 1; // unless you identify a polygon layer, always give tolerance some positive value. cadastral.identifyParams.returnGeometry = true; cadastral.identifyParams.layerIds = [9]; cadastral.identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; //just make sure your layer 9 is always in your identify list cadastral.identifyParams.geometry = evt.mapPoint; cadastral.identifyParams.mapExtent = cadastral.map.extent; cadastral.identifyParams.height = cadastral.map.height; cadastral.identifyParams.width = cadastral.map.width; ......
cadastral.identifyTask = new esri.tasks.IdentifyTask(mapUrl); cadastral.identifyParams = new esri.tasks.IdentifyParameters(); cadastral.identifyParams.tolerance = 0; cadastral.identifyParams.returnGeometry = true; cadastral.identifyParams.layerIds = [9]; cadastral.identifyParams.geometry = evt.mapPoint; cadastral.identifyParams.mapExtent = cadastral.map.extent; cadastral.identifyParams.height = cadastral.map.height; cadastral.identifyParams.width = cadastral.map.width;
This is what I ended up with. I think height and width were the key.cadastral.identifyTask = new esri.tasks.IdentifyTask(mapUrl); cadastral.identifyParams = new esri.tasks.IdentifyParameters(); cadastral.identifyParams.tolerance = 0; cadastral.identifyParams.returnGeometry = true; cadastral.identifyParams.layerIds = [9]; cadastral.identifyParams.geometry = evt.mapPoint; cadastral.identifyParams.mapExtent = cadastral.map.extent; cadastral.identifyParams.height = cadastral.map.height; cadastral.identifyParams.width = cadastral.map.width;
Since I am identifying on a polygon layer, what should the tolerance be? I just figured 0 would be best for a polygon.
Thanks for the help.
I'm experiencing a similar issue. I have a map service with some layers visible at all extents, while other layers are visible only below 1000 ft. For the layers that are always visible, my click event triggers the identifyTask every time and I get the results I want. When I get to 1000 ft, I can see the other layers, but the click event doesn't return objects until after I zoom in a couple of more levels. My assumption is that if I can see the features, I can identify them. But that's not the case.
I don't see any real differences in my code vs. the other code examples in this thread. Any suggestions?
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
Right. And right now we're using:identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
So it makes me wonder why I can't detect certain items in the same service when they first become visible....
identifyTask = new esri.tasks.IdentifyTask(MyESRISearchUrl); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 2; identifyParams.returnGeometry = true; var lids = ""; identifyParams.layerIds = MyESRILayerIDs; lids += " --- "; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE; /* LAYER_OPTION_TOP; */
We're identifying all the layers. (The layer 9 was the original poster's code).
Here's a more complete look at what I have:identifyTask = new esri.tasks.IdentifyTask(MyESRISearchUrl); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 2; identifyParams.returnGeometry = true; var lids = ""; identifyParams.layerIds = MyESRILayerIDs; lids += " --- "; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE; /* LAYER_OPTION_TOP; */
I swapped out LAYER_OPTION_VISIBLE for LAYER_OPTION_ALL and that of course enabled me to see everything. But I need to find a way to get LAYER_OPTION_VISIBLE working properly (assuming that when anything is visible on the map, I can identify it).
We did have some permission issues early on with the service--I believe it's accessible now. How could the REST API not being publicly accessible make some layers visible/identifiable and some not?