Base Classes

Misc.

L.esri.FeatureLayer

L.esri.FeatureLayer is used to visualize, style, query and edit vector geographic data hosted in both ArcGIS Online and published using ArcGIS Server. Copyright text from the service is added to map attribution automatically.

Feature Layers reference an individual data source in either a parent Map Service or Feature Service that can contain multiple layers. You can see a sample Map Service URL below:

L.esri.FeatureLayer divides the current map extent into a grid of individual cells and uses them to fire queries to fetch nearby features. This technique is comparable to MODE_ONDEMAND in the ArcGIS API for JavaScript.

If you want your FeatureLayer to display the symbology defined in the map or feature service, you need to use the Esri Leaflet Renderers plugin.

Options

Function that will be used for creating layers for GeoJSON points. If the option is not specified, simple markers will be created). For point layers, custom panes should be passed through pointToLayer (example here).

Provides an opportunity to introspect individual GeoJSON features in the layer.

where

String

An optional expression to filter features server side. String values should be denoted using single quotes ie: where: "FIELDNAME = 'field value'"; More information about valid SQL syntax can be found here.

maxZoom

Number

Closest zoom level the layer will be displayed on the map. example: maxZoom:19

minZoom

Number

Furthest zoom level the layer will be displayed on the map. example: minZoom:3

cacheLayers

Boolean

Will remove layers from the internal cache when they are removed from the map.

fields

Array

An array of fieldnames to pull from the service. Includes all fields by default. You should always specify the name of the unique id for the service. Usually either 'FID' or 'OBJECTID'.

from

Date

When paired with to defines the time range of features to display. Requires the Feature Layer to be time enabled.

to

Date

When paired with from defines the time range of features to display. Requires the Feature Layer to be time enabled.

timeField

false

The name of the field to lookup the time of the feature. Can be an object like {start:'startTime', end:'endTime'} or a string like 'created'.

timeFilterMode

'server' (default) or 'client'

Determines where features are filtered by time. By default features will be filtered by the server. If set to 'client' all features are requested and filtered by the app before display.

simplifyFactor

Number

How much to simplify polygons and polylines. A higher value gives better performance, a lower value gives a more accurate representation.

precision

Integer

How many digits of precision to request from the server. Wikipedia has a great reference of digit precision to meters.

token

String

If you pass a token in your options it will be included in all requests to the service.

In addition to the events above, L.esri.FeatureLayer also fires the following Mouse Eventsclick, dblclick, mouseover, mouseout, mousemove, and contextmenu and the following the Popup Eventspopupopen and popupclose