Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: FeatureLayer

dojo.require("esri.layers.FeatureLayer");

Description

(Added at v2.0)
The feature layer inherits from the graphics layer and can be used to display features from a single layer in either a Map Service or Feature Service. The layer can be either a (spatial) layer or (non-spatial) table. The features in a feature layer can be edited if the isEditable method is true.

The FeatureLayer will, by default, use the drawing information from the server (requires ArcGIS Server 10 or above). For an example, see the simple renderer in the Drawing Info at https://www.example.com/argis/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0

WebGL rendering

Starting at version 3.24, you can opt in to render FeatureLayer with WebGL. This allows you to display more data in the map and update the visualization of features more rapidly. To enable WebGL rendering of FeatureLayer, paste the following script in your application prior to loading the ArcGIS API for JavaScript:

<script>
  var dojoConfig = {
    has: {
      "esri-featurelayer-webgl": 1
    }
  };
</script>

Once enabled globally for the app, WebGL can be toggled on/off using the API below:

Known Limitations

The following are current limitations of WebGL-rendered FeatureLayers subject to change in future releases. If any of these conditions are not met, then the layer will automatically switch from WebGL to SVG during the session.

  • Support is limited to layers created from feature services hosted on ArcGIS Online and non-hosted enterprise feature services versions 10.6.1 or later. FeatureLayers created from FeatureCollections are not supported.
  • Polygon layers must support returning centroids.
  • The layer must not be editable.
  • The layer must not be clustered.
  • The layer must use on-demand fetch mode.
  • The layer must not use labels.
  • The layer must not use Arcade expressions containing geometry operations.
  • The layer's renderer must be of type SimpleRenderer, ClassBreaksRenderer, or UniqueValueRenderer.
  • Color and opacity visual variables must have 8 stops or less.
  • Attribute-driven size visual variables must have 6 stops or less. This does not affect variables driven by map scale.
  • Line symbols must not have arrow markers.
  • Selection symbol is not supported.

Note that only the click event will fire when WebGL is enabled. All other events are not supported. FeatureLayer subclasses do not support WebGL rendering. Also note that modifying attributes, symbol, geometry and visibility of individual features in a WebGL-rendered layer will NOT have any effect.

Samples

Search for samples that use this class.

Class hierarchy

esri/layers.Layer
|_esri/layers.GraphicsLayer
  |_esri/layers.FeatureLayer

Subclasses

Constructors

NameSummary
new esri.layers.FeatureLayer(url, options?)Creates a new instance of a feature layer object from the ArcGIS Server REST resource identified by the input URL.
new esri.layers.FeatureLayer(featureCollectionObject, options?)Creates a new instance of a feature layer using a FeatureCollection object.

Constants

NameDescription
MODE_AUTO

Delegate to either on-demand or snapshot mode depending on the characteristics of the service. This is only applicable to hosted feature services.

If the total number of features in a layer are less than maxRecordCount and total vertexes is less than 250,000, snapshot mode is used. Otherwise, on-demand mode is used. The purpose behind this mode is to reduce server-side load. Instead of getting a small number of features with several requests (on-demand mode), get all features with a single request. This mode requires an additional request to complete before retrieving any features.

MODE_ONDEMAND

In on-demand mode, the feature layer retrieves features from the server when needed. This is based on the requirements defined in the following properties:

  • Map properties such as the current spatial extent and time extent.
  • Layer properties such as time offset and definition expression.
MODE_SELECTION

In selection mode, features are retrieved from the server only when they are selected. Features are available on the client only while they are selected. To work with selected features:

  1. Call the selectFeatures method.
  2. Listen for the onSelectionComplete event.
  3. Once onSelectionComplete fires, retrieve the selected features using the getSelectedFeatures method.

When editing feature layers in selection mode, you will need to add the map service associated with the feature service to the map as a dynamic map service. If you do not have the map service added as a dynamic map service then the changes will not be visible because once the edits are complete the feature is no longer selected.

MODE_SNAPSHOTIn snapshot mode, the feature layer retrieves all the features from the associated layer resource and displays them as graphics on the client. Definition expressions and time definitions are honored. The features are retrieved once the feature layer is added to the map. After the onUpdateEnd event has fired, you can access the features using the graphics property of the layer or through selection and query operations.
POPUP_HTML_TEXTThe popup displays content in HTML/TEXT.
POPUP_NONENo popup type defined.
POPUP_URLThe popup displays the contents of a URL.
SELECTION_ADDAdds features to the current selection set.
SELECTION_NEWCreates a new selection.
SELECTION_SUBTRACTRemoves features from the current selection.

Properties

NameTypeSummary
advancedQueryCapabilitiesObjectAn object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents.
allowGeometryUpdatesBooleanReturns true if the geometry of the features in the layer can be edited, false otherwise.
allowUpdateWithoutMValuesBooleanIndicates whether attribute features containing m-values can be edited.
attributionDataUrlStringThe URL, when available, where the layer's attribution data is stored.
capabilitiesStringInformation about the capabilities enabled for this layer.
classNameStringclass attribute of the layer's node.
copyrightStringCopyright information for the layer.
credentialCredentialProvides credential information for the layer such as userid and token if the layer represents a resource that is secured with token-based authentication.
dataAttributesString | String[]List of attribute fields added as custom data attributes to graphics node.
defaultDefinitionExpressionStringMetadata describing the default definition expression for the layer as defined by the service.
defaultVisibilityBooleanIndicates the default visibility for the layer.
descriptionStringThe description of the layer as defined in the map service.
displayFieldStringThe name of the layer's primary display field.
editFieldsInfoObjectIndicates the field names for the editor fields.
editingInfoObjectApplicable to ArcGIS Online hosted feature services.
fieldsField[]The array of fields in the layer.
fullExtentExtentThe full extent of the layer.
gdbVersionStringThe geodatabase version.
geometryTypeStringGeometry type of the features in the layer.
globalIdFieldStringThe globalIdField for the layer.
graphicsGraphic[]Array of features in the layer.
hasAllFeaturesBooleanIndicates whether the layer displays all features intersecting the current view.
hasAttachmentsBooleanTrue if attachments are enabled on the feature layer.
hasAttributionDataBooleanWhen true, the layer has attribution data.
htmlPopupTypeStringThe html popup type defined for the layer.
idStringID assigned to the layer.
infoTemplateInfoTemplateThe info template for the layer.
labelingInfoLabelClass[]Label definition for this layer, specified as an array of label classes.
layerIdNumberUnique ID of the layer that the FeatureLayer was constructed against.
loadErrorErrorSet if the layer failed to load.
loadedBooleanWhen the layer is loaded, the value becomes "true", and layer properties can be accessed.
maxAllowableOffsetNumberThe maximum allowable offset, only applicable for layers that are not editable.
maxRecordCountNumberThe maximum number of results that will be returned from a query.
maxScaleNumberMaximum visible scale for the layer.
minScaleNumberMinimum visible scale for the layer.
multipatchOptionStringSupports feature services whose data source is a multipatch featureclass.
  • Default is xyFootprint if geometryType is esriGeometryMultiPatch.
nameStringThe name of the layer as defined in the map service.
objectIdFieldStringThe name of the field that contains the Object ID field for the layer.
opacityNumberOpacity or transparency of layer.
ownershipBasedAccessControlForFeaturesObjectIndicates the ownership access control configuration.
refreshIntervalNumberRefresh interval of the layer in minutes.
relationshipsObject[]Each element in the array is an object that describes the layer's relationship with another layer or table.
rendererRendererThe renderer for the layer.
showAttributionBooleanWhen true, the layer's attribution is displayed on the map.
showLabelsBooleanDetermines if labels are displayed.
sourceLayerSourceThe dynamic layer or table source.
stylingBooleanIndicates whether the layer is responsible for styling graphics.
supportsAdvancedQueriesBooleanWhen true, the layer supports orderByFields in a query operation.
supportsAttachmentsByUploadIdBooleanWhen true, the layer supports uploading attachments with Uploads REST operation, which then can be used in the Add Attachment or Update Attachment REST operations.
supportsCalculateBooleanWhen true, the layer supports the Calculate REST operation when updating features.
supportsFieldDescriptionBooleanIf true, the layer supports a user-defined field description.
supportsStatisticsBooleanWhen true, the layer supports statistical functions in query operations.
surfaceTypeStringType of vector graphics surface used to draw graphics.
suspendedBooleanWhen true, the layer is suspended.
templatesFeatureTemplate[]An array of feature templates defined in the Feature Service layer.
timeInfoTimeInfoTime information for the layer, such as start time field, end time field, track id field, layers time extent and the draw time interval.
typeStringSpecifies the type of layer.
typeIdFieldStringThe field that represents the Type ID field.
typesFeatureType[]An array of sub types defined in the Feature Service layer.
urlStringURL to the ArcGIS Server REST resource that represents a map service.
versionNumberThe version of ArcGIS Server where the layer is published.
visibleBooleanVisibility of the layer.
visibleAtMapScaleBooleanWhen true, the layer is visible at the current map scale.
webglEnabledBooleanIndicates if WebGL is enabled on the layer.

Methods

