Select to view content in your preferred language

When to use various layer types in Flex API

2362
3
12-21-2010 03:37 AM
JasonThiel
Emerging Contributor
Please excust my ignorance, I am learning.

When dealing with Flex API, there are a plethora of ???Layers??? that can be used.
Ex:  FeatureLayer, ArcGisDynamicMapServiceLayer, DynamicMapServiceLayer, etc.
I understand the difference between tiled and dynamic (tiled is cached and dynamic is not), but in general, when do you use each type?  Is there documentation somewhere that specifies? 
For instance, when would I need/want to use a FeatureLayer vs ArcGisDynamicMapServiceLayer?
Tags (2)
0 Kudos
3 Replies
JasonThiel
Emerging Contributor
Interesting, ESRI seems to have no "design considerations" documentation per se.  Anybody know about anything from a third party?
0 Kudos
DavidElies
Deactivated User
I've wondered the same thing.  Are there some experts or designers that have some input?

My understanding of the difference between FeatureLayer and a DynamicMapServiceLayer is that the DMSL pulls in all the features (layers) within a map service and the FL only deals with one layer.  The FeatureLayer gives you much more control over the display of the graphics as well as giving you access to editing of features.
0 Kudos
ReneRubalcava
Esri Frequent Contributor
The API docs can give you some insight on when you would use FeatureLayer
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html

The feature layer can be used to display features from one single layer of either a Feature Service or a Map Service. The layer can be either a (spatial) layer or a (non-spatial) table. The features in a FeatureLayer can be edited if it is based on a Feature Service. 
If the layer supports attachment, the layerDetails (or tableDetails) "hasAttachment" property will be true. If the feature layer is editable and has attachment, you can also add and delete attachments.


So if you want to do editing, use temporal features, FeatureLayer is your choice.
FeatureLayer is essentially a GraphicsLayer with some sugar, i.e., built in QueryTask.

You wouldn't use DynamicMapServiceLayer directly, as it is a base class.
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/DynamicMapServiceLayer.html

But what it does allow you to do is something like
if (layer is DynamicMapServiceLayer)
{
    // do something to apply to all subclasses
}

//as opposed to writing
if (layer is ArcGISDynamicMapServiceLayer || layer is ArcGISImageServiceLayer || layer is ArcIMSMapServiceLayer || layer is GPResultImageLayer || layer is WMSLayer)
{
    // do the same thing
}


You can view the Layers in the layers package here, each with some some descriptions
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/package-detail.html
0 Kudos