Select to view content in your preferred language

Returning attributes from overlapping polygons

961
3
07-26-2010 08:11 AM
lisacompton
New Contributor
I have a to show attributes from two different polygon feature classes that overlap. I need to get the results from both into the same table, and I just can't figure out how. I have seen references to multiple queries. I have seen references to using an ArrayCollection to merge the data. I have built two queries, I have built an ArrayCollection, but I cannot get them together. The results can be an InfoWindow, it can be a MapTip, it does not matter.

To be specific I have a parcel layer and a zoning layer. I need some of the results from both. I know how to limit my data results.

I currently have both feature classes in the same dynamic map service.

I am currently using API1.3 and BF3.0. I am planning to upgrade soon, and will so so even sooner if API2.0 and FB4 will make this even easier.

My attempts have been so ineffercual that I have no code that I would be willing to share. Any help would be appreciated.

Thanks.

elcee
Tags (2)
0 Kudos
3 Replies
DasaPaddock
Esri Regular Contributor
I'd try the IdentifyTask where the IdentifyParameters.layerOption is set to IdentifyParameters.LAYER_OPTION_ALL and set the IdentifyParameters.layerIds to the id's of the two layers you want to get the attributes for.

Reference:
http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/com/esri/ags/tasks/IdentifyParamete...
0 Kudos
lisacompton
New Contributor
Dasa,
Thanks for replying.

I have tried using the InfoSymbol to return results from multiple layers in a DynamicMapService. An I have used the identify parameters as you recommended. Here is what happened:

If I set the parameters this way:
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.layerIds = [0,1];

I only return results from [0] (zoning).

If I set the parameters this way:
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.layerIds = [1,0];

I only return results from [1] (parcels).

The rest of my code is attached.

I have several projects where I will need to return results from multiple layers, any help is greatly appreciated.

Thanks.
elcee
0 Kudos
DasaPaddock
Esri Regular Contributor
When I try your code, there are many features being returned from both layers, but the code is only using the first one.

Line 76: var result:IdentifyResult = results[0];

If you add a breakpoint on this line and run the debugger, it should stop here and then you can inspect the results Array to see all the results. Another way to debug this is to use a tool like HttpFox to see the request and response and you can open the urls in a new tab and change f=json to f=html to see the results in the Service Directory.

You may want to consider having a DataGrid for each layer where you can view the attributes for all the features that are returned.

I'd also recommend setting identifyParams.returnGeometry to false if you're not going to add the features being returned to the map. This will improve the performance.
0 Kudos