NameReturn typeSummary
addAttachment(objectId, formNode, callback?, errback?)DeferredAdd an attachment to the feature specified by the ObjectId.
applyEdits(adds?, updates?, deletes?, callback?, errback?)DeferredApply edits to the feature layer.
attr(name, value)LayerAdds a new attribute or changes the value of an existing attribute on the layer's node.
clearSelection()FeatureLayerClears the current selection.
deleteAttachments(objectId, attachmentIds, callback?, errback?)DeferredDelete one or more attachments for the feature specified by the input ObjectId.
disableFeatureReduction()NoneDisables feature reduction (for example clustering) on the layer.
disableMouseEvents()NoneDisables all mouse events on the graphics layer.
enableFeatureReduction()NoneEnables feature reduction (for example clustering) on the layer using the options set in setFeatureReduction().
enableMouseEvents()NoneEnables all mouse events on the graphics layer.
getAggregateGraphics()Graphic[]Returns graphics representing the aggregation of several point features clustered together.
getAttributionData()DeferredAsynchrously returns custom data for the layer when available.
getDefinitionExpression()StringReturns the current definition expression.
getDomain(fieldName, options?)DomainReturns the Domain associated with the given field name.
getEditCapabilities(options?)ObjectReturns an object that describes the edit capabilities of the layer.
getEditInfo(feature, options?)ObjectReturns an object describing the most recent edit operation performed on the given feature, if available.
getEditSummary(feature, options?)StringReturns a localized summary of the last edit operation performed on the given feature, if available.
getFeatureReduction()ObjectReturns the options used to reduce the number of features visualized by the layer (for example clustering).
getField(fieldName)FieldReturns the Field given the specified field name.
getMap()MapReturns reference to the map control the layer is added to.
getMaxAllowableOffset()NumberReturns the current value of the maxAllowableOffset used by the layer.
getNode()HTMLElementReturns the layer's DOM node.
getOrderByFields()String[]Returns the list of fields used to order features by.
getSelectedFeatures()Graphic[]Gets the currently selected features.
getSelectionSymbol()SymbolGets the current selection symbol.
getSingleGraphics()Graphic[]Returns graphics from the layer that are not represented by aggregate graphics when feature reduction (such as clustering) is enabled.
getTimeDefinition()TimeExtentGet the current time definition applied to the feature layer.
getType(feature)FeatureTypeReturns a FeatureType describing the feature's type.
hasUpdateError()NoneIndicates whether an error is thrown after the layer updates.
hasWebGLSurface()BooleanIndicates if the layer is rendered in WebGL.
hasXYFootprint()BooleanReturns true if geometryType is esriGeometryMultipatch and multipatchOption is xyFootprint.
hide()NoneSets the visibility of the layer to "false".
isEditable()BooleanReturns true if the FeatureLayer is editable.
isFeatureReductionActive()BooleanIndicates if feature reduction (for example clustering) is active in the view.
isFeatureReductionEnabled()BooleanIndicates if feature reduction (for example clustering) is enabled.
isVisibleAtScale(scale)BooleanReturns true if the layer is visible at the given scale.
queryAttachmentInfos(objectId, callback?, errback?)DeferredQuery for information about attachments associated with the specified ObjectIds.
queryCount(query, callback?, errback?)DeferredGet a count of the number of features that satisfy the input query.
queryExtent(query, callback?, errback?)DeferredGet the extent of features that satisfy the input query.
queryFeatures(query, callback?, errback?)DeferredQuery features from the feature layer.
queryIds(query, callback?, errback?)DeferredQuery for ObjectIds.
queryRelatedFeatures(relQuery, callback?, errback?)DeferredQuery features or records, from another layer or table, related to features in this layer.
redraw()NoneRedraws all the graphics in the graphics layer.
refresh()NoneRefreshes the features in the feature layer.
resume()NoneResumes layer drawing.
selectFeatures(query, selectionMethod?, callback?, errback?)DeferredSelects features from the FeatureLayer.
setAutoGeneralize(enable)FeatureLayerEnable or disable auto generalization for the layer.
setDefinitionExpression(expression)FeatureLayerSets the definition expression for the FeatureLayer.
setEditable(editable)FeatureLayerSet the editability of feature layers created from a feature collection.
setFeatureReduction(options)NoneSets feature reduction options on the layer (for example clustering options).
setGDBVersion(versionName)FeatureLayerSet the layer's data source to the specified geodatabase version.
setInfoTemplate(infoTemplate)NoneSpecify or change the info template for a layer.
setLabelingInfo(labelingInfo)NoneSets labeling info on the layer.
setMaxAllowableOffset(offset)NoneSets the maximum allowable offset used when generalizing geometries.
setMaxScale(scale)NoneSet the maximum scale for the layer.
setMinScale(scale)NoneSet the minimum scale for the layer.
setOpacity(opacity)NoneInitial opacity or transparency of layer.
setRefreshInterval(interval)LayerChanges the layer's refresh interval to the given value (in minutes).
setRenderer(renderer)NoneSet the renderer for the feature layer.
setScaleRange(minScale, maxScale)NoneSet the scale range for the layer.
setSelectionSymbol(symbol)FeatureLayerSets the selection symbol for the feature layer.
setShowLabels(showLabels)NoneSets whether to display labels or not.
setTimeDefinition(definition)FeatureLayerSets the time definition for the feature layer.
setTimeOffset(offsetValue, offsetUnits)FeatureLayerTime offset allows you to display the features at a different time so they can be overlaid on top of previous or future time periods.
setUseMapTime(update)NoneDetermine if the layer will update its content based on the map's current time extent.
setVisibility(isVisible)NoneSets the visibility of the layer.
setWebGLEnabled(enable)NoneToggles WebGL rendering on/off on the layer.
show()NoneSets the visibility of the layer to "true".
suspend()NoneSuspends layer drawing.
toJson()ObjectReturns an easily serializable object representation of the layer.

Events

