Select to view content in your preferred language

Adding Individual Feature Layers to the Flex Viewer

3101
15
03-08-2011 09:22 AM
AmySmith1
Emerging Contributor
Hello!

I'm in the process of learning how to use the ArcGIS Viewer for Flex. I have a basic question you seasoned Flex Viewer / API folks will more than likely be able to answer!

I'd like to add a layer from a map service to my map, using the type = "feature" attribute and feature layer url in the config.xml document. I noticed that when I do this, as opposed to adding the service to which it belongs (using type="dynamic"), it doesn't display on my map. I'm guessing this has something to do with the fact that the symbology is contained in the service and not the individual layers. Am I on the right track? How can I add individual layers and make them visible on my Flex Viewer map?

Any advice would be greatly appreciated. Thanks!

-Amy Smith
Tags (2)
0 Kudos
15 Replies
JonFisher
Emerging Contributor
To add a feature layer, you need to specify a particular layer, rather than the whole service. For example:
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer...

as opposed to a dynamic map service which would work with:
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/MapServer

Note that the feature service specifies a layer with a number at the end of the URL. From the service's FeatureServer page in REST, click the layer you want to get the new URL to use.
0 Kudos
PaulLang
Deactivated User
Within a Flex APP. Building a definition Expression and tying it together is no big deal.  I would like to do this in the Flex Viewer.  How do I send this to a featurelayer within the Config.xml?
0 Kudos
AmySmith1
Emerging Contributor
To add a feature layer, you need to specify a particular layer, rather than the whole service. For example:
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer...

as opposed to a dynamic map service which would work with:
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/MapServer

Note that the feature service specifies a layer with a number at the end of the URL. From the service's FeatureServer page in REST, click the layer you want to get the new URL to use.


Thanks! I was indeed specifying the particular layer, but I didn't realize there was a different service type for individual features within a map service. I'm unfamiliar with feature services (I'm assuming that's what they're called). When I click on the layer I want, the URL still indicates "MapServer", as opposed to "FeatureServer". Is there a particular process I need to go through to create feature services?

-Amy Smith
0 Kudos
JonFisher
Emerging Contributor
Within a Flex APP. Building a definition Expression and tying it together is no big deal.  I would like to do this in the Flex Viewer.  How do I send this to a featurelayer within the Config.xml?


You can either:
Use the QueryWidget (http://help.arcgis.com/en/webapps/flexviewer/help/widgets/query_widget.htm) and use the preload="open" tag to show a subset of a map service when the map loads, rather than just adding it as an operational layer.

Or, if using a feature layer, use the definitionexpression attribute as specified here:
http://help.arcgis.com/en/webapps/flexviewer/help/layer_tag.htm


Thanks! I was indeed specifying the particular layer, but I didn't realize there was a different service type for individual features within a map service. I'm unfamiliar with feature services (I'm assuming that's what they're called). When I click on the layer I want, the URL still indicates "MapServer", as opposed to "FeatureServer". Is there a particular process I need to go through to create feature services?


Just go to your REST home page (e.g. http://yourserver.com/yourinstance/rest/services/), and you will see that each map service with Feature capability enabled has two entries, one Map Server entry and another Feature Server entry (and a third if Mobile is enabled). Click on the Feature Server link, then the layer you want. Or you can just manually change the URL, but it's always a good idea to click through via your REST page to make sure the service has been created correctly, is started, etc.
0 Kudos
AmySmith1
Emerging Contributor
Just go to your REST home page (e.g. http://yourserver.com/yourinstance/rest/services/), and you will see that each map service with Feature capability enabled has two entries, one Map Server entry and another Feature Server entry (and a third if Mobile is enabled). Click on the Feature Server link, then the layer you want. Or you can just manually change the URL, but it's always a good idea to click through via your REST page to make sure the service has been created correctly, is started, etc.


I created a new map service with WFS enabled, but I am still only seeing one service (a map service) listed on my REST page. I'm currently using ArcGIS Server 9.3. Is this something that's only available with ArcGIS Server 10?
0 Kudos
JonFisher
Emerging Contributor
I created a new map service with WFS enabled, but I am still only seeing one service (a map service) listed on my REST page. I'm currently using ArcGIS Server 9.3. Is this something that's only available with ArcGIS Server 10?


Yes, "feature services" are different from WFS, and are only supported with Server 10. Just set the type to "dynamic" and you can use your http://yourserver.com/yourinstance/rest/services/yourservice/MapServer/ link. I thought you needed the specific feature service functionality, but if not just use dynamic and you'll be fine.
0 Kudos
AmySmith1
Emerging Contributor
Yes, "feature services" are different from WFS, and are only supported with Server 10. Just set the type to "dynamic" and you can use your http://yourserver.com/yourinstance/rest/services/yourservice/MapServer/ link. I thought you needed the specific feature service functionality, but if not just use dynamic and you'll be fine.


I must be having some other issue. 😞 Even using the http://yourserver.com/yourinstance/rest/services/yourservice/MapServer/0 url, the feature layer is not viewable when added to the list of operational layers. It shows up under the "More" menu, however when checked on, the layer doesn't appear to be added.

Thanks for the advice on Feature Services. It's definitely something I'm going to look into once my office updates to ArcGIS Server 10.

-Amy Smith
0 Kudos
ChrisBrannin
Regular Contributor
@jrfishe1
So the only way to get the attribute data from the layers is to use ArcSDE?
0 Kudos
JonFisher
Emerging Contributor
@jrfishe1
So the only way to get the attribute data from the layers is to use ArcSDE?


No, you can still use the Query operation on a map service to get attribute information regardless of whether it's based on SDE or local data on the server. But there is not an easy way to open the full attribute table of a layer in a regular map service.
0 Kudos