FeatureLayer with Labels

4067
5
04-20-2011 07:20 AM
AndrewHaigh
New Contributor III
I'm needing to label features in a FeatureLayer and I want to avoid having a seperate DynamicMapServiceLayer which contains the labels.

One approach I have considered is to extend the FeatureLayer to create a LabelledFeatureLayer class and alter the behaviour of the refresh (?) method.

Has anyone tried something similar to this or does anyone have any better suggestions?

Andrew
Tags (2)
0 Kudos
5 Replies
by Anonymous User
Not applicable
I'm needing to label features in a FeatureLayer and I want to avoid having a seperate DynamicMapServiceLayer which contains the labels.

One approach I have considered is to extend the FeatureLayer to create a LabelledFeatureLayer class and alter the behaviour of the refresh (?) method.

Has anyone tried something similar to this or does anyone have any better suggestions?

Andrew


You could create a graphics layer to display the text/ labels as a result of a query against the feature layer. This way you could let the user choose the label field, or make a configurable.
0 Kudos
IvanBespalov
Occasional Contributor III
You could create a graphics layer to display the text/ labels as a result of a query against the feature layer. This way you could let the user choose the label field, or make a configurable.


com.esri.ags.layers.FeatureLayer extending com.esri.ags.layers.GraphicsLayer

Use com.esri.ags.symbols.CompositeSymbol or com.esri.ags.symbols.TextSymbol to draw label.

Sample is here.
0 Kudos
deleted-user-NnRwwd8ols89
New Contributor
Hi, is it possible to label the feature layer (in the mxml) without performing a query?!

thanks!
Ben
0 Kudos
deleted-user-NnRwwd8ols89
New Contributor
...and how would you do the query for a mobile project?! when i import mx.controls.Alert; it says the import Alert could not be found

i'm trying to implement this sample:
http://help.arcgis.com/en/webapi/flex/samples/index.html#/Query_result_on_Map/01nq0000003q000000/

thanks
Ben
0 Kudos
IvanBespalov
Occasional Contributor III
1 -
when i import mx.controls.Alert; it says the import Alert could not be found


Try it : www.adobe.com...

2 -
is it possible to label the feature layer (in the mxml) without performing a query?


I think: Yes. I have not found any query maker/caller in this sample.
0 Kudos