Select to view content in your preferred language

Feature Labels in Flex Viewer

6932
25
01-17-2011 04:58 PM
NadeemShaukat
Deactivated User
I have scale dependent labels for features in my dynamic service but they are not showing up in the Flex Viewer environment. However, they show up if I use the same service in an application outside the Flex Viewer.

Is anyone else experiencing the same?

If anyone at ESRI knows the reason, please respond.

Thanks

Nadeem
Tags (2)
25 Replies
MehulChoksey
Esri Contributor
Are you using Time widget?
Is it possilble for you to share your config file?
0 Kudos
NadeemShaukat
Deactivated User
Are you using Time widget?
Is it possilble for you to share your config file?


Mehul,

Thanks for the reply.

I am not using the Time widget. This is for dynamic layers of my data. Below is is from the main config.xml file (Operational Layers block). This layer is one of the several layers which has scale dependent city names as labels that are not showing up in the Flex Viewer application. You may try these lines in one of your flex applications and see if labels apperar. I am also including the map extent.

Thanks

Nadeem

<layer label="Cities" type="feature" visible="true" alpha="1"
                   info="widgets/InfoTemplates/SimpleInfoWinWidget.swf"
                   infoconfig="widgets/InfoTemplates/KNRD_Cities.xml"
                   url="http://gisdev.wrime.com/ArcGIS/rest/services/KNRDGIS/MapServer/3"/>

<map initialextent="-13421000 5702000 -12519000 6373000" fullextent="-13421000 5702000 -12519000 6373000">
0 Kudos
MehulChoksey
Esri Contributor
Could you also send the url of the first basemap layer thats added to the map?
That layer determines the spatial reference of the map.
Also if you could send the HTTP REST request/response by capturing through firebug / fiddler/ httpfox etc.
0 Kudos
NadeemShaukat
Deactivated User
Could you also send the url of the first basemap layer thats added to the map?
That layer determines the spatial reference of the map.
Also if you could send the HTTP REST request/response by capturing through firebug / fiddler/ httpfox etc.


Mehul,

Thanks for the following up.

Below are the lines of the basemap. My feature classes data is also in WGS_1984_Web_Mercator_Auxiliary_Sphere.

I could not follow your last question. I access my feature layers through config.xml.

Thanks

Nadeem

<basemaps>
          <layer label="Streets" type="tiled" visible="false"  alpha="1"
              url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
          <layer label="Aerial"  type="tiled" visible="false" alpha="1"
              url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/>
           <layer label="Topo"    type="tiled" visible="false" alpha="1"  
              url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>                            
</basemaps>
0 Kudos
MehulChoksey
Esri Contributor
Labelling for featuerlayer on client side is not supported by Flex api.
To achieve what you want,
Add two layers instead of one as shown below.
first layer of type dynamic-pointing to mapservice (note /mapserver in url)- This will render labels.
second layer of type dynamic - pointing to featurelayer (note training /0 in the url) This will fetch attributes for the feature. Also set the alpha to 0. so that features are not rendered on top of the first layer.
Hope this helps.
e.g.
<layer label="HomeLand Security Incident Points" type="dynamic" visible="true" 
                   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/MapServer"/>

             <layer label="HomeLand Security Incident Points" type="feature" visible="true" 
                   info="widgets/InfoTemplates/SimpleInfoWinWidget.swf" alpha="0"
                   infoconfig="widgets/InfoTemplates/IWT_IncidentPoints.xml"
                   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0"/>

0 Kudos
NadeemShaukat
Deactivated User
Mehul,

I tried it and it works but it will plot all layers in the service. This will not leave a control for me to turn layers on and off.

Is there a way around?

Thanks

Nadeem
0 Kudos
MehulChoksey
Esri Contributor
You could use visiblelayers attribute of the layer tag.
e.g
 <layer label="Oil Spill" type="dynamic" visible="true" url="myurl" visiblelayers="0,1,4" />
0 Kudos
NadeemShaukat
Deactivated User
Mehul,

This may work, but user has to turn 2 layers, one for labels, and the other for info.

Is is technically difficult for ESRI to support labeling in feature layers? Are there any plans in next versions?

Thanks for your prompt solution.

Nadeem
0 Kudos
MehulChoksey
Esri Contributor
If you want to just use one layer then may be using Robert's Identify Widget or search widget would be the way to go.
As far as supporting the FeatureLayer labeling client side, its not in the queue for next milestone for sure.
0 Kudos