| Package | com.esri.ags.layers |
| Class | public class FeatureLayer |
| Inheritance | FeatureLayer GraphicsLayer Layer mx.core.UIComponent |
| Since : | ArcGIS API for Flex 2.0 |
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.
The FeatureLayer will, by default, use the drawing information from the server (requires ArcGIS Server 10 or above). Note that the ArcGIS Desktop and Server uses symbol sizes in Point values, while Adobe Flex and the Flex API use pixels. Thus, a point that is setup to be 10 "points" in your mxd, will have a Flex symbol that is 13 pixels (based on the assumed 96 dpi).
Set the url to the ArcGIS Server REST resource that represents a single layer or table, e.g. http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/MapServer/1. Note the number "1" at the end of the URL which indicates which specific layer you want to query. For more information on constructing a URL, see Using the ArcGIS Services Directory.
Note that FeatureLayer, like all layers, extend UIComponent and thus include basic mouse events, such as: click, mouseOut, mouseOver, and mouseDown, as well as other events like show and hide, and general properties, such as alpha, mouseChildren, toolTip and visible.
Default MXML PropertygraphicProvider
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | clusterer : IClusterer
The graphics clusterer. | GraphicsLayer | |
| definitionExpression : String
The definition expression limits the FeatureLayer to a subset of the available features in the map service layer. | FeatureLayer | ||
| disableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from
being loaded from the browser's cache. | FeatureLayer | ||
| featureCollection : FeatureCollection
The featureCollection is used when you want to initialize the FeatureLayer with features from outside of ArcGIS Server. | FeatureLayer | ||
| graphicProvider : Object [override]
This inherited property returns an ArrayCollection of all the graphics currently in the layer,
but unlike GraphicsLayer, this should be treated as a read-only property and modifications
to the returned ArrayCollection are ignored. | FeatureLayer | ||
![]() | infoWindowRenderer : IFactory
The info renderer. | GraphicsLayer | |
![]() | initialExtent : Extent [override]
Initial extent of the layer. | GraphicsLayer | |
| isEditable : Boolean [read-only]
True if the FeatureLayer is editable, for example pointing to an editable layer in a FeatureService. | FeatureLayer | ||
![]() | isInScaleRange : Boolean [read-only]
Returns true if the current scale of the map is between the maximum and minimum scale of the layer [added in version 1.3]. | Layer | |
| layerDetails : LayerDetails [read-only]
Detailed information about a layer in a map or feature service. | FeatureLayer | ||
![]() | loaded : Boolean [read-only]
When the layer is loaded, the value becomes "true" and layer properties can be accessed. | Layer | |
![]() | map : Map [read-only]
A reference to the Map this layer is in. | Layer | |
| maxAllowableOffset : Number
The maximum allowable offset used for generalizing geometries returned by the Query operation. | FeatureLayer | ||
![]() | maxScale : Number
The maximum scale of the layer [added in version 1.3]. | Layer | |
![]() | minScale : Number
The minimum scale of the layer [added in version 1.3]. | Layer | |
| mode : String
Query mode for a feature layer. | FeatureLayer | ||
![]() | numGraphics : int [read-only]
Get the number of graphics in that layer. | GraphicsLayer | |
| onDemandCacheSize : uint
When the query mode is MODE_ON_DEMAND and there are more than this number
of features loaded, features that are not selected and are not in the current
extent are removed in FIFO order. | FeatureLayer | ||
| outFields : Array
Attribute fields to include in the FeatureSet. | FeatureLayer | ||
| proxyURL : String
The URL to proxy the request through. | FeatureLayer | ||
![]() | renderer : Renderer
The renderer allows for the symbol of the graphic to be dynamically picked - for example
based on attributes or position of the graphic, or based on the scale of the map, or anything else. | GraphicsLayer | |
| requestTimeout : Number
The request timeout in seconds. | FeatureLayer | ||
| selectedFeatures : Array [read-only]
The features in the current selection of this feature layer. | FeatureLayer | ||
| selectionColor : uint
Selection color to highlight the current selection. | FeatureLayer | ||
![]() | spatialReference : SpatialReference [override]
The spatial reference of the map layer. | GraphicsLayer | |
![]() | symbol : Symbol
The default symbol for the layer. | GraphicsLayer | |
| tableDetails : TableDetails [read-only]
Detailed information about a table in a map or feature service. | FeatureLayer | ||
| timeDefinition : TimeExtent
Defines the time extent of features loaded in snapshot mode. | FeatureLayer | ||
| timeOffset : Number
The time offset for the layer. | FeatureLayer | ||
| timeOffsetUnits : String
The units of the timeOffset. | FeatureLayer | ||
| token : String
Token for accessing a secure ArcGIS service. | FeatureLayer | ||
| trackIdField : String
trackIdField
| FeatureLayer | ||
![]() | units : String [override]
The units of the layer. | GraphicsLayer | |
| url : String
URL to the ArcGIS Server REST resource that represents a feature layer. | FeatureLayer | ||
| useAMF : Boolean
Use AMF when loading features and for queryFeatures(), queryRelatedFeatures() and selectFeatures(). | FeatureLayer | ||
| Method | Defined By | ||
|---|---|---|---|
FeatureLayer(url:String = null, proxyURL:String = null, token:String = null)
Creates a new FeatureLayer object. | FeatureLayer | ||
[override]
add() is not supported. | FeatureLayer | ||
addAttachment(objectId:Number, data:ByteArray, name:String, contentType:String = null, responder:IResponder = null):AsyncToken
Add attachment to a feature (using its ObjectID). | FeatureLayer | ||
applyEdits(adds:Array, updates:Array, deletes:Array, responder:IResponder = null):AsyncToken
Saves edits on the server. | FeatureLayer | ||
clear():void [override]
clear() is not supported. | FeatureLayer | ||
clearSelection():void
Clears the current selection set. | FeatureLayer | ||
deleteAttachments(objectId:Number, attachmentIds:Array, responder:IResponder = null):AsyncToken
Delete one or more attachments for a feature. | FeatureLayer | ||
![]() |
Moves a specific graphic to the top of the stack. | GraphicsLayer | |
queryAttachmentInfos(objectId:Number, responder:IResponder = null):AsyncToken
Information about attachment(s) for a specific ObjectID. | FeatureLayer | ||
queryFeatures(parameters:Query, responder:IResponder = null):AsyncToken
Query features from the feature layer. | FeatureLayer | ||
Query for object IDs. | FeatureLayer | ||
queryRelatedFeatures(parameters:RelationshipQuery, responder:IResponder = null):AsyncToken
Query related features from this feature layer. | FeatureLayer | ||
![]() | refresh():void
Causes the layer to redraw or reload its content. | Layer | |
[override]
remove() is not supported. | FeatureLayer | ||
selectFeatures(query:Query, selectionMethod:String = new, responder:IResponder = null):AsyncToken
Sets or modifies the current set of selected features. | FeatureLayer | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when an addAttachment operation successfully completes. | FeatureLayer | |||
| Dispatched when a deleteAttachments operation successfully completes. | FeatureLayer | |||
| Dispatched when an applyEdits operation successfully completes. | FeatureLayer | |||
| Dispatched when applyEdits is called, but before the edits request is sent to the server. | FeatureLayer | |||
| Dispatched when a FeatureLayer operation fails. | FeatureLayer | |||
![]() | Fires when a graphic is added to the GraphicsLayer. | GraphicsLayer | ||
![]() | Fires when a graphic is removed from the GraphicsLayer. | GraphicsLayer | ||
![]() | Fires when all graphics in the GraphicsLayer are cleared. | GraphicsLayer | ||
![]() | Fires if the value of isInScaleRange changes. | Layer | ||
![]() | Fires after layer properties for the layer are successfully populated. | Layer | ||
![]() | Fires if the layer is unable to load. | Layer | ||
| Dispatched when a queryAttachmentInfos operation successfully completes. | FeatureLayer | |||
| Dispatched when a queryFeatures operation successfully completes. | FeatureLayer | |||
| Dispatched when a queryIds operation successfully completes. | FeatureLayer | |||
| Dispatched when a queryRelatedFeatures operation successfully completes. | FeatureLayer | |||
| Dispatched when a clearSelection operation successfully completes. | FeatureLayer | |||
| Dispatched when a selectFeatures operation successfully completes. | FeatureLayer | |||
![]() | Fires when the layer has finished updating its content. | Layer | ||
![]() | Fires when the layer begins to update its content. | Layer | ||
| Constant | Defined By | ||
|---|---|---|---|
| MODE_ON_DEMAND : String = onDemand [static]
Features will be retrieved as needed, when extent, time and layer definition changes.. | FeatureLayer | ||
| MODE_SELECTION : String = selection [static]
Only selected features will retrieved from server and be stored in memory on the client. | FeatureLayer | ||
| MODE_SNAPSHOT : String = snapshot [static]
All features will be retrieved from server and stored in memory on the client. | FeatureLayer | ||
| SELECTION_ADD : String = add [static]
Adds features to current set of selected features. | FeatureLayer | ||
| SELECTION_NEW : String = new [static]
Creates a new set of selected features. | FeatureLayer | ||
| SELECTION_SUBTRACT : String = subtract [static]
Removes features from the current set of selected features. | FeatureLayer | ||
| definitionExpression | property |
definitionExpression:StringThe definition expression limits the FeatureLayer to a subset of the available features in the map service layer. It is similar to the definition query for a layer in ArcMap.
When using definitionExpression while editing, you will only see your added and modified features if the new or updated feature is part of the definitionExpression.
This property can be used as the source for data binding.
public function get definitionExpression():String public function set definitionExpression(value:String):voidSee also
| disableClientCaching | property |
disableClientCaching:BooleanIf true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.
The default value is false.
This property can be used as the source for data binding.
public function get disableClientCaching():Boolean public function set disableClientCaching(value:Boolean):void| featureCollection | property |
featureCollection:FeatureCollectionThe featureCollection is used when you want to initialize the FeatureLayer with features from outside of ArcGIS Server. The feature layer, when initialized with a featureCollection has the following behavior:
This property can be used as the source for data binding.
public function get featureCollection():FeatureCollection public function set featureCollection(value:FeatureCollection):voidSee also
| graphicProvider | property |
graphicProvider:Object[override] This inherited property returns an ArrayCollection of all the graphics currently in the layer, but unlike GraphicsLayer, this should be treated as a read-only property and modifications to the returned ArrayCollection are ignored.
public function get graphicProvider():Object public function set graphicProvider(value:Object):void| isEditable | property |
isEditable:Boolean [read-only] True if the FeatureLayer is editable, for example pointing to an editable layer in a FeatureService.
This property can be used as the source for data binding.
public function get isEditable():Boolean| layerDetails | property |
layerDetails:LayerDetails [read-only] Detailed information about a layer in a map or feature service.
This property can be used as the source for data binding.
public function get layerDetails():LayerDetails| maxAllowableOffset | property |
maxAllowableOffset:NumberThe maximum allowable offset used for generalizing geometries returned by the Query operation. The units are the same as the returned features.
This property can be used as the source for data binding.
public function get maxAllowableOffset():Number public function set maxAllowableOffset(value:Number):void| mode | property |
mode:StringQuery mode for a feature layer. See the MODE_* constants for possible values. The default mode is to query on demand as the extent, time and layer definition changes. The snapshot mode will make one up-front request for all the features.
The onDemand mode - MODE_ON_DEMAND - features are fetched from the server as they are needed.
The snapshot mode - MODE_SNAPSHOT - features are fetched from the server based on DefinitionExpression and/or TimeDefinition. When either definition change, the layer updates itself by querying features back from the server. Once the features are fetched to the client, their "visibility" on the map is based on the time and spatial extents of the map. So for example, for a time animation, you can request all features from server, then adjust time extent on Map to only show some of them.
The selection mode - MODE_SELECTION - only selected features are available on the client side. Usually used in combination with an underlying map service showing the features that can be selected.
The default value is MODE_ON_DEMAND.
This property can be used as the source for data binding.
public function get mode():String public function set mode(value:String):void| onDemandCacheSize | property |
onDemandCacheSize:uintWhen the query mode is MODE_ON_DEMAND and there are more than this number of features loaded, features that are not selected and are not in the current extent are removed in FIFO order. If this value is 0, features in the current extent are also removed.
The default value is 1000 features.
This property can be used as the source for data binding.
public function get onDemandCacheSize():uint public function set onDemandCacheSize(value:uint):void| outFields | property |
outFields:Array| Since : | ArcGIS API for Flex 2.0 |
Attribute fields to include in the FeatureSet. Fields must exist in the layer. You must list the actual field names rather than the alias names. Returned fields are also the actual field names. However, you are able to use the alias names when you display the results.
For optimal performance, limit the output fields to only those you expect to use.
Each query must have access to the Shape and Objectid fields for a layer, but your list of fields does not need to include these two fields.
To return all fields, specify the wildcard "*" as the value of this parameter. In this case, the query results include all the fields.
Note that with ArcGIS Server 10.0 the wildcard no longer implicitly implies returnGeometry=true.
This property can be used as the source for data binding.
public function get outFields():Array public function set outFields(value:Array):void
myFeatureLayer.outFields = ["CITY_NAME","AGE_UNDER5","AGE_5_17","AGE_18_64","AGE_65_UP"];
myFeatureLayer.outFields = ["*"];| proxyURL | property |
proxyURL:StringThe URL to proxy the request through.
This property can be used as the source for data binding.
public function get proxyURL():String public function set proxyURL(value:String):void| requestTimeout | property |
requestTimeout:NumberThe request timeout in seconds. A value less than or equal to zero prevents request timeout.
The default value is -1.
This property can be used as the source for data binding.
public function get requestTimeout():Number public function set requestTimeout(value:Number):void| selectedFeatures | property |
selectedFeatures:Array [read-only] The features in the current selection of this feature layer.
This property can be used as the source for data binding.
public function get selectedFeatures():ArraySee also
| selectionColor | property |
selectionColor:uintSelection color to highlight the current selection.
The default value is 0xFFFF00 (yellow).
This property can be used as the source for data binding.
public function get selectionColor():uint public function set selectionColor(value:uint):void| tableDetails | property |
tableDetails:TableDetails [read-only] Detailed information about a table in a map or feature service.
This property can be used as the source for data binding.
public function get tableDetails():TableDetails| timeDefinition | property |
timeDefinition:TimeExtentDefines the time extent of features loaded in snapshot mode.
This property can be used as the source for data binding.
public function get timeDefinition():TimeExtent public function set timeDefinition(value:TimeExtent):void| timeOffset | property |
timeOffset:NumberThe time offset for the layer.
This property can be used as the source for data binding.
public function get timeOffset():Number public function set timeOffset(value:Number):void| timeOffsetUnits | property |
timeOffsetUnits:StringThe units of the timeOffset.
This property can be used as the source for data binding.
public function get timeOffsetUnits():String public function set timeOffsetUnits(value:String):voidSee also
| token | property |
token:StringToken for accessing a secure ArcGIS service.
This property can be used as the source for data binding.
public function get token():String public function set token(value:String):void| trackIdField | property |
trackIdField:StringtrackIdField
This property can be used as the source for data binding.
public function get trackIdField():String public function set trackIdField(value:String):void| url | property |
url:StringURL to the ArcGIS Server REST resource that represents a feature layer.
This property can be used as the source for data binding.
public function get url():String public function set url(value:String):void| useAMF | property |
useAMF:BooleanUse AMF when loading features and for queryFeatures(), queryRelatedFeatures() and selectFeatures(). When useAMF is true, the requestTimeout property is ignored.
The default value is true if using ArcGIS Server 10.0 or above; false otherwise.
This property can be used as the source for data binding.
public function get useAMF():Boolean public function set useAMF(value:Boolean):void| FeatureLayer | () | Constructor |
public function FeatureLayer(url:String = null, proxyURL:String = null, token:String = null)Creates a new FeatureLayer object.
Parametersurl:String (default = null) — URL to the ArcGIS Server REST resource that represents a feature layer.
| |
proxyURL:String (default = null) — The URL to proxy the request through.
| |
token:String (default = null) — Token for accessing a secure ArcGIS service.
|
| add | () | method |
override public function add(graphic:Graphic):Stringadd() is not supported. Use applyEdits().
Parameters
graphic:Graphic |
String |
| addAttachment | () | method |
public function addAttachment(objectId:Number, data:ByteArray, name:String, contentType:String = null, responder:IResponder = null):AsyncTokenAdd attachment to a feature (using its ObjectID).
Parameters
objectId:Number — The ObjectID.
| |
data:ByteArray — The byte array of the attachment.
| |
name:String — The name of the attachment
| |
contentType:String (default = null) — If not set, the name is checked for one of (avi, csv, doc, docx, f4v, flv, gif, htm, html, jpeg, jpg, mov, mpeg, mpg, pdf, png, ppt, pptx, swf, tif, txt, xls, xlsx, xml, zip), and if no match is found, the contentType is set to application/octet-stream.
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| applyEdits | () | method |
public function applyEdits(adds:Array, updates:Array, deletes:Array, responder:IResponder = null):AsyncTokenSaves edits on the server. Only applicable for an editable layer that is part of a Feature Service. Make sure the FeatureLayer is loaded before you attempt applyEdits on it.
Parameters
adds:Array — Array of features to add to the layer in the feature service.
| |
updates:Array — Array of features to modify. Must have valid objectId.
| |
deletes:Array — Array of features to delete. Must have valid objectId.
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| clear | () | method |
override public function clear():voidclear() is not supported.
| clearSelection | () | method |
public function clearSelection():voidClears the current selection set.
| deleteAttachments | () | method |
public function deleteAttachments(objectId:Number, attachmentIds:Array, responder:IResponder = null):AsyncTokenDelete one or more attachments for a feature.
Parameters
objectId:Number — The ObjectID.
| |
attachmentIds:Array — The array of attachment IDs.
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| queryAttachmentInfos | () | method |
public function queryAttachmentInfos(objectId:Number, responder:IResponder = null):AsyncTokenInformation about attachment(s) for a specific ObjectID. Used to find out if a feature has attachments.
Parameters
objectId:Number — The ObjectID.
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| queryFeatures | () | method |
public function queryFeatures(parameters:Query, responder:IResponder = null):AsyncTokenQuery features from the feature layer. Current layer properties (layer definition, time definition) will be honored and passed into the query.
Parameters
parameters:Query — The selection query.
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| queryIds | () | method |
public function queryIds(parameters:Query, responder:IResponder = null):AsyncTokenQuery for object IDs. Note that there is no limit on the number of object IDs that can be returned from the server.
Parameters
parameters:Query — The selection query.
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| queryRelatedFeatures | () | method |
public function queryRelatedFeatures(parameters:RelationshipQuery, responder:IResponder = null):AsyncTokenQuery related features from this feature layer.
Parameters
parameters:RelationshipQuery — The selection query.
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| remove | () | method |
override public function remove(graphic:Graphic):voidremove() is not supported. Use applyEdits().
Parameters
graphic:Graphic |
| selectFeatures | () | method |
public function selectFeatures(query:Query, selectionMethod:String = new, responder:IResponder = null):AsyncTokenSets or modifies the current set of selected features. You can create a new selection (the default selection mode), as well as adding to or removing from the current selection. See the SELECTION_* constants for more details.
Parameters
query:Query — The selection query.
| |
selectionMethod:String (default = new) — The selection method (SELECTION_NEW, SELECTION_ADD or SELECTION_SUBTRACT).
| |
responder:IResponder (default = null) — The responder to call on result or fault.
|
AsyncToken —
|
| addAttachmentComplete | Event |
com.esri.ags.events.AttachmentEventcom.esri.ags.events.AttachmentEvent.ADD_ATTACHMENT_COMPLETEDispatched when an addAttachment operation successfully completes.
Defines the value of thetype property of the event object for a addAttachmentComplete event.
| deleteAttachmentsComplete | Event |
com.esri.ags.events.AttachmentEventcom.esri.ags.events.AttachmentEvent.DELETE_ATTACHMENTS_COMPLETEDispatched when a deleteAttachments operation successfully completes.
Defines the value of thetype property of the event object for a deleteAttachmentsComplete event.
| editsComplete | Event |
com.esri.ags.events.FeatureLayerEventcom.esri.ags.events.FeatureLayerEvent.EDITS_COMPLETEDispatched when an applyEdits operation successfully completes.
Defines the value of thetype property of the event object for a editsComplete event.
| editsStarting | Event |
com.esri.ags.events.FeatureLayerEventcom.esri.ags.events.FeatureLayerEvent.EDITS_STARTINGDispatched when applyEdits is called, but before the edits request is sent to the server. This event is cancelable by calling event.preventDefault() which will stop the request from being sent.
Defines the value of thetype property of the event object for a editsStarting event.
| fault | Event |
mx.rpc.events.FaultEventmx.rpc.events.FaultEvent.FAULTDispatched when a FeatureLayer operation fails.
| queryAttachmentInfosComplete | Event |
com.esri.ags.events.AttachmentEventcom.esri.ags.events.AttachmentEvent.QUERY_ATTACHMENT_INFOS_COMPLETEDispatched when a queryAttachmentInfos operation successfully completes.
Defines the value of thetype property of the event object for a queryAttachmentInfosComplete event.
| queryFeaturesComplete | Event |
com.esri.ags.events.FeatureLayerEventcom.esri.ags.events.FeatureLayerEvent.QUERY_FEATURES_COMPLETEDispatched when a queryFeatures operation successfully completes.
Defines the value of thetype property of the event object for a queryFeaturesComplete event.
| queryIdsComplete | Event |
com.esri.ags.events.FeatureLayerEventcom.esri.ags.events.FeatureLayerEvent.QUERY_IDS_COMPLETEDispatched when a queryIds operation successfully completes.
Defines the value of thetype property of the event object for a queryIdsComplete event.
| queryRelatedFeaturesComplete | Event |
com.esri.ags.events.FeatureLayerEventcom.esri.ags.events.FeatureLayerEvent.QUERY_RELATED_FEATURES_COMPLETEDispatched when a queryRelatedFeatures operation successfully completes.
Defines the value of thetype property of the event object for a queryRelatedFeaturesComplete event.
| selectionClear | Event |
com.esri.ags.events.FeatureLayerEventcom.esri.ags.events.FeatureLayerEvent.SELECTION_CLEARDispatched when a clearSelection operation successfully completes.
Defines the value of thetype property of the event object for a selectionClear event.
| selectionComplete | Event |
com.esri.ags.events.FeatureLayerEventcom.esri.ags.events.FeatureLayerEvent.SELECTION_COMPLETEDispatched when a selectFeatures operation successfully completes.
Defines the value of thetype property of the event object for a selectionComplete event.
| MODE_ON_DEMAND | Constant |
public static const MODE_ON_DEMAND:String = onDemandFeatures will be retrieved as needed, when extent, time and layer definition changes..
| MODE_SELECTION | Constant |
public static const MODE_SELECTION:String = selectionOnly selected features will retrieved from server and be stored in memory on the client.
| MODE_SNAPSHOT | Constant |
public static const MODE_SNAPSHOT:String = snapshotAll features will be retrieved from server and stored in memory on the client.
| SELECTION_ADD | Constant |
public static const SELECTION_ADD:String = addAdds features to current set of selected features.
| SELECTION_NEW | Constant |
public static const SELECTION_NEW:String = newCreates a new set of selected features.
| SELECTION_SUBTRACT | Constant |
public static const SELECTION_SUBTRACT:String = subtractRemoves features from the current set of selected features.