[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.

Events

NameEvent ObjectSummary
add-attachment-complete
{
  result: <FeatureEditResult>
}
Fires when addAttachments() is complete.
before-apply-edits
{
  adds: <Graphic[]>,
  deletes: <Graphic[]>,
  updates: <Graphic[]>
}
Fired before edits are applied to the feature layer.
capabilities-changeFired when the capabilities of the layer are modified using the setEditable method.
click
{
  event: <Object>
}
Fires when a graphic has been clicked.
dbl-click
{
  event: <Object>
}
Fires when a feature has been double clicked.
delete-attachments-complete
{
  results: <Object[]>
}
Fires when deleteAttachments is complete.
edits-complete
{
  adds: <FeatureEditResult[]>,
  deletes: <FeatureEditResult[]>,
  updates: <FeatureEditResult[]>
}
Fires after applyEdits() is complete.
error
{
  error: <Error>
}
Fires when there is a problem retrieving a layer.
gdb-version-changeFired when the geodatabase version is switched.
graphic-add
{
  graphic: <Graphic>
}
Fires when a graphic is added to the GraphicsLayer.
graphic-draw
{
  graphic: <Graphic>
}
Fires when a graphic is drawn.
graphic-node-add
{
  graphic: <Graphic>,
  node: <HTMLElement>
}
Fires when a graphic's DOM node is created and added to the layer.
graphic-node-remove
{
  graphic: <Graphic>,
  node: <HTMLElement>
}
This event is fired when a graphic's DOM node is removed (consider the node destroyed).
graphic-remove
{
  graphic: <Graphic>
}
Fires when a graphic is removed from the GraphicsLayer.
graphics-clearFires when all graphics in the GraphicsLayer are cleared.
labeling-info-changeFired when labeling info on the layer changes.
load
{
  layer: <Layer>
}
Fires after layer properties for the layer are successfully populated.
mouse-down<MouseEvent> mouseEventFires when a mouse button is pressed down and the mouse cursor is on a graphic.
mouse-drag<MouseEvent> mouseEventFires while the mouse is being dragged until the mouse button is released.
mouse-move<MouseEvent> mouseEventFires as the mouse moves through a graphic on the GraphicsLayer.
mouse-out<MouseEvent> mouseEventFires as the mouse exits a graphic on the GraphicsLayer.
mouse-over<MouseEvent> mouseEventFires when the mouse first enters into a graphic on the GraphicsLayer.
mouse-up<MouseEvent> mouseEventFires when a mouse button is released and the mouse cursor is on a graphic.
opacity-change
{
  opacity: <Number>
}
Fires when the layer opacity has been changed, and returns an object with the opacity value.
query-attachment-infos-complete
{
  info: <Object[]>
}
Fires when queryAttachmentInfos method is called.
query-count-complete
{
  count: <Number>
}
Fires when the query for the count is complete.
query-extent-complete
{
  count: <Number>,
  extent: <Extent>
}
Fires when queryExtent method has completed.
query-features-complete
{
  featureSet: <FeatureSet>
}
Fires when queryFeatures() is complete.
query-ids-complete
{
  objectIds: <Number[]>
}
Fires when queryIds() is complete.
query-limit-exceededFired when the feature layer could not draw all the features due to a maxRecordCount limitation on a query operation.
query-related-features-complete
{
  relatedFeatures: <Object>
}
Fires when queryRelatedFeatures() is complete.
refresh-interval-changeThis event is fired when the layer's refreshInterval is modified.
refresh-tickFires right before the actual refresh kicks in for the layer, and only fires when the refresh is triggered by the refreshInterval.
resumeFires when a layer resumes drawing.
scale-range-changeFires when a layer's minScale and/or maxScale is changed.
scale-visibility-changeFires when a layer's scale visibility changes.
selection-clearFires after clearSelection has been called.
selection-complete
{
  features: <Graphic[]>,
  method: <Number>
}
Fires when selectFeatures() completes.
show-labels-changeFired when the feature layer's labels are changed.
suspendFires when a layer suspends drawing.
updateFires any time a layer has finished loading or updating itself.
update-end
{
  error: <Error>,
  info: <Object>
}
Fired when the layer has finished updating its content.
update-startFired when the layer begins to update its content.
visibility-change
{
  visible: <Boolean>
}
Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer.
Constructor Details

new esri.layers.FeatureLayer(url, options?)

Creates a new instance of a feature layer object from the ArcGIS Server REST resource identified by the input URL. Once created you can optionally set a definition expression or time definition.
Parameters:
<String> url Required URL to the ArcGIS Server REST resource that represents a feature service. An example is http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0. For more information on constructing a URL, see The Services Directory and the REST API.
<Object> options Optional Optional parameters. See options list.
options properties:
<Boolean> allowUpdateWithoutMValues Optional Indicates whether attribute features containing m-values can be edited. Default value is false.
<Boolean> autoGeneralize Optional Enable or disable the auto generalization of features from a non-editable layer in on-demand mode. When true, the layer uses the current map resolution as the maxAllowableOffset for all queries issued to the server. The default value is true. As of v2.7
<String> className Optional Class attribute to set for the layer's node.
<String> definitionExpression Optional Where clause to use as definition expression for layer. Added at v3.11
<Boolean> displayOnPan Optional When true, graphics are displayed during panning. When false, the graphics are turned off during pan movement. Setting to false may improve performance in Internet Explorer. The default is true.
<Function> editSummaryCallback Optional Set a callback function that will be invoked by FeatureLayer.getEditSummary. As of v2.8
<Object> featureReduction Optional Enables feature reduction (for example clustering) on point layers. See setFeatureReduction() for more details. See the featureReduction object specification table below for options that may be set in this object.

Support for feature reduction is limited to the following scenarios:

  • Point data(from service or FeatureCollection).
  • The map must have a spatial reference of Web Mercator or WGS84.
  • If the layer contains more than 50,000 features, then only the first 50,000 will be clustered.
  • A FeatureLayer created from a service URL must point to a service that supports pagination (ArcGIS Server version 10.3.1 or higher).
  • When editing is initiated with the Editor widget, then feature reduction is disabled until the Editor widget is destroyed.
  • Feature reduction is disabled when the layer has one of the following renderers: HeatmapRenderer, BlendRenderer, TemporalRenderer, or ScaleDependentRenderer.
<String> gdbVersion Optional Specify the geodatabase version to display. (As of v2.7). Requires ArcGIS Server service 10.1 or greater
<String> id Optional Unique ID to assign to the layer. If not assigned, esri.Map creates a unique ID.
<InfoTemplate> infoTemplate Optional The template that defines the content to display in the map info window when the user clicks on a feature. If not specified, the info window will not be displayed.
<Number> maxAllowableOffset Optional The maximum allowable offset, only applicable for layers that are not editable.
<Number> mode Optional The query mode for the feature layer. Each mode determines when and how many features are sent to the client. The default mode is to query on demand as the extent, time and layer definition changes. You can specify the following values:
  • FeatureLayer.MODE_SNAPSHOT: features are fetched from the server based on DefinitionExpression and TimeDefinition. If the definition changes, 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. For example, for a time animation, you can request all features from server, then adjust time extent on Map to only show a subset.
  • FeatureLayer.MODE_ONDEMAND: features are fetched from the server as needed.
  • FeatureLayer.MODE_SELECTION: only selected features are availabe on the client. Typically used in combination with a dynamic map service showing features that can be selected.
  • FeatureLayer.MODE_AUTO: features are fetched with either on-demand or snapshot mode depending on the characteristics of the service. Only applicable to hosted feature services. See the constants table for details.
The default value is MODE_ONDEMAND.

See the constants table for additional details on each mode.
<Number> opacity Optional Initial opacity or transparency of layer. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency. The default value is 1.0. Not supported in Internet Explorer.
<String[]> orderByFields Optional One or more fields used to order features by - for queries as well as for rendering.
  • Specfiy ASC (ascending) or DESC (descending) after the field name to control the order. Example: [ "POPULATION DESC" ].
  • When visualizing a feature layer using a renderer with data-based sizing, this option is useful to make sure smaller features are drawn on top of larger ones and not hidden underneath.
  • If not specified, feature layer will choose the order as follows:
    • Layer has a renderer with data-based sizing: descending order of Renderer.sizeInfo.field.
    • Layer has a ClassBreaksRenderer with backgroundFillSymbol: descending order of Renderer.attributeField.
    • Layer has a ClassBreaksRenderer where each break has varying symbol sizes: descending order of Renderer.attributeField.
<String[]> outFields Optional An array of strings which correspond to fields to include in the FeatureLayer. If not specified, the feature layer will return the OBJECTID field and if applicable the start time field, end time field and type id field. You can specify ["*"] to fetch the values for all fields in the layer, this is useful when editing features.
<Number> refreshInterval Optional Refresh interval of the layer in minutes. Non-zero value sets up automatic layer refresh at the specified interval.
<Object> resourceInfo Optional Specify the metadata of the layer.
<Boolean> showAttribution Optional When true, the layer's attribution is displayed on the map. The default value is true. Added at v3.1
require([
  "esri/layers/FeatureLayer", ... 
], function(FeatureLayer, ... ) {
  var censusBlock = new FeatureLayer(layerUrl, {
    showAttribution :false
  });
  ...
});
<Boolean> showLabels Optional Indicates whether to show labels on the layer.

If the FeatureLayer has labeling defined on it, labels will automatically display if the Map's showLabels is true.

If you do not wish to have your feature layer label, you can override this behavior by setting its showLabels property to false. Indicate whether to display labels. If true, any FeatureLayer added to the map will automatically label based on labelingInfo. Default is false. Added at v3.11

NOTE: In order for the labels to display, all fields used by the labelingInfo should be set in outFields. In addition, only simple labeling is supported, for example {CITY_NAME}. For example, SQL keywords such as "CONCAT" are not supported. Consider using the LabelLayer class where you can specify the textExpression if needing more functionality.
  var map = new Map("map", {showLabels : true });
  ...
  var fl1 = new FeatureLayer(url, {showLabels: true, outFields: ["*"]});
  var fl2 = new FeatureLayer(url2, {showLabels: false, outFields: ["*"]});
  map.addLayers([fls, fl2]);
Added at v3.11
<LayerSource> source Optional The dynamic layer or table source. The url should end with /dynamicLayer.
<Number> tileHeight Optional Specify the size of the virtual tiles, used in on-demand mode. The virtual tile scheme is used in on-demand mode to make effective use of browser caching. The default value is 512. This option is only valid in on-demand mode and must be a square. For example, specifying a value like 512x256 is not supported.
<Number> tileWidth Optional Specify the size of the virtual tiles, used in on-demand mode. The virtual tile scheme is used in on-demand mode to make effective use of browser caching. The default value is 512. This option is only valid in on-demand mode and must be a square. For example, specifying a value like 512x256 is not supported.
require([
  "esri/layers/FeatureLayer", ... 
], function(FeatureLayer, ... ) {
  var featureLayer = new FeatureLayer("https://www.example.com/arcgis/rest/services/Hydrography/Watershed173811/FeatureServer/1", {
    mode: FeatureLayer.MODE_ONDEMAND,
    tileWidth: 200,
    tileHeight: 200
  });
  ...
});
<String> trackIdField Optional The name of the trackIdField.
require([
  "esri/layers/FeatureLayer", ... 
], function(FeatureLayer, ... ) {
  var featureLayer = new FeatureLayer(featureLayerURL, {
    mode: FeatureLayer.MODE_SELECTION,
    trackIdField: "Animal_1"
  });
  ...
});
<Boolean> useMapTime Optional When true, the layer will update its content based on the map's time extent. The default values is true.
<Boolean> visible Optional Initial visibility of the layer. Default is true.
<Boolean> webglEnabled Optional Indicates if the layer will enable WebGL for rendering. Default value is true.
Object Specifications:
<featureReduction>
<Number> clusterRadius Optional The radius in pixels of each area in which multiple points will be summarized and visualized as a single cluster.
<InfoTemplate> infoTemplate Optional The InfoTemplate used to display summary information about aggregate graphics.
<String> type Required The reduction (or aggregation) method for reducing the features displayed in the map. The only valid value is cluster.
Sample:
var infoTemplate = new esri.InfoTemplate("${FIELD_NAME}", content);
var featureLayer = new esri.layers.FeatureLayer("https://www.example.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer/0",{
  mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
  infoTemplate: infoTemplate,
  outFields: ["*"]
});

new esri.layers.FeatureLayer(featureCollectionObject, options?)

Creates a new instance of a feature layer using a FeatureCollection object. The feature layer, when initialized with a feature collection object has the following behavior:
  • Edits are applied on the client not posted to the server.
  • The feature layer generates a unique object id for new features.
  • Does not support queries that need to be performed on the server, for example queries with a where clause or non-extent based spatial queries.
  • The feature layer toJson method returns an object with the same properties as the feature collection. The returned object includes all the features that are in the layer when the method is called. This method can be used to access a serializable representation of the features that can be saved on the server.
Parameters:
<Object> featureCollectionObject Required A feature collection object. See the object specifications tables below for details.
<Object> options Optional Optional parameters. See options list.
Object Specifications:
<featureCollectionObject>
<Object> featureSet Required A collection of features.
<Object> layerDefinition Required The structure is the same as the information returned by REST for a layer in a feature or map service. The minimum layer definition required to create a feature collection object depends on the required functionality, i.e. time, rendering etc.
Sample:
var layerDefinition = {
  "geometryType": "esriGeometryPolygon",
  "fields": [{
    "name": "BUFF_DIST",
    "type": "esriFieldTypeInteger",
    "alias": "Buffer Distance"
  }]
} 
var featureCollection = {
  layerDefinition: layerDefinition,
  featureSet: null
};
featureLayer = new esri.layers.FeatureLayer(featureCollection);
Property Details

<Object> advancedQueryCapabilities

An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. This object contains the existing properties supportsStatistics and supportsAdvancedQueries which is returned in the new supportsOrderBy property. For backward compatibility supportsStatistics and supportsAdvancedQueries will remain properties of FeatureLayer.
"advancedQueryCapabilities" : {
  "supportsPagination" : true, 
  "supportsQueryWithDistance" : true, 
  "supportsReturningQueryExtent" : true, 
  "supportsStatistics" : true, 
  "supportsOrderBy" : true, 
  "supportsDistinct" : true,
  "supportsQueryWithCacheHint" : true
}
(Added at v3.12)

<Boolean> allowGeometryUpdates

Returns true if the geometry of the features in the layer can be edited, false otherwise. In ArcGIS Server version 10.1, this option can be configured when publishing the service. For earlier versions, this is always true. (Added at v2.8)
Known values: true | false

<Boolean> allowUpdateWithoutMValues

Indicates whether attribute features containing m-values can be edited. (Added at v3.21)
Default value: false

<String> attributionDataUrl

The URL, when available, where the layer's attribution data is stored. (Added at v3.1)

<String> capabilities

Information about the capabilities enabled for this layer.

<String> className

class attribute of the layer's node. (Added at v3.7)

<String> copyright

Copyright information for the layer.

<Credential> credential

Provides credential information for the layer such as userid and token if the layer represents a resource that is secured with token-based authentication. This value is available after the layer has been loaded i.e. layer.loaded is true. (Added at v2.5)

<String | String[]> dataAttributes

List of attribute fields added as custom data attributes to graphics node. Applicable only when layer surfaceType is "svg". (Added at v3.7)

<String> defaultDefinitionExpression

Metadata describing the default definition expression for the layer as defined by the service. The default definition expression limits the features available for display and query. You cannot override this value but you define additional filters on the default expression using the setDefinitionExpression method. For example, if the default definition expression is set to display data where "STATE_NAME = 'California'" you could use setDefinitionExpression to only display a subset of the features in California, for example using "COUNTY='San Diego'".

<Boolean> defaultVisibility

Indicates the default visibility for the layer. (Added at v3.0)
Known values: true | false
Sample:

var isVisible = layer.defaultVisibility;

<String> description

The description of the layer as defined in the map service.

<String> displayField

The name of the layer's primary display field. The value of this property matches the name of one of the fields of the layer.

<Object> editFieldsInfo

Indicates the field names for the editor fields. If ownership based access control is not enabled for the feature service the value will be null. The object has the following properties:
  {
    <String> creatorField,
    <String> creationDateField,
    <String> editorField,
    <String> editDateField
  }
Requires ArcGIS Server feature service version 10.1 or greater. (Added at v2.6)

<Object> editingInfo

Applicable to ArcGIS Online hosted feature services. If present, this object specifies information about editing. See the object specifications table below for the structure of the editingInfo object. (Added at v3.28)
Object Specifications:
<editingInfo>
<Number> lastEditDate Required A read-only value that indicates the last time a layer was edited. This value gets updated every time the layer data is edited or when any of the layer properties change. The value is depicted as a Unix timestamp, e.g.
"editingInfo" : {
  "lastEditDate" : 1536363634886
}

<Field[]> fields

The array of fields in the layer.

<Extent> fullExtent

The full extent of the layer.

<String> gdbVersion

The geodatabase version. Only applicable if the layer's data source is registered as versioned in SDE. Only valid with ArcGIS Server services version 10.1 or greater. (Added at v2.7)

<String> geometryType

Geometry type of the features in the layer. Can be one of the following: "esriGeometryPoint", "esriGeometryPolygon" or "esriGeometryPolyline".

<String> globalIdField

The globalIdField for the layer.

<Graphic[]> graphics

Array of features in the layer.

<Boolean> hasAllFeatures

Indicates whether the layer displays all features intersecting the current view. Typically, this method should be called after the layer emits the update-end event. (Added at v3.28)
Default value: true

<Boolean> hasAttachments

True if attachments are enabled on the feature layer. Use the queryAttachmentInfos method to determine if the feature has attachments. If the layer is editable (isEditable) and supports attachments the following operations can be performed.

  • Add attachments to features.
  • Delete existing attachments.
Known values: true | false

<Boolean> hasAttributionData

When true, the layer has attribution data. The default value is false. Use the getAttributionData method to retrieve this data as JSON. (Added at v3.1)
Known values: true | false
Default value: false

<String> htmlPopupType

The html popup type defined for the layer. View the constants table for a list of valid values.

<String> id

ID assigned to the layer. If not assigned, esri.Map assigns value. By default, the ID of the layer is "layer" followed by a number. The ID can be user defined only in the layer constructor.
Sample:
  • Setting the layer ID in the layer constructor.
    population = new esri.layers.ArcGISDynamicMapServiceLayer("http://myserver/arcgis/rest/population/MapServer/Layers", {id:"population"});
    
  • Setting the layer ID after a layer is initialized.
    population.id = "population";
  • Retrieving the layer ID.
    function getMapLayers() {
      for (var j=0, jl=myMap.layerIds.length; j<jl; j++) {
        var currentLayer = myMap.getLayer(myMap.layerIds[j]);
        alert("id: " + currentLayer.id);
      }
    }
    

<InfoTemplate> infoTemplate

The info template for the layer. (Added at v3.9)

<LabelClass[]> labelingInfo

Label definition for this layer, specified as an array of label classes. Use this property to specify any changes to the structure of the label. For example, label expression, placement, and size can be modified and passed to this property. (Added at v3.10)

<Number> layerId

Unique ID of the layer that the FeatureLayer was constructed against.

<Error> loadError

Set if the layer failed to load. (Added at v3.9)

<Boolean> loaded

When the layer is loaded, the value becomes "true", and layer properties can be accessed. The onLoad event is also fired.
Known values: true | false

<Number> maxAllowableOffset

The maximum allowable offset, only applicable for layers that are not editable. (Added at v2.7)

<Number> maxRecordCount

The maximum number of results that will be returned from a query. Requires ArcGIS Server version 10.1 or greater. (Added at v2.6)

<Number> maxScale

Maximum visible scale for the layer. If the map is zoomed in beyond this scale, the layer will not be visible. A value of 0 means the layer does not have a maximum scale. (Added at v3.1)
Default value: 0

<Number> minScale

Minimum visible scale for the layer. If the map is zoomed out beyond this scale, the layer will not be visible. A value of 0 means the layer does not have a visible scale. (Added at v3.1)
Default value: 0

<String> multipatchOption

Supports feature services whose data source is a multipatch featureclass.
  • Default is xyFootprint if geometryType is esriGeometryMultiPatch. Otherwise, undefined.
  • User can override this property with a different choice in the future when FS supports it.
  • Queries made through the FeatureLayer will include multipatchOption parameter if returnGeometry is true.
  • Applies to snapshot, ondemand, selectFeatures, and queryFeatures
Note: Requires ArcGIS 10.3 and above. (Added at v3.12)
Default value: xyFootprint

<String> name

The name of the layer as defined in the map service.

<String> objectIdField

The name of the field that contains the Object ID field for the layer.

<Number> opacity

Opacity or transparency of layer. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency.
Known values: 0.0 - 1.0
Default value: 1.0

<Object> ownershipBasedAccessControlForFeatures

Indicates the ownership access control configuration. If ownership based access control is not enabled for the feature service the value will be null. If ownership based access control is not enabled for the feature service the value will be null. This object has two properties allowDeleteToOthers and allowUpdateToOthers. When true features can be deleted or updated by users other than the creator.
{
  <Boolean> allowUpdateToOthers,
  <Boolean> allowDeleteToOthers
}
(Added at v2.6)

<Number> refreshInterval

Refresh interval of the layer in minutes. Non-zero value indicates automatic layer refresh at the specified interval. Value of 0 indicates auto refresh is not enabled. (Added at v3.7)

<Object[]> relationships

Each element in the array is an object that describes the layer's relationship with another layer or table. Use the queryRelatedFeatures method to retrieve features or records related to a feature in this layer. The object has the following properties:

<Number> id Unique ID for the relationship
<String> name Name of the relationship.
<Number> relatedTableId Unique ID of the related table or layer
Sample:
var relationships = wellFeatureLayer.relationships;
dojo.forEach(relationships,function(relationship){
  console.log("name: " + relationship.name);
  console.log("id: " + relationship.id);
  console.log("relationship id: "   + relationship.relatedTableId);
});

<Renderer> renderer

The renderer for the layer.

<Boolean> showAttribution

When true, the layer's attribution is displayed on the map. (Added at v3.1)
Known values: true | false
Default value: true

<Boolean> showLabels

Determines if labels are displayed. When false, labels for the layer are not displayed.

If the FeatureLayer has labeling defined on it, labels will automatically display if the Map's showLabels is true.

If you do not wish to have your feature layer label, you can override this behavior by setting its showLabels property to false.

NOTE: In order for the labels to display, all fields used by the labelingInfo should be set in outFields. In addition, only simple labeling is supported, for example {CITY_NAME}. For example, SQL keywords such as "CONCAT" are not supported. Consider using the LabelLayer class where you can specify the textExpression if needing more functionality.
Added at v3.11

Known values: true | false
Default value: true

<LayerSource> source

The dynamic layer or table source. (Added at v2.7)

<Boolean> styling

Indicates whether the layer is responsible for styling graphics. When true, styling is based on graphics symbol or the layer's renderer. When false, graphics styling is disabled. Applicable only when layer surfaceType is "svg". (Added at v3.7)
Known values: true | false

<Boolean> supportsAdvancedQueries

When true, the layer supports orderByFields in a query operation. Requires ArcGIS Server service version 10.1 or greater (Added at v2.6)
Known values: true | false

<Boolean> supportsAttachmentsByUploadId

When true, the layer supports uploading attachments with Uploads REST operation, which then can be used in the Add Attachment or Update Attachment REST operations. Requires ArcGIS Online hosted feature service. (Added at v3.11)
Known values: true | false

<Boolean> supportsCalculate

When true, the layer supports the Calculate REST operation when updating features. Requires ArcGIS Online hosted feature service. (Added at v3.11)
Known values: true | false

<Boolean> supportsFieldDescription

If true, the layer supports a user-defined field description. Please see the ArcGIS Online help topic, Describe attribute fields for additional information. (Added at v3.28)

<Boolean> supportsStatistics

When true, the layer supports statistical functions in query operations. Requires ArcGIS Server service version 10.1 or greater (Added at v2.6)
Known values: true | false

<String> surfaceType

Type of vector graphics surface used to draw graphics. (Added at v3.7)
Known values: "svg" | "canvas-2d" | "vml"
Default value: "svg" on all browsers - except IE8 or earlier where "vml" is used to draw graphics.

<Boolean> suspended

When true, the layer is suspended. A layer is considered to be suspended when one of the following is true:
  • The layer is hidden.
  • The layer is not visible at the current map scale.
  • The layer is explicitly suspended by calling the Layer.suspend method.
(Added at v3.1)
Known values: true | false

<FeatureTemplate[]> templates

An array of feature templates defined in the Feature Service layer. Only applicable for ArcGIS Server Feature Service layers.
Sample:

var templates = layer.templates;

dojo.forEach(templates,function(template){

   console.log(template.description);

   console.log(template.name);

});

<TimeInfo> timeInfo

Time information for the layer, such as start time field, end time field, track id field, layers time extent and the draw time interval. Only applicable if the layer is time aware.

<String> type

Specifies the type of layer. Can be "Feature Layer" or "Table".

<String> typeIdField

The field that represents the Type ID field. Only applicable for ArcGIS Server Feature Service layers.
An array of sub types defined in the Feature Service layer. Only applicable for ArcGIS Server Feature Service layers.

<String> url

URL to the ArcGIS Server REST resource that represents a map service. To obtain the URL, use Services Directory. An example URL for the Street Map service on ArcGIS Online is:
https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer. (Added at v1.2)

<Number> version

The version of ArcGIS Server where the layer is published. Examples are 9.3, 9.31, 10. (Added at v2.1)

<Boolean> visible

Visibility of the layer.
Known values: true | false
Default value: true

<Boolean> visibleAtMapScale

When true, the layer is visible at the current map scale. (Added at v3.1)
Known values: true | false

<Boolean> webglEnabled

Indicates if WebGL is enabled on the layer. Note that this doesn't indicate that WebGL is actually being used in the rendering. Use hasWebGLSurface() to check if the layer is drawn with WebGL. (Added at v3.24)
Default value: true
Method Details

addAttachment(objectId, formNode, callback?, errback?)

Add an attachment to the feature specified by the ObjectId. Only applicable if isEditable and hasAttachments are true.
Return type: Deferred
Parameters:
<Number> objectId Required The ObjectId of the feature to which the attachment is added.
<HTMLFormElement> formNode Required HTML form that contains a file upload field pointing to the file to be added as an attachment. If you are using HTML then your form should follow this basic pattern:
<form id="form1">
  <input type="file" id="fileinput" name="attachment" onchange="doSomething()" />
</form>
If you wish to create the form data in JavaScript, then you can create a form using the following pattern:
var formData = new FormData();
formData.append("attachment", file);
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the addAttachmentComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.

applyEdits(adds?, updates?, deletes?, callback?, errback?)

Apply edits to the feature layer. Applicable for layers created from a FeatureService or a FeatureCollection.
NOTE: Date field values are always represented as numeric values. This means that when updating existing features, date fields must have numeric values and not date objects.
Return type: Deferred
Parameters:
<Graphic[]> adds Optional Array of features to add to the layer. New features are typically created using the Draw toolbar.
<Graphic[]> updates Optional

Array of features whose geometry and/or attributes have changed. Features must have a valid OBJECTID. The geometry of features is typically modified using the Edit toolbar. Attributes are modified using the Attribute Inspector.

<Graphic[]> deletes Optional Array of features to delete. Must have valid ObjectId
<Function> callback Optional This function will be called when the operation is complete. The arguments passed to this function are the same as the onEditsComplete event.
<Function> errback Optional An error object is returned if an error occurs.
Sample:
var targetGraphic = firePerimeterFL.getSelectedFeatures()[0].setGeometry(reshapedGeometry);
firePerimeterFL.applyEdits(null, [targetGraphic], null);

attr(name, value)

Adds a new attribute or changes the value of an existing attribute on the layer's node. Removes the attribute if the value is null or undefined. (Added at v3.7)
Return type: Layer
Parameters:
<String> name Required The name of the attribute.
<String> value Required The value of the attribute. Set this value as null to remove the attribute.

clearSelection()

Clears the current selection.
Return type: FeatureLayer

deleteAttachments(objectId, attachmentIds, callback?, errback?)

Delete one or more attachments for the feature specified by the input ObjectId. Only applicable if isEditable and hasAttachments are true.
Return type: Deferred
Parameters:
<Number> objectId Required The ObjectId of the feature from which the attachment is removed.
<Number[]> attachmentIds Required The array of attachment ids to delete.
<Function> callback Optional The function to call when the method has completed.
<Function> errback Optional An error object is returned if an error occurs.

disableFeatureReduction()

Disables feature reduction (for example clustering) on the layer. This is useful for certain workflows, such as editing, where feature reduction can hinder the desired user experience. Only applicable to point layers. (Added at v3.22)

disableMouseEvents()

Disables all mouse events on the graphics layer.

enableFeatureReduction()

Enables feature reduction (for example clustering) on the layer using the options set in setFeatureReduction(). Only applicable to point layers. (Added at v3.22)

enableMouseEvents()

Enables all mouse events on the graphics layer.

getAggregateGraphics()

Returns graphics representing the aggregation of several point features clustered together. Only applicable when feature reduction is enabled. (Added at v3.22)
Return type: Graphic[]

getAttributionData()

Asynchrously returns custom data for the layer when available. (Added at v3.1)
Return type: Deferred

getDefinitionExpression()

Returns the current definition expression.
Return type: String

getDomain(fieldName, options?)

Returns the Domain associated with the given field name. This being either a Coded Value Domain or Range Domain. (Added at v3.12)
Return type: Domain
Parameters:
<String> fieldName Required Name of the attribute field.
<Object> options Optional Please see the options object specification table below.
Object Specifications:
<options>
<Graphic> feature Required The feature in which the Domain is retrieved.
NOTE: If the layer has sub-types, the domain will be calculated based on the feature type and domain defined for that type.

getEditCapabilities(options?)

Returns an object that describes the edit capabilities of the layer. The returned object has the following properties:
<Boolean> canCreate When true, new features can be created.
<Boolean> canUpdate When true, existing features can be updated.
<Boolean> canDelete When true, features can be deleted.
(Added at v2.6)
Return type: Object
Parameters:
<Object> options Optional If the layer supports ownership based access control, use the options to determine if the specified user can edit features. Ownership based access control requires ArcGIS Server services version 10.1 or greater. See the object specifications table below for the structure of the options object.
Object Specifications:
<options>
<Graphic> feature Required Check to see if the specified feature can be edited by the specified user.
<graphic> feature Required Check to see if the specified feature can be edited by the specified user.
<String> userId Required The name of the currently logged in user. If the application uses the IdentityManager the IdentityManager supplies the layer with the userId so this parameter is not required.
<String> userId Required The name of the currently logged in user. If the application uses the IdentityManager the IdentityManager supplies the layer with the userId so this parameter is not required.
Sample:

var capabilities = featureLayer.getEditCapabilities();

if(capabilities.canUpdate){

  console.log("This layer can be updated");

}

getEditInfo(feature, options?)

Returns an object describing the most recent edit operation performed on the given feature, if available. (Added at v2.8)
Return type: Object
Parameters:
<Graphic> feature Required The feature to get the edit info for.
<Object> options Optional See the object specifications table below for the structure of the options object.
Object Specifications:
<options>
<String> action Required By default, the method returns a summary of the most recent edit performed on the feature. Use this option to override this behavior.
  • 'creation' indicates creation summary is desired.
  • 'edit' indicates edit summary is desired.
Sample:
{
  "action"        : "creation", // or "edit"
  "userId"        : "Mike",
  "minutes"       :  15,
  "hours"         :  5,
  "weekDay"       : "Tuesday",
  "formattedDate" : "1/1/2012",
  "formattedTime" : "9:30 AM",
  "displayPattern": "Minutes", // or "Seconds", "Minute", "Hour", "Hours", "WeekDay", "Full"
  "timeValue"     :  1330167842310
}

getEditSummary(feature, options?)

Returns a localized summary of the last edit operation performed on the given feature, if available. For example:
Edited by Bjorn seconds ago
Edited by Bjorn a minute ago
Edited by Bjorn 15 minutes ago
Edited by Bjorn an hour ago
Edited by Bjorn 5 hours ago
Edited by Bjorn on Tuesday at 1:30 PM
Edited by Bjorn on 4/27/2014 at 11:30 AM
The word "Edited" will be replaced by "Created" if the author has disabled editorField attribute but enabled creatorField attribute. The user component and date-time component may or may not be available depending on your layer's edit tracking settings (see editFieldsInfo property of this layer for more information). An empty string will be returned if:
  • the layer is not initialized or
  • if the layer's edit tracking settings have been turned off or
  • if the feature does not have edit tracking fields in its attributes.
  • (Added at v2.8)
Return type: String
Parameters:
<Graphic> feature Required The feature to get the edit summary for.
<Object> options Optional See the object specifications table below for the structure of the options object.
Object Specifications:
<options>
<String> action Required By default, the method returns a summary of the most recent edit performed on the feature. Use this option to override this behavior.
  • 'creation' indicates creation summary is desired.
  • 'edit' indicates edit summary is desired.
<Function> callback Required If you want to customize or override certain components of the summary, provide a callback function using this option. For example:
featureLayer.getEditSummary(feature, {
  callback: function(feature, info) {
    if (info && info.userId) {
      info.userId = "<a href='http://users.my.org/profile/" + info.userId     + "'>" + info.userId + "</a>";
    }
    return info;
  }
});

getFeatureReduction()

Returns the options used to reduce the number of features visualized by the layer (for example clustering). This is only applicable to point layers. See setFeatureReduction() for more details. (Added at v3.22)
Return type: Object

getField(fieldName)

Returns the Field given the specified field name. (Added at v3.12)
Return type: Field
Parameters:
<String> fieldName Required Name of the attribute field.

getMap()

Returns reference to the map control the layer is added to. Returns null or undefined if it is not added to a map. (Added at v3.7)
Return type: Map

getMaxAllowableOffset()

Returns the current value of the maxAllowableOffset used by the layer. For non-editable layers in on-demand mode if autoGeneralize is enabled the maxAllowableOffset is set to the current map resolution. (Added at v2.7)
Return type: Number
Sample:

 var currentOffset = featureLayer.getMaxAllowableOffset();

getNode()

Returns the layer's DOM node. (Added at v3.7)
Return type: HTMLElement

getOrderByFields()

Returns the list of fields used to order features by. For queries as well as rendering. (Added at v3.8)
Return type: String[]

getSelectedFeatures()

Gets the currently selected features.
Return type: Graphic[]

getSelectionSymbol()

Gets the current selection symbol.
Return type: Symbol

getSingleGraphics()

Returns graphics from the layer that are not represented by aggregate graphics when feature reduction (such as clustering) is enabled. (Added at v3.22)
Return type: Graphic[]

getTimeDefinition()

Get the current time definition applied to the feature layer.
Return type: TimeExtent
Sample:

timeSlider.createTimeStopsByTimeInterval(featureLayer.getTimeDefinition(), 

  1, esri.layers.TimeInfo.UNIT_HOURS);

getType(feature)

Returns a FeatureType describing the feature's type.
NOTE: This is applicable if the layer containing the feature has a TypeIdField. (Added at v3.12)
Return type: FeatureType
Parameters:
<Graphic> feature Required A feature from this layer.

hasUpdateError()

Indicates whether an error is thrown after the layer updates. (Added at v3.24)

hasWebGLSurface()

Indicates if the layer is rendered in WebGL. (Added at v3.24)
Return type: Boolean

hasXYFootprint()

Returns true if geometryType is esriGeometryMultipatch and multipatchOption is xyFootprint. When true, the FeatureLayer will behave as if it were a polygon.
  • Auto generalization will be enabled by default.
  • Auto mode will treat the layer like a polygon layer.
(Added at v3.12)
Return type: Boolean

hide()

Sets the visibility of the layer to "false". The layer is not removed, but it is hidden from view.

isEditable()

Returns true if the FeatureLayer is editable. If the layer is editable, one or more of the following operations can be performed depending on the permissions set on the service.

  • Add new features.
  • Modify the geometry and attributes of existing features.
  • Delete features.

To see which of the above editing actions may be performed on the layer, execute getEditCapabilities() on the layer after verifying that isEditable() returns true.

Return type: Boolean
See also: setEditable()

isFeatureReductionActive()

Indicates if feature reduction (for example clustering) is active in the view. Feature reduction is active at all scales. At any given scale, if there are features that do not fall within a cluster, they are displayed as individual features. This method is only applicable to point layers when feature reduction is enabled. (Added at v3.22)
Return type: Boolean

isFeatureReductionEnabled()

Indicates if feature reduction (for example clustering) is enabled. Only applicable to point layers. See also setFeatureReduction(). (Added at v3.22)
Return type: Boolean

isVisibleAtScale(scale)

Returns true if the layer is visible at the given scale. (Added at v3.1)
Return type: Boolean
Parameters:
<Number> scale Required The scale at which to check if the layer is visible.

queryAttachmentInfos(objectId, callback?, errback?)

Query for information about attachments associated with the specified ObjectIds.
Return type: Deferred
Parameters:
<Number> objectId Required The ObjectId for the feature to query for attachment information.
<Function> callback Optional The function to call when the method has completed.
<Function> errback Optional An error object is returned if an error occurs.

queryCount(query, callback?, errback?)

Get a count of the number of features that satisfy the input query. Valid only for layers published using ArcGIS Server 10 SP1 or greater. Layers published with earlier versions of ArcGIS Server return an error to the error callback. (Added at v2.1)
Return type: Deferred
Parameters:
<Query> query Required

The input query. The query object has the following restrictions to avoid conflicts between layer and map properties.

  • outFields specified by the query object are overridden by the outFields specified in the FeatureLayer constructor.
  • The returnGeometry value specified by the query object is ignored and true is used.
  • The outSpatialReference set by the query object is ignored and the map's spatial reference is used.
<Function> callback Optional The function to call when the method has completed.
<Function> errback Optional An error object is returned if an error occurs.
Sample:
var query = new esri.tasks.Query();
query.where = "POP90_SQMI < 100";
featureLayer.queryCount(query,function(count){
  console.log(count + " features satisfied the input query");
},function(error){
  console.log(error);
});      

queryExtent(query, callback?, errback?)

Get the extent of features that satisfy the input query. The count of features that satisfy the input query is returned as well. This is valid only for hosted feature services on arcgis.com and for ArcGIS Server 10.3.1 and later. (Added at v3.9)
Return type: Deferred
Parameters:
<Query> query Required The query definition.
<Function> callback Optional The function called when the method has completed.
<Function> errback Optional The function called when error occurred.

queryFeatures(query, callback?, errback?)

Query features from the feature layer. Layer definition and time definition are honored. Whenever possible the feature layer will perform the query on the client.
Return type: Deferred
Parameters:
<Query> query Required

The input query. The query object has the following restrictions to avoid conflicts between layer and map properties.

  • outFields specified by the query object are overridden by the outFields specified in the FeatureLayer constructor.
  • The returnGeometry value specified by the query object is ignored and true is used. As of version 3.5 the returnGeometry value is honored.
  • The outSpatialReference set by the query object is ignored and the map's spatial reference is used.
<Function> callback Optional The function to call when the method has completed.
<Function> errback Optional An error object is returned if an error occurs.
Sample:
var query = new esri.tasks.Query();
query.objectIds = [features[0].attributes.OBJECTID];
query.outFields = [ "*" ];
// Query for the features with the given object ID
featureLayer.queryFeatures(query, function(featureSet) {
});

queryIds(query, callback?, errback?)

Query for ObjectIds. There is no limit on the number of ObjectIds that are returned from the server. Like queryFeatures this operation will perform queries on the client (browser) whenever possible. Valid only for layers published using ArcGIS Server 10 SP1 or greater.
Return type: Deferred
Parameters:
<Query> query Required

The input query. The query object has the following restrictions to avoid conflicts between layer and map properties.

  • outFields specified by the query object are overridden by the outFields specified in the FeatureLayer constructor.
  • The returnGeometry value specified by the query object is ignored and true is used.
  • The outSpatialReference set by the query object is ignored and the map's spatial reference is used.
<Function> callback Optional The function to call when the method has completed.
<Function> errback Optional An error object is returned if an error occurs.
Sample:
// create a query to fetch object IDs for all records
var query = new esri.tasks.Query();
query.where = "1=1";

featureLayer.queryIds(query, function(objectIds) {
  //do something with the objectIds here
});

queryRelatedFeatures(relQuery, callback?, errback?)

Query features or records, from another layer or table, related to features in this layer.
Return type: Deferred
Parameters:
<RelationshipQuery> relQuery Required The input query.
<Function> callback Optional The function to call when the method has completed.
<Function> errback Optional An error object is returned if an error occurs.
Sample:
var relatedQuery = new esri.tasks.RelationshipQuery();
relatedQuery.outFields = ["AGREE_WITH_INCIDENT"];
relatedQuery.relationshipId = 1;

//query for the features related to the "clicked" feature
dojo.connect(featureLayer, "onClick", function(evt) {
  graphicAttributes = evt.graphic.attributes;
  relatedQuery.objectIds = [graphicAttributes.OBJECTID];
  featureLayer.queryRelatedFeatures(relatedQuery,relatedRecords);
});

redraw()

Redraws all the graphics in the graphics layer. Unlike refresh(), redraw does not re-query features from the server. (Added at v3.3)

refresh()

Refreshes the features in the feature layer. The feature layer requeries all the features in the service, except the selected features, and updates itself.

resume()

Resumes layer drawing. (Added at v3.1)

selectFeatures(query, selectionMethod?, callback?, errback?)

Selects features from the FeatureLayer. Layer properties like layer definition and time definition are honored. The selection method defines how query results are passed to the selection. The feature layer will highlight the current selection if a selection symbol has been defined. Whenever possible, the feature layer will perform the query operation on the client (browser).
Return type: Deferred
Parameters:
<Query> query Required

The input query. The query object has the following restrictions to avoid conflicts between layer and map properties.

  • outFields specified by the query object are overridden by the outFields specified in the FeatureLayer constructor.
  • The returnGeometry value specified by the query object is ignored and true is used.
  • The outSpatialReference set by the query object is ignored and the map's spatial reference is used.
<Number> selectionMethod Optional The selection method defines how the rest of the selection is combined with the existing selection. See Constants table for valid values. The default option is to create a new selection.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onSelectionComplete event.
<Function> errback Optional An error object is returned if an error occurs.
Sample:
var query = new esri.tasks.Query();
query.geometry = feature.geometry;
featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW);

