Select to view content in your preferred language

Labeling Polygons Returned from a Query Task

891
3
02-01-2013 09:10 AM
JamesBerg
Occasional Contributor
I am using a QueryTask object to query two feature classes via REST services.  They both take a user drawn geometry and do an intersection to get the values that are underneath that geometry.  The first feature is a polygon and returns the selected polygons from the QueryTask.  The second queries a Point feature and uses the Statistics functionality to group by the Polygon ID that is on each point.  I want to then show the totals returned by the second feature class as a lable on the polygons returned from the first Query.  Is there a way to do this?  I can't figure out how to add labels to the polygon features returned from the QT.
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
James,

   If you are using an ArcGIS Server 10.1 map service than you should look at this sample:

http://resources.arcgis.com/en/help/flex-api/samples/01nq/01nq00000086000000.htm

If not than you have a lot of code work ahead of you to accomplish this.

  1. You will have to get the polygon centroid or use the GeometryService to get the labelpoint and then create a point graphics layer from those points and assign the label text you wish to use as an attribute to each point.

  2. Assign a TextSymbol as the graphics layers symbol and assign the field that you put the label text into as the textAttribute.

Good luck with this
0 Kudos
JamesBerg
Occasional Contributor
Robert,

The second option is the path I am going down at this point.  The only problem I have is I don't know how to match up the points returned from the Geometry Service to the polygons they were created from to assign labels to them.  Any ideas on that?  Am I missing some kind of parameter that will assign some value to the points returned?

James
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
James,

  They will always come back in the same order you sent them in.
0 Kudos