Select to view content in your preferred language

AGSGraphicLayer graphic attributes

688
2
Jump to solution
07-25-2013 05:03 PM
DavidMcDonald2
Occasional Contributor
Hi there,

I am curious whether it is possible to change the default behaviour for retrieving graphics in a AGSFeatureLayer when added to a AGSMapView?

Bear with me..

I am currently querying AGSFeatureLayers so that I can return all attributes for each graphic i.e. [query setOutFields:@[@"*"]].  This works fine, but I also need to return the geometry for each graphic in order to sort them by distance from the centre of the map. I have quite a lot of graphics so returning the geometry can become quite inefficient.

If I use the graphics returned dynamically from the visible map region instead, the performance is much better, but these graphics only contain the top two attributes from the feature service layer.

I would like to be able to specify a default query for the AGSFeatureLayer when adding it to a map, as I believe this would be more efficient than manually querying AGSFeatureLayers in this circumstance.

Hope that makes sense.
Dave
0 Kudos
1 Solution

Accepted Solutions
DavidMcDonald2
Occasional Contributor
Ok, apologies. The easiest solution for me is to set the outFields in the AGSFeatureLayers to * and then I don't need to make any queries. The app is now running much quicker.

View solution in original post

0 Kudos
2 Replies
DavidMcDonald2
Occasional Contributor
Hmm, I think I can use the definitionExpression property of the FeatureLayer.. I will give that a go.
0 Kudos
DavidMcDonald2
Occasional Contributor
Ok, apologies. The easiest solution for me is to set the outFields in the AGSFeatureLayers to * and then I don't need to make any queries. The app is now running much quicker.
0 Kudos