setAutoGeneralize(enable)

Enable or disable auto generalization for the layer. Note that auto generalization is only applicable to non-editable feature layers in on-demand mode. (Added at v2.7)
Return type: FeatureLayer
Parameters:
<Boolean> enable Required When true, auto generalize is enabled. Default value for non-editable on-demand feature layers is true.
Sample:
featureLayer.setAutoGeneralize(false);

setDefinitionExpression(expression)

Sets the definition expression for the FeatureLayer. Only the features that match the definition expression are displayed. A definition expression limits the features available for display and queries by applying constraints to the layer's attribute fields. Setting a definition expression is useful when the dataset is large and you don't want to bring everything to the client for analysis. This method is typically called before adding the layer to the map. If the method is called after the layer is added to the map the layer will refresh itself to reflect the new definition expression.

This definition expression is combined with the layer's default definition expression which results in a further restriction of the layer.

Return type: FeatureLayer
Parameters:
<String> expression Required The definition expression to apply. For example, "TYPE='Park'"
Sample:
featureLayer.setDefinitionExpression("STATE_NAME = 'South Carolina'");

setEditable(editable)

Set the editability of feature layers created from a feature collection. This method is only valid for feature layers created from feature collections.

When the feature layer's editability is updated the onCapabilitiesChange event is fired. Use the isEditable method to determine if the layer is editable.

