QUERY ALL ON MULITPLE MAP SERVICE REST ENDPOINT LAYERS ALL AT ONCE

3173
7
10-08-2010 04:29 PM
AnastasiaAourik
New Contributor II
I have multiple map services, Capital Improvement Projects, Water (stuff), Wastewater (stuff) ,etc. etc.  Each of these map services may have lots of layers... 
We want to build a tool that will identify anything within a polygon, from many map services and many layers on each map service.

I would like to do some kind of query all or identify all (for a POLYGON)
What is the best approach...

I cheated initially by pre-processing and make a phony feature class with the assets from all those other areas into a single feature class and doing a single query on this layer, but this is growing too big and now I have a mix of points, lines, polygons. 

Can arcgis silverlight identifytask work on multiple layer ids?  Can you identify on a POLYGON AOI instead of just a point?
0 Kudos
7 Replies
DominiqueBroux
Esri Frequent Contributor
Can arcgis silverlight identifytask work on multiple layer ids?

Yes, you can either identify on all layers of a map service or you can specify the layers by the LayerIds parameter.



Can you identify on a POLYGON AOI instead of just a point?

Yes, the valid geometry types are Envelope, Point, Multipoint, Polyline, or Polygon.



I have multiple map services

Here, you need multiple identify tasks.
In this sample , the identify user control is identifying on all visible map services.
You can test it on these webmaps (for example).
0 Kudos
AnastasiaAourik
New Contributor II
Thanks Dominique!

I now have the IdentifyTask for all layers - I actually can even pass a list of layers to accept.  Now, I deal with the performance of this depending on how many records found.  Seems like identify task was not really indended for searching thousands of points within a large polygon - Wouldn't want to use it to find all fire hydrants and valves in a zip code, for instance. Thus, I am not switching to creating a GP TOOL that will perform this task instead.  I hope it will be easy to implement and use in my silverlight app. Can you direct me to a sample gp tool that does this spatial intersection task (passing in a polygon as a parameter) and returning a featureset???
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Anastasia,

Instead of creating a GP tool, it could be easier to use a spatial query.

Here is a sample of a spatial query based on a geometry drawn interactively:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery

Here is a sample of a query based on attributes:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#AttributeQuery

It's also possible to combine these 2 types of query.

If, for any reason, you need a GP tool, I think the closest sample is the 'ClipFeatures' sample which is returning all features within a buffer around a line:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ClipFeatures
0 Kudos
AngelGonzalez
Occasional Contributor II
dbroux,

I am looking for the sample that you reference(10-09-10) for mutiple map service for the Identify Task but the url is no longer valid. Does this example still exist?

Thanks
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Since the old resource center has been deprecated, the sample has been moved to the arcgis.com code gallery : http://www.arcgis.com/home/item.html?id=4a5af1f10e214a908ece9d18c01a2d25
0 Kudos
DominiqueBroux
Esri Frequent Contributor
in your code, which I still cannot get to work (no layers are shown with the new link), you are looping through each layer and executing Async each time. It is not clear how you are handling the completed event and allowing it to finish before executing the next layer. Can you clarify?
.

Not sure about what is not working in your case?
The approach of the sample is to create one Identify Task by visible layers and to execute them concurrently.
The features returned by the identify tasks are added in the result datagrid in the completed event so, at the end of the process, the datagrid contains the results for all layers.
Only the first completed event (flag needReset) clears the datagrid before populating the datagrid with the first features.

I've seen Jennifer talk about chaining Async in the completed code for additional Identifies but if you have several/many map services, that makes it unworkable, I believe.

This approach should work as well but should be slower since the identify tasks are executed sequentially.
0 Kudos
DeminHu
New Contributor
I had a task before, I  needed to create multiple rings and query ( beffer ,clip and query), I used recursive function, I  wonder if  you could  try  recursive for your task.
0 Kudos