Select to view content in your preferred language

exposing layer details

908
2
01-27-2011 05:33 AM
SangamLama
Emerging Contributor
Hi all,

I have a map that displays different kinds of layers - water, streets, parcels, hydrants etc. I have implemented a IdentifyTask query such that, when I click anywhere on the map, it identifies the layer(s) where I had clicked and displays some information such as DisplayFieldname, LayerId, LayerName and Value.

And now, I need to be able to display other details about each specific layer. Say, when I click on a hydrant, it would return the ID, location, condition of that hydrant. I'm guessing I'll be able to see the fields that are setup in the ArcGIS server, but I dont know how to access them.

Is there a predefined function I could use?

Thanks,
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
The feature returned in the 'IdentifyResult' of an identify task contains an attributes dictionary.

So in your case, you should get you ID, location, condition,.... by code like
 
 
forreach( IdentifyResult result in results)
{
  Graphic feature = result.Feature;
  foreach(var attribute in feature.Attributes)
  {
       //attribute.Key and attribute.Value available here
  }
}
0 Kudos
SangamLama
Emerging Contributor
🙂

thanks!


The feature returned in the 'IdentifyResult' of an identify task contains an attributes dictionary.

So in your case, you should get you ID, location, condition,.... by code like
 
 
forreach( IdentifyResult result in results)
{
  Graphic feature = result.Feature;
  foreach(var attribute in feature.Attributes)
  {
       //attribute.Key and attribute.Value available here
  }
}
0 Kudos