(Added at v2.6)
Return type: FeatureLayer
Parameters:
<Boolean> editable Required When true, the layer will be set as editable.
Sample:

featureLayer.setEditable(true);

setFeatureReduction(options)

Sets feature reduction options on the layer (for example clustering options). When set, features in the layer will aggregate, thus changing the visualization. This will not change the renderer of the layer. See the valid parameters in the table below.

Support for feature reduction is limited to the following scenarios:

  • Point data in FeatureLayer (from service or FeatureCollection) and CSVLayer.
  • The map must have a spatial reference of Web Mercator or WGS84.
  • If the layer contains more than 50,000 features, then only the first 50,000 will be clustered.
  • A FeatureLayer created from a service URL must point to a service that supports pagination (ArcGIS Server version 10.3.1 or higher).
  • When editing is initiated with the Editor widget, then feature reduction is disabled until the Editor widget is destroyed.
  • Feature reduction is disabled when the layer has one of the following renderers: HeatmapRenderer, BlendRenderer, TemporalRenderer, or ScaleDependentRenderer.
(Added at v3.22)
Parameters:
<Object> options Required Options for reducing (or aggregating) the features in the map. See the table below for more details.
Object Specifications:
<options>
<Number> clusterRadius Optional The radius in pixels of each area in which multiple points will be summarized and visualized as a single cluster. The default value is 80.
<InfoTemplate> infoTemplate Optional The InfoTemplate used to display summary information about aggregate graphics.
<String> type Required The reduction (or aggregation) method for reducing the features displayed in the map. The only valid type is cluster.

