L.esri.Layers.HeatMapFeatureLayer
L.esri.Layers.HeatMapFeatureLayer
provides integration for Feature Layers with the Leaflet.heat plugin. Because of the extra dependency on Leaflet.heat we do not include L.esri.Layers.HeatMapFeatureLayer
in the default build of Esri Leaflet. It lives in /dist/extras/heatmap-feature-layer.js. You will also need to include your own copy of the Leaflet.heat plugin.
More information about Feature Layers can be found in the L.esri.Layers.FeatureLayer
documentation.
Constructor
Constructor | Description |
---|---|
new L.esri.Layers.HeatmapFeatureLayer( L.esri.Layers.heatmapFeatureLayer( new L.esri.HeatmapFeatureLayer( L.esri.heatmapFeatureLayer( |
url should be the URL to the Feature Layer. |
Option | Type | Description |
---|---|---|
where |
String |
A server side expression that will be evaluated to filter features. By default this will include all features in a service. |
fields |
Array |
An array of metadata names to pull from the service. Includes all fields by default. |
from |
Date |
When paired with to defines the time range of features to display. Required the Feature Layer to be time enabled. |
to |
Date |
When paired with from defines the time range of features to display. Required 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 |
'client' or 'server' |
Determines where features are filtered by time. By default features will be filtered by the server. If set to 'client' all features are loaded and filtered on the client before display. |
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. |
proxy |
String |
URL of an ArcGIS API for JavaScript proxies or ArcGIS Resource Proxies to use for proxying POST requests. |
useCors |
Boolean |
If this service should use CORS when making GET requests. |
L.esri.HeatMapFeatureLayer
will also accept any options that can be passed to Leaflet.heat to customize the appearance of the heatmap.
Events
Event | Type | Description |
---|---|---|
loading |
<LoadingEvent> | Fires when new features start loading. |
load |
<Load> | Fires when all features in the current bounds of the map have loaded. |
L.esri.Layers.FeatureLayer
also fires all L.esri.Services.FeatureLayer
events.
Methods
Method | Returns | Description |
---|---|---|
getWhere() |
String |
Returns the current where setting |
setWhere( |
this |
Sets the new where option and refreshes the layer to reflect the new where filter. Accepts an optional callback and function context. |
getTimeRange() |
Array |
Returns the current time range as an array like [from, to] |
setTimeRange( |
this |
Sets the current time filter applied to features. An optional callback is run upon completion if timeFilterMode is set to 'server' . Also accepts function context as the last argument. |
authenticate( |
this |
Authenticates this service with a new token and runs any pending requests that required a token. |
query() |
this |
Returns a new L.esri.services.Query object that can be used to query this layer. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error.
|
metadata( |
this |
Requests metadata about this Feature Layer. Callback will be called with error and metadata .
|
addFeature( |
this |
Adds a new feature to the feature layer. this also adds the feature to the map if creation is successful.
|
updateFeature( |
this |
Update the provided feature on the Feature Layer. This also updates the feature on the map.
|
deleteFeature( |
this |
Remove the feature with the provided id from the feature layer. This will also remove the feature from the map if it exists.
|
Example
var map = new L.Map('map').setView([40.722868115037,-73.92142295837404], 14);
L.esri.basemapLayer('Gray').addTo(map);
var heatmap = new L.esri.HeatmapFeatureLayer("http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Graffiti_Locations3/FeatureServer/0", {
radius: 12
}).addTo(map);
Esri Leaflet is a project from the Esri PDX R&D Center and the Esri Community