setGDBVersion(versionName)

Set the layer's data source to the specified geodatabase version. If the versionName is null then the data source will be the published map's default version. Only applicable if the layer's data source is registered as versioned in SDE. Only valid with ArcGIS Server services version 10.1 or greater. (Added at v2.7)
Return type: FeatureLayer
Parameters:
<String> versionName Required The name of the geodatabase version to use as the layer's data source.

setInfoTemplate(infoTemplate)

Specify or change the info template for a layer. (Added at v2.2)
Parameters:
<InfoTemplate> infoTemplate Required The new info template.
Sample:

  var template = new esri.InfoTemplate();

  template.setTitle("${qAddress}");

  template.setContent(getTextContent);

  featureLayer.setInfoTemplate(template);

setLabelingInfo(labelingInfo)

Sets labeling info on the layer. Input value is an array of LabelClass objects. (Added at v3.10)
Parameters:
<LabelClass[]> labelingInfo Required This is the label definition for this layer, specified as an array of label classes. Use this property to specify any changes to the structure of the label. For example, label expression, placement, and size can be modified and passed to this property.

setMaxAllowableOffset(offset)

Sets the maximum allowable offset used when generalizing geometries. The offset is in the units of the spatialReference. This is ignored when working with editable layers.
Parameters:
<Number> offset Required The maximum allowable offset.
Sample:
featureLayer = new esri.layers.FeatureLayer(featureLayerUrl, {
  maxAllowableOffset: 1000
});

setMaxScale(scale)

Set the maximum scale for the layer. (Added at v3.1)
Parameters:
<Number> scale Required The maximum scale at which the layer is visible.

setMinScale(scale)

Set the minimum scale for the layer. (Added at v3.1)
Parameters:
<Number> scale Required The minimum scale at which the layer is visible.

setOpacity(opacity)

Initial opacity or transparency of layer. Not supported in Internet Explorer.
Parameters:
<Number> opacity Required Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. The default value is 1.
Sample:
featureLayer.setOpacity(.50);

setRefreshInterval(interval)

Changes the layer's refresh interval to the given value (in minutes). Non-zero value sets up automatic layer refresh at the specified interval. Value of 0 stops auto refresh. (Added at v3.7)
Return type: Layer
Parameters:
<Number> interval Required Refresh interval of the layer in minutes. Non-zero value indicates automatic layer refresh at the specified interval. Value of 0 indicates auto refresh is not enabled.

setRenderer(renderer)

Set the renderer for the feature layer.
Parameters:
<Renderer> renderer Required The renderer to apply to the feature layer
Sample:

var symbol = new esri.symbol.SimpleFillSymbol().setColor(new esri.Color([255,0,0,0.5]));

var renderer = new esri.renderer.SimpleRenderer(symbol);

featureLayer.setRenderer(renderer);

setScaleRange(minScale, maxScale)

Set the scale range for the layer. If minScale and maxScale are set to 0 then the layer will be visible at all scales. (Added at v2.5)
Parameters:
<Number> minScale Required The minimum scale for the layer. If the map is zoomed out beyond the specified scale the layer will not be visible. A value of 0 means the layer does not have a minimum scale.
<Number> maxScale Required The maximum scale for the layer. If the map is zoomed out beyond the specified scale the layer will not be visible. A value of 0 means the layer does not have a maximum scale.
Sample:

featureLayer.setScaleRange(591657528,147914381);

setSelectionSymbol(symbol)

Sets the selection symbol for the feature layer. If no symbol is specified, features are drawn using the layer's renderer.
Return type: FeatureLayer
Parameters:
<Symbol> symbol Required Symbol for the current selection. Make sure the symbol type is appropriate for the geometry type of the layer.
Sample:
var selectionSymbol = new esri.symbol.SimpleFillSymbol().setColor(new esri.Color([255,255,0,0.5]));
featureLayer.setSelectionSymbol(selectionSymbol);

setShowLabels(showLabels)

Sets whether to display labels or not. Set to false to turn off labeling. (Added at v3.11)
Parameters:
<Boolean> showLabels Required Set to true to show labels.

setTimeDefinition(definition)

Sets the time definition for the feature layer. A time definition temporarily filters the features in the layer to match the specified time extent. Only applicable for time-aware layers. Only supported when the feature layer is in snapshot mode.

In addition to time definition, time-aware layers also support the time extent set on the map. Time-aware layers automatically update when the map's time extent is changed, similar to how layers react when the map's spatial reference is modified. If a layer's time definition is set to display features between 1970 and 1975 and the map has a time extent set to 1972-1980, the effective time on the feature layer will be 1972-1975

Return type: FeatureLayer
Parameters:
<TimeExtent> definition Required The new time extent used to filter the layer.
Sample:
var defn = new esri.TimeExtent();
defn.startTime = new Date("November 30,2009 6:00:00")
defn.endTime = new Date("November 30, 2009 8:00:00");
featureLayer.setTimeDefinition(defn);

setTimeOffset(offsetValue, offsetUnits)

Time offset allows you to display the features at a different time so they can be overlaid on top of previous or future time periods. For example, to visualize the growth pattern of two wild fires that happened in two different years, one of the layers can be given an offset that will cause it to appear as if the fire started at the same time as the other fire. Note that the offset does not change the temporal component of the data itself and has no effect if the layer is not time aware.

Example: If a layer has data recorded for the year 1970, an offset value of 2 years would temporarily shift the data to 1972 (for display purposes only, query and selection are not affected by offset).

Return type: FeatureLayer
Parameters:
<Number> offsetValue Required The length of time to offset from "this" time. Specify a positive or negative whole number.
<String> offsetUnits Required Units in which the offset is specified. See the TimeInfo constants for valid values.

setUseMapTime(update)

Determine if the layer will update its content based on the map's current time extent. Default value is true. (Added at v2.2)
Parameters:
<Boolean> update Required When false the layer will not update its content based on the map's time extent. Default value is true.

setVisibility(isVisible)

Sets the visibility of the layer. When true, the layer is visible.
Parameters:
<Boolean> isVisible Required Set the visibility of the layer.

setWebGLEnabled(enable)

Toggles WebGL rendering on/off on the layer. (Added at v3.24)
Parameters:
<Boolean> enable Required Indicates whether to enable WebGL on the layer.
Sample:
layer.setWebGLEnabled(true);

show()

Sets the visibility of the layer to "true".

suspend()

Suspends layer drawing. (Added at v3.1)

toJson()

Returns an easily serializable object representation of the layer. Regardless of the layer's mode of operation, only features currently available on the client are included.


{

  layerDefinition: <Object>,

    featureSet: {

    features:<Object[]>

  }

}

Return type: Object
Event Details
[ On Style Events | Connect Style Event ]

add-attachment-complete

Fires when addAttachments() is complete. Should be used in favor of onAddAttachmentComplete. (Added at v3.5)
Event Object Properties:
<FeatureEditResult> result The result of the addAttachment operation indicating if the attachment was successfully added.
See also: addAttachment()

before-apply-edits

Fired before edits are applied to the feature layer. Should be used in favor of onBeforeApplyEdits. (Added at v3.5)
Event Object Properties:
<Graphic[]> adds Array of features to add to the layer in the feature service.
<Graphic[]> deletes Array of features to delete.
<Graphic[]> updates Array of features whose geometry and/or attributes have changed.

capabilities-change

Fired when the capabilities of the layer are modified using the setEditable method. Should be used in favor of onCapabilitiesChange. (Added at v3.5)
See also: setEditable()

click

Fires when a graphic has been clicked. Should be used in favor of onClick. (Added at v3.5)
Event Object Properties:
<Object> event The returned object contains screenPoint, mapPoint, and Graphic.

dbl-click

Fires when a feature has been double clicked. (Added at v3.6)
Event Object Properties:
<Object> event The returned object contains screenPoint, mapPoint, and graphic.
Sample:
require([
  "dojo/_base/connect", "esri/toolbars/Edit", ... 
], function(connect, Edit, ... ) {
  var editToolbar = new Edit( ... );
  connect.connect(firePerimeterFL, "onDblClick", function(evt) {
    editToolbar.activate(Edit.EDIT_VERTICES , evt.graphic);
  });
  ...
});

delete-attachments-complete

Fires when deleteAttachments is complete. Should be used in favor of onDeleteAttachmentsComplete. (Added at v3.5)
Event Object Properties:
<Object[]> results The result objects, one for each attachment indicating if it was successfully removed.

edits-complete

Fires after applyEdits() is complete. Should be used in favor of onEditsComplete. (Added at v3.5)
Event Object Properties:
<FeatureEditResult[]> adds An array of result objects, one for each feature, indicating if it was successfully added. If the feature was added the result object will contain the unique object ID assigned to the feature.
<FeatureEditResult[]> deletes An array of result objects, one for each feature, indicating if it was successfully deleted. If the feature was deleted the result object will contain the unique object ID previously assigned to the feature.
<FeatureEditResult[]> updates An array of result objects, one for each feature, indicating if it was successfully updated. If the feature was updated the result object will contain the unique object ID assigned to the feature.
See also: applyEdits()

error

Fires when there is a problem retrieving a layer. Should be used in favor of onError. (Added at v3.5)
Event Object Properties:
<Error> error ArcGIS Server error message returned in a JavaScript error object.

gdb-version-change

Fired when the geodatabase version is switched. (Added at v3.5)

graphic-add

Fires when a graphic is added to the GraphicsLayer. Should be used in favor of onGraphicAdd. (Added at v3.5)
Event Object Properties:
<Graphic> graphic The added graphic.

graphic-draw

Fires when a graphic is drawn. A graphic is drawn or redrawn when:
  • When it is added to the layer.
  • When Geometry or Symbol is modified.
  • When it enters the viewport and intersects the map extent.
  • When the layer is redrawn.
(Added at v3.7)
Event Object Properties:
<Graphic> graphic Graphic being drawn. When the layer surfaceType is "svg" or "vml", the graphic's DOM node is accessible with graphic.getNode().

graphic-node-add

Fires when a graphic's DOM node is created and added to the layer. Fires only when the layer surfaceType is "svg" or "vml". (Added at v3.7)
Event Object Properties:
<Graphic> graphic Graphic being drawn.
<HTMLElement> node Graphic's DOM node.

graphic-node-remove

This event is fired when a graphic's DOM node is removed (consider the node destroyed). The DOM node of a graphic is removed when:
  • Graphic is removed from the layer.
  • Graphic exits the viewport on map navigation.
  • When a symbol change cannot be applied to the Graphic without replacing the current node with a new one. For example: when a marker symbol is changed from SimpleMarkerSymbol to PictureMarkerSymbol, onGraphicNodeRemove will be fired for the node that is being replaced (SVG Circle) and onGraphicNodeAdd will be fired for the new node (SVG Image).
Fires only when the layer surfaceType is "svg" or "vml". (Added at v3.7)
Event Object Properties:
<Graphic> graphic Graphic being drawn.
<HTMLElement> node Graphic's DOM node.

graphic-remove

Fires when a graphic is removed from the GraphicsLayer. Should be used in favor of onGraphicRemove. (Added at v3.5)
Event Object Properties:
<Graphic> graphic The removed graphic.

graphics-clear

Fires when all graphics in the GraphicsLayer are cleared. Should be used in favor of onGraphicsClear. (Added at v3.5)

labeling-info-change

Fired when labeling info on the layer changes. (Added at v3.10)

load

Fires after layer properties for the layer are successfully populated. This event must be successful before the layer can be added to the map. Should be used in favor of onLoad. (Added at v3.5)
Event Object Properties:
<Layer> layer The loaded layer.

mouse-down

Fires when a mouse button is pressed down and the mouse cursor is on a graphic. Should be used in favor of onMouseDown. (Added at v3.5)
Event Object:
<MouseEvent> mouseEvent A standard DOM MouseEvent with additional properties mapPoint and screenPoint.

mouse-drag

Fires while the mouse is being dragged until the mouse button is released. Should be used in favor of onMouseDrag. (Added at v3.5)
Event Object:
<MouseEvent> mouseEvent A standard DOM MouseEvent with additional properties mapPoint and screenPoint.

mouse-move

Fires as the mouse moves through a graphic on the GraphicsLayer. Should be used in favor of onMouseMove. (Added at v3.5)
Event Object:
<MouseEvent> mouseEvent A standard DOM MouseEvent with additional properties mapPoint and screenPoint.

mouse-out

Fires as the mouse exits a graphic on the GraphicsLayer. Should be used in favor of onMouseOut. (Added at v3.5)
Event Object:
<MouseEvent> mouseEvent A standard DOM MouseEvent with additional properties mapPoint and screenPoint.

mouse-over

Fires when the mouse first enters into a graphic on the GraphicsLayer. Should be used in favor of onMouseOver. (Added at v3.5)
Event Object:
<MouseEvent> mouseEvent A standard DOM MouseEvent with additional properties mapPoint and screenPoint.

mouse-up

Fires when a mouse button is released and the mouse cursor is on a graphic. Should be used in favor of onMouseUp. (Added at v3.5)
Event Object:
<MouseEvent> mouseEvent A standard DOM MouseEvent with additional properties mapPoint and screenPoint.

opacity-change

Fires when the layer opacity has been changed, and returns an object with the opacity value. Should be used in favor of onOpacityChange. (Added at v3.5)
Event Object Properties:
<Number> opacity Fires when the layer opacity (transparency) changes. A number property named opacity that indicates the new opacity. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency.

query-attachment-infos-complete

Fires when queryAttachmentInfos method is called. Should be used in favor of onQueryAttachmentInfosComplete. (Added at v3.5)
Event Object Properties:
<Object[]> info Information about the attachments associated with the feature. Each element in this array is an object with the following properties: objectId,url,id,name,contentType,size.

query-count-complete

Fires when the query for the count is complete. This event is only available for layers published using ArcGIS Server 10 SP1 or later. Should be used in favor of onQueryCountComplete. (Added at v3.5)
Event Object Properties:
<Number> count The number of features that satisfy the input query.

query-extent-complete

Fires when queryExtent method has completed. (Added at v3.9)
Event Object Properties:
<Number> count The count of features.
<Extent> extent The extent of features.

query-features-complete

Fires when queryFeatures() is complete. Should be used in favor of onQueryFeaturesComplete. (Added at v3.5)
Event Object Properties:
<FeatureSet> featureSet The FeatureSet returned from the query.
See also: queryFeatures()

query-ids-complete

Fires when queryIds() is complete. Should be used in favor of onQueryIdsComplete. (Added at v3.5)
Event Object Properties:
<Number[]> objectIds Array of ObjectIds returned from the query.
See also: queryIds()

query-limit-exceeded

Fired when the feature layer could not draw all the features due to a maxRecordCount limitation on a query operation. Should be used in favor of onQueryLimitExceeded. (Added at v3.5)

query-related-features-complete

Fires when queryRelatedFeatures() is complete. Should be used in favor of onQueryRelatedFeaturesComplete. (Added at v3.5)
Event Object Properties:
<Object> relatedFeatures An object that contains feature sets. Each feature set contains features, from the target layer/table, related to the source feature. In the example below 15 and 9 are the object IDs of the features in the source layer/table.
{
  "15": <FeatureSet1>,
  "9":  <FeatureSet2>
}

refresh-interval-change

This event is fired when the layer's refreshInterval is modified. (Added at v3.7)

refresh-tick

Fires right before the actual refresh kicks in for the layer, and only fires when the refresh is triggered by the refreshInterval. (Added at v3.27)

resume

Fires when a layer resumes drawing. (Added at v3.6)

scale-range-change

Fires when a layer's minScale and/or maxScale is changed. Should be used in favor of onScaleRangeChange. (Added at v3.5)

scale-visibility-change

Fires when a layer's scale visibility changes. The scale visibility changes when a layer is initially visible and becomes invisible because the map scale does not intersect the layer's scale range or vice versa. Should be used in favor of onScaleVisibilityChange. (Added at v3.5)

selection-clear

Fires after clearSelection has been called. Should be used in favor of onSelectionClear. (Added at v3.5)

selection-complete

Fires when selectFeatures() completes. Should be used in favor of onSelectionComplete. (Added at v3.5)
Event Object Properties:
<Graphic[]> features Features returned from the query. This does not equal the current selection, call getSelectedFeatures() to retrieve the current selection set.
<Number> method Selection method used in the selectFeatures method.

show-labels-change

Fired when the feature layer's labels are changed. Should be used in favor of onShowLabelsChange. (Added at v3.11)

suspend

Fires when a layer suspends drawing. (Added at v3.6)

update

Fires any time a layer has finished loading or updating itself. For an ArcGISTiledMapServiceLayer, the event fires when all required tiles have been retrieved and displayed. For an ArcGISDynamicMapServiceLayer or ArcGISImageServiceLayer, the event fires when the map image has been retrieved and displayed. For a GraphicsLayer, the event fires when all graphics have been redrawn after a pan or zoom. Deprecated at v2.0. Use update-start and update-end instead. (Added at v3.6)

update-end

Fired when the layer has finished updating its content. This event is always preceded by update-start. Should be used in favor of onUpdateEnd. (Added at v3.5)
Event Object Properties:
<Error> error Optional argument available when an error occurs during the update.
<Object> info Optional object that may have a boolean queryLimitExceeded property. queryLimitExceeded will be true if the feature layer could not draw all features due to a maxRecordCount limitation on the query operation. As of v2.8
See also: hasAllFeatures

update-start

Fired when the layer begins to update its content. The following table describes when the event is fired in various modes.
Snapshot
  • When the layer is added to the map.
  • When layer properties such as definition expression, time definition or time offset are modified.
  • When the map's time extent changes.
  • When the layer is refreshed.
OnDemand
  • When the layer is added to the map.
  • When the map's spatial extent or time extent changes.
  • When layer properties such as definition expression or time offset are modified.
  • When the layer is refreshed.
Selection The event is not fired in selection mode.
(Added at v3.6)

visibility-change

Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer. Should be used in favor of onVisibilityChange. (Added at v3.5)
Event Object Properties:
<Boolean> visible Fires when the layer visibility changes. A boolean property named visible indicates whether or not the layer is visible after visibility changed.
Show Modal