This reference reflects Leaflet {{site.latest_leaflet_version}}. Check this list if you are using a different version of Leaflet.
-| Enter | Move | Exit | Click | |
| Triangle 1: |
| Plugin | Description | Demo | Maintainer |
|---|---|---|---|
| {{ plugin.name }} | +{{ plugin.content }} | ++ {% if plugin.demo %} + Demo + {% endif %} + | ++ {% if plugin.category %} + {{ plugin.author }} + {% else %} + {{ plugin.author }} + {% endif %} + | +

listens(<String> type)listens(<String> type, <Boolean> propagate?)BooleanReturns true if a particular event type has any listeners attached to it.
Returns true if a particular event type has any listeners attached to it. The verification can optionally be propagated, it will return true if parents have the listener attached to it.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
latlng
LatLng
- The geographical point where the mouse event occured.
+ The geographical point where the mouse event occurred.
layerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map layer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map layer.
containerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map сontainer.
originalEvent
@@ -23029,7 +23029,7 @@ Methods
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
watchBoolean
falsetrue, starts continous watching of location changes (instead of detecting it
+ true, starts continuous watching of location changes (instead of detecting it
once) using W3C watchPosition method. You can later stop watching using
map.stopLocate() method.bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
'auto'right, left,
top, bottom, center, auto.
-auto will dynamicaly switch between right and left according to the tooltip
+auto will dynamically switch between right and left according to the tooltip
position on the map.bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
createTile(<Object> coords, <Function> done?)HTMLElementCalled only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropiate image URL given coords. The done
+to return an <img> HTML element with the appropriate image URL given coords. The done
callback is called when the tile has been loaded.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
createTile(<Object> coords, <Function> done?)HTMLElementCalled only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropiate image URL given coords. The done
+to return an <img> HTML element with the appropriate image URL given coords. The done
callback is called when the tile has been loaded.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
createTile(<Object> coords, <Function> done?)HTMLElementCalled only internally, must be overriden by classes extending GridLayer.
+
Called only internally, must be overridden by classes extending GridLayer.
Returns the HTMLElement corresponding to the given coords. If the done callback
is specified, it must be called when the tile has finished loading and drawing.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
equals(<LatLng> otherLatLng, <Number> maxMargin?)BooleanReturns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overriden by setting maxMargin to a small number.
Returns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overridden by setting maxMargin to a small number.
equals(<LatLngBounds> otherBounds, <Number> maxMargin?)BooleanReturns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overriden by setting maxMargin to a small number.
Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting maxMargin to a small number.
stamp(<Object> obj)Numberthrottle(<Function> fn, <Number> time, <Object> context)L.transformation(<Array> coefficients)[a: Number, b: Number, c: Number, d: Number].Various utility functions for polyine points processing, used by Leaflet internally to make polylines lightning-fast.
+Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
points by the given bounds (using the Sutherland-Hodgeman algorithm).
Used by Leaflet to only show polygon points that are on the screen or near, increasing
performance. Note that polygon points needs different algorithm for clipping
-than polyline, so there's a seperate method for it.listens(<String> type)listens(<String> type, <Boolean> propagate?)BooleanReturns true if a particular event type has any listeners attached to it.
Returns true if a particular event type has any listeners attached to it. The verification can optionally be propagated, it will return true if parents have the listener attached to it.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)thisBinds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
latlng
LatLng
- The geographical point where the mouse event occured.
+ The geographical point where the mouse event occurred.
layerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map layer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map layer.
containerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map сontainer.
originalEvent
@@ -23170,7 +23170,7 @@ Methods
bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)thisBinds a tooltip to the layer with the passed content and sets up the
-neccessary event listeners. If a Function is passed it will receive
+necessary event listeners. If a Function is passed it will receive
the layer as the first argument and should return a String or HTMLElement.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
watchBoolean
falsetrue, starts continous watching of location changes (instead of detecting it
+ true, starts continuous watching of location changes (instead of detecting it
once) using W3C watchPosition method. You can later stop watching using
map.stopLocate() method.openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
'auto'right, left,
top, bottom, center, auto.
-auto will dynamicaly switch between right and left according to the tooltip
+auto will dynamically switch between right and left according to the tooltip
position on the map.openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
createTile(<Object> coords, <Function> done?)HTMLElementCalled only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropiate image URL given coords. The done
+to return an <img> HTML element with the appropriate image URL given coords. The done
callback is called when the tile has been loaded.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
createTile(<Object> coords, <Function> done?)HTMLElementCalled only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropiate image URL given coords. The done
+to return an <img> HTML element with the appropriate image URL given coords. The done
callback is called when the tile has been loaded.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
createTile(<Object> coords, <Function> done?)HTMLElementCalled only internally, must be overriden by classes extending GridLayer.
+
Called only internally, must be overridden by classes extending GridLayer.
Returns the HTMLElement corresponding to the given coords. If the done callback
is specified, it must be called when the tile has finished loading and drawing.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
equals(<LatLng> otherLatLng, <Number> maxMargin?)BooleanReturns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overriden by setting maxMargin to a small number.
Returns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overridden by setting maxMargin to a small number.
equals(<LatLngBounds> otherBounds, <Number> maxMargin?)BooleanReturns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overriden by setting maxMargin to a small number.
Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting maxMargin to a small number.
stamp(<Object> obj)Numberthrottle(<Function> fn, <Number> time, <Object> context)L.transformation(<Array> coefficients)[a: Number, b: Number, c: Number, d: Number].Various utility functions for polyine points processing, used by Leaflet internally to make polylines lightning-fast.
+Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
points by the given bounds (using the Sutherland-Hodgeman algorithm).
Used by Leaflet to only show polygon points that are on the screen or near, increasing
performance. Note that polygon points needs different algorithm for clipping
-than polyline, so there's a seperate method for it.listens(<String> type)listens(<String> type, <Boolean> propagate?)BooleanReturns true if a particular event type has any listeners attached to it.
Returns true if a particular event type has any listeners attached to it. The verification can optionally be propagated, it will return true if parents have the listener attached to it.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
openPopup(<LatLng> latlng?)thisOpens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
openTooltip(<LatLng> latlng?)thisOpens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
latlng
LatLng
- The geographical point where the mouse event occured.
+ The geographical point where the mouse event occurred.
layerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map layer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map layer.
containerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map сontainer.
originalEvent
@@ -23198,7 +23198,7 @@ Methods
openPopup(<LatLng> latlng?)
this
- Opens the bound popup at the specificed latlng or at the default popup anchor if no latlng is passed.
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
@@ -23269,7 +23269,7 @@ Methods
openTooltip(<LatLng> latlng?)
this
- Opens the bound tooltip at the specificed latlng or at the default tooltip anchor if no latlng is passed.
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
diff --git a/docs/reference-1.3.0.html b/docs/reference-1.3.0.html
deleted file mode 100644
index 3442ff76fb4..00000000000
--- a/docs/reference-1.3.0.html
+++ /dev/null
@@ -1,23904 +0,0 @@
----
-layout: v2
-title: Documentation
-bodyclass: api-page
----
-
-Leaflet API reference
-
-This reference reflects Leaflet 1.3.0 and Leaflet 1.3.1. Check this list if you are using a different version of Leaflet.
-
-
-
- Map
-
- - Usage example
- - Creation
- - Options
- - Events
-
- Map Methods
-
- - Modifying map state
- - Getting map state
- - Layers and controls
- - Conversion methods
- - Other methods
-
- Map Misc
-
- - Properties
- - Panes
-
-
-
- UI Layers
-
- Raster Layers
-
- - TileLayer
- - TileLayer.WMS
- - ImageOverlay
- - VideoOverlay
-
- Vector Layers
-
-
-
- Other Layers
-
- - LayerGroup
- - FeatureGroup
- - GeoJSON
- - GridLayer
-
- Basic Types
-
- Controls
-
- - Zoom
- - Attribution
- - Layers
- - Scale
-
-
-
-
-
-
-
-
-
- Utility
-
- - Browser
- - Util
- - Transformation
- - LineUtil
- - PolyUtil
-
- DOM Utility
-
- - DomEvent
- - DomUtil
- - PosAnimation
- - Draggable
-
-
-
- Base Classes
-
- - Class
- - Evented
- - Layer
- - Interactive layer
- - Control
- - Handler
-
- - Projection
- - CRS
- - Renderer
-
-
- Misc
-
- - Event objects
- - global switches
- - noConflict
- - version
-
-
-
-
- Map
The central class of the API — it is used to create a map on a page and manipulate it.
-
-
-Usage example
-
-
-
-
-
-
-
-// initialize the map on the "map" div with a given center and zoom
-var map = L.map('map', {
- center: [51.505, -0.09],
- zoom: 13
-});
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.map(<String> id, <Map options> options?)
- Instantiates a map object given the DOM ID of a <div> element
-and optionally an object literal with Map options.
-
-
- L.map(<HTMLElement> el, <Map options> options?)
- Instantiates a map object given an instance of a <div> HTML element
-and optionally an object literal with Map options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- preferCanvas
- Boolean
- false
- Whether Paths should be rendered on a Canvas renderer.
-By default, all Paths are rendered in a SVG renderer.
-
-
-
-
-
-Control options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attributionControl
- Boolean
- true
- Whether a attribution control is added to the map by default.
-
-
- zoomControl
- Boolean
- true
- Whether a zoom control is added to the map by default.
-
-
-
-
-
-Interaction Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- closePopupOnClick
- Boolean
- true
- Set it to false if you don't want popups to close when user clicks the map.
-
-
- zoomSnap
- Number
- 1
- Forces the map's zoom level to always be a multiple of this, particularly
-right after a fitBounds() or a pinch-zoom.
-By default, the zoom level snaps to the nearest integer; lower values
-(e.g. 0.5 or 0.1) allow for greater granularity. A value of 0
-means the zoom level will not be snapped after fitBounds or a pinch-zoom.
-
-
- zoomDelta
- Number
- 1
- Controls how much the map's zoom level will change after a
-zoomIn(), zoomOut(), pressing +
-or - on the keyboard, or using the zoom controls.
-Values smaller than 1 (e.g. 0.5) allow for greater granularity.
-
-
- trackResize
- Boolean
- true
- Whether the map automatically handles browser window resize to update itself.
-
-
- boxZoom
- Boolean
- true
- Whether the map can be zoomed to a rectangular area specified by
-dragging the mouse while pressing the shift key.
-
-
- doubleClickZoom
- Boolean|String
- true
- Whether the map can be zoomed in by double clicking on it and
-zoomed out by double clicking while holding shift. If passed
-'center', double-click zoom will zoom to the center of the
- view regardless of where the mouse was.
-
-
- dragging
- Boolean
- true
- Whether the map be draggable with mouse/touch or not.
-
-
-
-
-
-Map State Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- crs
- CRS
- L.CRS.EPSG3857
- The Coordinate Reference System to use. Don't change this if you're not
-sure what it means.
-
-
- center
- LatLng
- undefined
- Initial geographic center of the map
-
-
- zoom
- Number
- undefined
- Initial map zoom level
-
-
- minZoom
- Number
- *
- Minimum zoom level of the map.
-If not specified and at least one GridLayer or TileLayer is in the map,
-the lowest of their minZoom options will be used instead.
-
-
- maxZoom
- Number
- *
- Maximum zoom level of the map.
-If not specified and at least one GridLayer or TileLayer is in the map,
-the highest of their maxZoom options will be used instead.
-
-
- layers
- Layer[]
- []
- Array of layers that will be added to the map initially
-
-
- maxBounds
- LatLngBounds
- null
- When this option is set, the map restricts the view to the given
-geographical bounds, bouncing the user back if the user tries to pan
-outside the view. To set the restriction dynamically, use
-setMaxBounds method.
-
-
- renderer
- Renderer
- *
- The default method for drawing vector layers on the map. L.SVG
-or L.Canvas by default depending on browser support.
-
-
-
-
-
-Animation Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- zoomAnimation
- Boolean
- true
- Whether the map zoom animation is enabled. By default it's enabled
-in all browsers that support CSS3 Transitions except Android.
-
-
- zoomAnimationThreshold
- Number
- 4
- Won't animate zoom if the zoom difference exceeds this value.
-
-
- fadeAnimation
- Boolean
- true
- Whether the tile fade animation is enabled. By default it's enabled
-in all browsers that support CSS3 Transitions except Android.
-
-
- markerZoomAnimation
- Boolean
- true
- Whether markers animate their zoom with the zoom animation, if disabled
-they will disappear for the length of the animation. By default it's
-enabled in all browsers that support CSS3 Transitions except Android.
-
-
- transform3DLimit
- Number
- 2^23
- Defines the maximum size of a CSS translation transform. The default
-value should not be changed unless a web browser positions layers in
-the wrong place after doing a large panBy.
-
-
-
-
-
-Panning Inertia Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- inertia
- Boolean
- *
- If enabled, panning of the map will have an inertia effect where
-the map builds momentum while dragging and continues moving in
-the same direction for some time. Feels especially nice on touch
-devices. Enabled by default unless running on old Android devices.
-
-
- inertiaDeceleration
- Number
- 3000
- The rate with which the inertial movement slows down, in pixels/second².
-
-
- inertiaMaxSpeed
- Number
- Infinity
- Max speed of the inertial movement, in pixels/second.
-
-
- easeLinearity
- Number
- 0.2
-
-
-
- worldCopyJump
- Boolean
- false
- With this option enabled, the map tracks when you pan to another "copy"
-of the world and seamlessly jumps to the original one so that all overlays
-like markers and vector layers are still visible.
-
-
- maxBoundsViscosity
- Number
- 0.0
- If maxBounds is set, this option will control how solid the bounds
-are when dragging the map around. The default value of 0.0 allows the
-user to drag outside the bounds at normal speed, higher values will
-slow down map dragging outside bounds, and 1.0 makes the bounds fully
-solid, preventing the user from dragging outside the bounds.
-
-
-
-
-
-Keyboard Navigation Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- keyboard
- Boolean
- true
- Makes the map focusable and allows users to navigate the map with keyboard
-arrows and +/- keys.
-
-
- keyboardPanDelta
- Number
- 80
- Amount of pixels to pan when pressing an arrow key.
-
-
-
-
-
-Mousewheel options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- scrollWheelZoom
- Boolean|String
- true
- Whether the map can be zoomed by using the mouse wheel. If passed 'center',
-it will zoom to the center of the view regardless of where the mouse was.
-
-
- wheelDebounceTime
- Number
- 40
- Limits the rate at which a wheel can fire (in milliseconds). By default
-user can't zoom via wheel more often than once per 40 ms.
-
-
- wheelPxPerZoomLevel
- Number
- 60
- How many scroll pixels (as reported by L.DomEvent.getWheelDelta)
-mean a change of one full zoom level. Smaller values will make wheel-zooming
-faster (and vice versa).
-
-
-
-
-
-Touch interaction options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tap
- Boolean
- true
- Enables mobile hacks for supporting instant taps (fixing 200ms click
-delay on iOS/Android) and touch holds (fired as contextmenu events).
-
-
- tapTolerance
- Number
- 15
- The max number of pixels a user can shift his finger during touch
-for it to be considered a valid tap.
-
-
- touchZoom
- Boolean|String
- *
- Whether the map can be zoomed by touch-dragging with two fingers. If
-passed 'center', it will zoom to the center of the view regardless of
-where the touch events (fingers) were. Enabled for touch-capable web
-browsers except for old Androids.
-
-
- bounceAtZoomLimits
- Boolean
- true
- Set it to false if you don't want the map to zoom beyond min/max zoom
-and then bounce back when pinch-zooming.
-
-
-
-
-
-
-
-Events
-
-
-
-Layer events
-
-
-
-
- Event
- Data
- Description
-
-
-
- baselayerchange
- LayersControlEvent
- Fired when the base layer is changed through the layer control.
-
-
- overlayadd
- LayersControlEvent
- Fired when an overlay is selected through the layer control.
-
-
- overlayremove
- LayersControlEvent
- Fired when an overlay is deselected through the layer control.
-
-
- layeradd
- LayerEvent
- Fired when a new layer is added to the map.
-
-
- layerremove
- LayerEvent
- Fired when some layer is removed from the map
-
-
-
-
-
-Map state change events
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- zoomlevelschange
- Event
- Fired when the number of zoomlevels on the map is changed due
-to adding or removing a layer.
-
-
- resize
- ResizeEvent
- Fired when the map is resized.
-
-
- unload
- Event
- Fired when the map is destroyed with remove method.
-
-
- viewreset
- Event
- Fired when the map needs to redraw its content (this usually happens
-on map zoom or load). Very useful for creating custom overlays.
-
-
- load
- Event
- Fired when the map is initialized (when its center and zoom are set
-for the first time).
-
-
- zoomstart
- Event
- Fired when the map zoom is about to change (e.g. before zoom animation).
-
-
- movestart
- Event
- Fired when the view of the map starts changing (e.g. user starts dragging the map).
-
-
- zoom
- Event
- Fired repeatedly during any change in zoom level, including zoom
-and fly animations.
-
-
- move
- Event
- Fired repeatedly during any movement of the map, including pan and
-fly animations.
-
-
- zoomend
- Event
- Fired when the map has changed, after any animations.
-
-
- moveend
- Event
- Fired when the center of the map stops changing (e.g. user stopped
-dragging the map).
-
-
-
-
-
-Popup events
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup is opened in the map
-
-
- popupclose
- PopupEvent
- Fired when a popup in the map is closed
-
-
- autopanstart
- Event
- Fired when the map starts autopanning when opening a popup.
-
-
-
-
-
-Tooltip events
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip is opened in the map.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip in the map is closed.
-
-
-
-
-
-Location events
-
-
-
-
- Event
- Data
- Description
-
-
-
- locationerror
- ErrorEvent
- Fired when geolocation (using the locate method) failed.
-
-
- locationfound
- LocationEvent
- Fired when geolocation (using the locate method)
-went successfully.
-
-
-
-
-
-Interaction events
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the map.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the map.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the map.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button on the map.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the map.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the map.
-
-
- mousemove
- MouseEvent
- Fired while the mouse moves over the map.
-
-
- contextmenu
- MouseEvent
- Fired when the user pushes the right mouse button on the map, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
- keypress
- KeyboardEvent
- Fired when the user presses a key from the keyboard while the map is focused.
-
-
- preclick
- MouseEvent
- Fired before mouse click on the map (sometimes useful when you
-want something to happen on click before any existing click
-handlers start running).
-
-
-
-
-
-Other Methods
-
-
-
-
- Event
- Data
- Description
-
-
-
- zoomanim
- ZoomAnimEvent
- Fired on every frame of a zoom animation
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getRenderer(<Path> layer)
- Renderer
- Returns the instance of Renderer that should be used to render the given
-Path. It will ensure that the renderer options of the map and paths
-are respected, and that the renderers do exist on the map.
-
-
-
-
-
-
-Methods for Layers and Controls
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addControl(<Control> control)
- this
- Adds the given control to the map
-
-
-
- removeControl(<Control> control)
- this
- Removes the given control from the map
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the map
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the map.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the map
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the map, optionally specifying context of the iterator function.
-map.eachLayer(function(layer){
- layer.bindPopup('Hello');
-});
-
-
-
- openPopup(<Popup> popup)
- this
- Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
-
-
-
- openPopup(<String|HTMLElement> content, <LatLng> latlng, <Popup options> options?)
- this
- Creates a popup with the specified content and options and opens it in the given point on a map.
-
-
-
- closePopup(<Popup> popup?)
- this
- Closes the popup previously opened with openPopup (or the given one).
-
-
-
- openTooltip(<Tooltip> tooltip)
- this
- Opens the specified tooltip.
-
-
-
- openTooltip(<String|HTMLElement> content, <LatLng> latlng, <Tooltip options> options?)
- this
- Creates a tooltip with the specified content and options and open it.
-
-
-
- closeTooltip(<Tooltip> tooltip?)
- this
- Closes the tooltip given as parameter.
-
-
-
-
-
-
-Methods for modifying map state
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setView(<LatLng> center, <Number> zoom, <Zoom/pan options> options?)
- this
- Sets the view of the map (geographical center and zoom) with the given
-animation options.
-
-
-
- setZoom(<Number> zoom, <Zoom/pan options> options?)
- this
- Sets the zoom of the map.
-
-
-
- zoomIn(<Number> delta?, <Zoom options> options?)
- this
- Increases the zoom of the map by delta (zoomDelta by default).
-
-
-
- zoomOut(<Number> delta?, <Zoom options> options?)
- this
- Decreases the zoom of the map by delta (zoomDelta by default).
-
-
-
- setZoomAround(<LatLng> latlng, <Number> zoom, <Zoom options> options)
- this
- Zooms the map while keeping a specified geographical point on the map
-stationary (e.g. used internally for scroll zoom and double-click zoom).
-
-
-
- setZoomAround(<Point> offset, <Number> zoom, <Zoom options> options)
- this
- Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
-
-
-
- fitBounds(<LatLngBounds> bounds, <fitBounds options> options?)
- this
- Sets a map view that contains the given geographical bounds with the
-maximum zoom level possible.
-
-
-
- fitWorld(<fitBounds options> options?)
- this
- Sets a map view that mostly contains the whole world with the maximum
-zoom level possible.
-
-
-
- panTo(<LatLng> latlng, <Pan options> options?)
- this
- Pans the map to a given center.
-
-
-
- panBy(<Point> offset, <Pan options> options?)
- this
- Pans the map by a given number of pixels (animated).
-
-
-
- flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?)
- this
- Sets the view of the map (geographical center and zoom) performing a smooth
-pan-zoom animation.
-
-
-
- flyToBounds(<LatLngBounds> bounds, <fitBounds options> options?)
- this
- Sets the view of the map with a smooth animation like flyTo,
-but takes a bounds parameter like fitBounds.
-
-
-
- setMaxBounds(<Bounds> bounds)
- this
- Restricts the map view to the given bounds (see the maxBounds option).
-
-
-
- setMinZoom(<Number> zoom)
- this
- Sets the lower limit for the available zoom levels (see the minZoom option).
-
-
-
- setMaxZoom(<Number> zoom)
- this
- Sets the upper limit for the available zoom levels (see the maxZoom option).
-
-
-
- panInsideBounds(<LatLngBounds> bounds, <Pan options> options?)
- this
- Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
-
-
-
- invalidateSize(<Zoom/pan options> options)
- this
- Checks if the map container size changed and updates the map if so —
-call it after you've changed the map size dynamically, also animating
-pan by default. If options.pan is false, panning will not occur.
-If options.debounceMoveend is true, it will delay moveend event so
-that it doesn't happen often even if the method is called many
-times in a row.
-
-
-
- invalidateSize(<Boolean> animate)
- this
- Checks if the map container size changed and updates the map if so —
-call it after you've changed the map size dynamically, also animating
-pan by default.
-
-
-
- stop()
- this
- Stops the currently running panTo or flyTo animation, if any.
-
-
-
-
-
-
-Geolocation methods
-
-
-
-
- Method
- Returns
- Description
-
-
-
- locate(<Locate options> options?)
- this
- Tries to locate the user using the Geolocation API, firing a locationfound
-event with location data on success or a locationerror event on failure,
-and optionally sets the map view to the user's location with respect to
-detection accuracy (or to the world view if geolocation failed).
-Note that, if your page doesn't use HTTPS, this method will fail in
-modern browsers (Chrome 50 and newer)
-See Locate options for more details.
-
-
-
- stopLocate()
- this
- Stops watching location previously initiated by map.locate({watch: true})
-and aborts resetting the map view if map.locate was called with
-{setView: true}.
-
-
-
-
-
-
-Other Methods
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addHandler(<String> name, <Function> HandlerClass)
- this
- Adds a new Handler to the map, given its name and constructor function.
-
-
-
- remove()
- this
- Destroys the map and clears all related event listeners.
-
-
-
- createPane(<String> name, <HTMLElement> container?)
- HTMLElement
- Creates a new map pane with the given name if it doesn't exist already,
-then returns it. The pane is created as a child of container, or
-as a child of the main map pane if not set.
-
-
-
- getPane(<String|HTMLElement> pane)
- HTMLElement
- Returns a map pane, given its name or its HTML element (its identity).
-
-
-
- getPanes()
- Object
- Returns a plain object containing the names of all panes as keys and
-the panes as values.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the map.
-
-
-
- whenReady(<Function> fn, <Object> context?)
- this
- Runs the given function fn when the map gets initialized with
-a view (center and zoom) and at least one layer, or immediately
-if it's already initialized, optionally passing a function context.
-
-
-
-
-
-
-Methods for Getting Map State
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getCenter()
- LatLng
- Returns the geographical center of the map view
-
-
-
- getZoom()
- Number
- Returns the current zoom level of the map view
-
-
-
- getBounds()
- LatLngBounds
- Returns the geographical bounds visible in the current map view
-
-
-
- getMinZoom()
- Number
- Returns the minimum zoom level of the map (if set in the minZoom option of the map or of any layers), or 0 by default.
-
-
-
- getMaxZoom()
- Number
- Returns the maximum zoom level of the map (if set in the maxZoom option of the map or of any layers).
-
-
-
- getBoundsZoom(<LatLngBounds> bounds, <Boolean> inside?)
- Number
- Returns the maximum zoom level on which the given bounds fit to the map
-view in its entirety. If inside (optional) is set to true, the method
-instead returns the minimum zoom level on which the map view fits into
-the given bounds in its entirety.
-
-
-
- getSize()
- Point
- Returns the current size of the map container (in pixels).
-
-
-
- getPixelBounds()
- Bounds
- Returns the bounds of the current map view in projected pixel
-coordinates (sometimes useful in layer and overlay implementations).
-
-
-
- getPixelOrigin()
- Point
- Returns the projected pixel coordinates of the top left point of
-the map layer (useful in custom layer and overlay implementations).
-
-
-
- getPixelWorldBounds(<Number> zoom?)
- Bounds
- Returns the world's bounds in pixel coordinates for zoom level zoom.
-If zoom is omitted, the map's current zoom level is used.
-
-
-
-
-
-
-Conversion Methods
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getZoomScale(<Number> toZoom, <Number> fromZoom)
- Number
- Returns the scale factor to be applied to a map transition from zoom level
-fromZoom to toZoom. Used internally to help with zoom animations.
-
-
-
- getScaleZoom(<Number> scale, <Number> fromZoom)
- Number
- Returns the zoom level that the map would end up at, if it is at fromZoom
-level and everything is scaled by a factor of scale. Inverse of
-getZoomScale.
-
-
-
- project(<LatLng> latlng, <Number> zoom)
- Point
- Projects a geographical coordinate LatLng according to the projection
-of the map's CRS, then scales it according to zoom and the CRS's
-Transformation. The result is pixel coordinate relative to
-the CRS origin.
-
-
-
- unproject(<Point> point, <Number> zoom)
- LatLng
- Inverse of project.
-
-
-
- layerPointToLatLng(<Point> point)
- LatLng
- Given a pixel coordinate relative to the origin pixel,
-returns the corresponding geographical coordinate (for the current zoom level).
-
-
-
- latLngToLayerPoint(<LatLng> latlng)
- Point
- Given a geographical coordinate, returns the corresponding pixel coordinate
-relative to the origin pixel.
-
-
-
- wrapLatLng(<LatLng> latlng)
- LatLng
- Returns a LatLng where lat and lng has been wrapped according to the
-map's CRS's wrapLat and wrapLng properties, if they are outside the
-CRS's bounds.
-By default this means longitude is wrapped around the dateline so its
-value is between -180 and +180 degrees.
-
-
-
- wrapLatLngBounds(<LatLngBounds> bounds)
- LatLngBounds
- Returns a LatLngBounds with the same size as the given one, ensuring that
-its center is within the CRS's bounds.
-By default this means the center longitude is wrapped around the dateline so its
-value is between -180 and +180 degrees, and the majority of the bounds
-overlaps the CRS's bounds.
-
-
-
- distance(<LatLng> latlng1, <LatLng> latlng2)
- Number
- Returns the distance between two geographical coordinates according to
-the map's CRS. By default this measures distance in meters.
-
-
-
- containerPointToLayerPoint(<Point> point)
- Point
- Given a pixel coordinate relative to the map container, returns the corresponding
-pixel coordinate relative to the origin pixel.
-
-
-
- layerPointToContainerPoint(<Point> point)
- Point
- Given a pixel coordinate relative to the origin pixel,
-returns the corresponding pixel coordinate relative to the map container.
-
-
-
- containerPointToLatLng(<Point> point)
- LatLng
- Given a pixel coordinate relative to the map container, returns
-the corresponding geographical coordinate (for the current zoom level).
-
-
-
- latLngToContainerPoint(<LatLng> latlng)
- Point
- Given a geographical coordinate, returns the corresponding pixel coordinate
-relative to the map container.
-
-
-
- mouseEventToContainerPoint(<MouseEvent> ev)
- Point
- Given a MouseEvent object, returns the pixel coordinate relative to the
-map container where the event took place.
-
-
-
- mouseEventToLayerPoint(<MouseEvent> ev)
- Point
- Given a MouseEvent object, returns the pixel coordinate relative to
-the origin pixel where the event took place.
-
-
-
- mouseEventToLatLng(<MouseEvent> ev)
- LatLng
- Given a MouseEvent object, returns geographical coordinate where the
-event took place.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Properties
-
-
-
-Handlers
-
-
-
-
- Property
- Type
- Description
-
-
-
- boxZoom
- Handler
- Box (shift-drag with mouse) zoom handler.
-
-
- doubleClickZoom
- Handler
- Double click zoom handler.
-
-
- dragging
- Handler
- Map dragging handler (by both mouse and touch).
-
-
- keyboard
- Handler
- Keyboard navigation handler.
-
-
- scrollWheelZoom
- Handler
- Scroll wheel zoom handler.
-
-
- tap
- Handler
- Mobile touch hacks (quick tap and touch hold) handler.
-
-
- touchZoom
- Handler
- Touch zoom handler.
-
-
-
-
-
-
-
-Map panes
-
-
-
-
-
-
-
- Pane
- Type
- Z-index
- Description
-
-
-
- mapPane
- HTMLElement
- 'auto'
- Pane that contains all other map panes
-
-
- tilePane
- HTMLElement
- 200
- Pane for GridLayers and TileLayers
-
-
- overlayPane
- HTMLElement
- 400
- Pane for vectors (Paths, like Polylines and Polygons), ImageOverlays and VideoOverlays
-
-
- shadowPane
- HTMLElement
- 500
- Pane for overlay shadows (e.g. Marker shadows)
-
-
- markerPane
- HTMLElement
- 600
- Pane for Icons of Markers
-
-
- tooltipPane
- HTMLElement
- 650
- Pane for Tooltips.
-
-
- popupPane
- HTMLElement
- 700
- Pane for Popups.
-
-
-
-
-
-
-
-
-
-Locate options
-
-
-
-
-
-Some of the geolocation methods for Map take in an options parameter. This
-is a plain javascript object with the following optional components:
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- watch
- Boolean
- false
- If true, starts continuous watching of location changes (instead of detecting it
-once) using W3C watchPosition method. You can later stop watching using
-map.stopLocate() method.
-
-
- setView
- Boolean
- false
- If true, automatically sets the map view to the user location with respect to
-detection accuracy, or to world view if geolocation failed.
-
-
- maxZoom
- Number
- Infinity
- The maximum zoom for automatic view setting when using setView option.
-
-
- timeout
- Number
- 10000
- Number of milliseconds to wait for a response from geolocation before firing a
-locationerror event.
-
-
- maximumAge
- Number
- 0
- Maximum age of detected location. If less than this amount of milliseconds
-passed since last geolocation response, locate will return a cached location.
-
-
- enableHighAccuracy
- Boolean
- false
- Enables high accuracy, see description in the W3C spec.
-
-
-
-
-
-
-
-
-
-Zoom options
-
-
-
-
-
-Some of the Map methods which modify the zoom level take in an options
-parameter. This is a plain javascript object with the following optional
-components:
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If not specified, zoom animation will happen if the zoom origin is inside the
-current view. If true, the map will attempt animating zoom disregarding where
-zoom origin is. Setting false will make it always reset the view completely
-without animation.
-
-
-
-
-
-
-
-
-
-Pan options
-
-
-
-
-
-Some of the Map methods which modify the center of the map take in an options
-parameter. This is a plain javascript object with the following optional
-components:
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If true, panning will always be animated if possible. If false, it will
-not animate panning, either resetting the map view if panning more than a
-screen away, or just setting a new offset for the map pane (except for panBy
-which always does the latter).
-
-
- duration
- Number
- 0.25
- Duration of animated panning, in seconds.
-
-
- easeLinearity
- Number
- 0.25
- The curvature factor of panning animation easing (third parameter of the
-Cubic Bezier curve). 1.0 means linear animation,
-and the smaller this number, the more bowed the curve.
-
-
- noMoveStart
- Boolean
- false
- If true, panning won't fire movestart event on start (used internally for
-panning inertia).
-
-
-
-
-
-
-
-
-
-Zoom/pan options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If not specified, zoom animation will happen if the zoom origin is inside the
-current view. If true, the map will attempt animating zoom disregarding where
-zoom origin is. Setting false will make it always reset the view completely
-without animation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- duration
- Number
- 0.25
- Duration of animated panning, in seconds.
-
-
- easeLinearity
- Number
- 0.25
- The curvature factor of panning animation easing (third parameter of the
-Cubic Bezier curve). 1.0 means linear animation,
-and the smaller this number, the more bowed the curve.
-
-
- noMoveStart
- Boolean
- false
- If true, panning won't fire movestart event on start (used internally for
-panning inertia).
-
-
-
-
-
-
-
-
-
-
-FitBounds options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- paddingTopLeft
- Point
- [0, 0]
- Sets the amount of padding in the top left corner of a map container that
-shouldn't be accounted for when setting the view to fit bounds. Useful if you
-have some control overlays on the map like a sidebar and you don't want them
-to obscure objects you're zooming to.
-
-
- paddingBottomRight
- Point
- [0, 0]
- The same for the bottom right corner of the map.
-
-
- padding
- Point
- [0, 0]
- Equivalent of setting both top left and bottom right padding to the same value.
-
-
- maxZoom
- Number
- null
- The maximum possible zoom to use.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If not specified, zoom animation will happen if the zoom origin is inside the
-current view. If true, the map will attempt animating zoom disregarding where
-zoom origin is. Setting false will make it always reset the view completely
-without animation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- duration
- Number
- 0.25
- Duration of animated panning, in seconds.
-
-
- easeLinearity
- Number
- 0.25
- The curvature factor of panning animation easing (third parameter of the
-Cubic Bezier curve). 1.0 means linear animation,
-and the smaller this number, the more bowed the curve.
-
-
- noMoveStart
- Boolean
- false
- If true, panning won't fire movestart event on start (used internally for
-panning inertia).
-
-
-
-
-
-
-
- Marker
L.Marker is used to display clickable/draggable icons on the map. Extends Layer.
-
-
-Usage example
-
-
-
-
-
-
-
-L.marker([50.5, 30.5]).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.marker(<LatLng> latlng, <Marker options> options?)
- Instantiates a Marker object given a geographical point and optionally an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- icon
- Icon
- *
- Icon instance to use for rendering the marker.
-See Icon documentation for details on how to customize the marker icon.
-If not specified, a common instance of L.Icon.Default is used.
-
-
- draggable
- Boolean
- false
- Whether the marker is draggable with mouse/touch or not.
-
-
- autoPan
- Boolean
- false
- Set it to true if you want the map to do panning animation when marker hits the edges.
-
-
- autoPanPadding
- Point
- Point(50, 50)
- Equivalent of setting both top left and bottom right autopan padding to the same value.
-
-
- autoPanSpeed
- Number
- 10
- Number of pixels the map should move by.
-
-
- keyboard
- Boolean
- true
- Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
-
-
- title
- String
- ''
- Text for the browser tooltip that appear on marker hover (no tooltip by default).
-
-
- alt
- String
- ''
- Text for the alt attribute of the icon image (useful for accessibility).
-
-
- zIndexOffset
- Number
- 0
- By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
-
-
- opacity
- Number
- 1.0
- The opacity of the marker.
-
-
- riseOnHover
- Boolean
- false
- If true, the marker will get on top of others when you hover the mouse over it.
-
-
- riseOffset
- Number
- 250
- The z-index offset used for the riseOnHover feature.
-
-
- pane
- String
- 'markerPane'
- Map pane where the markers icon will be added.
-
-
- bubblingMouseEvents
- Boolean
- false
- When true, a mouse event on this marker will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-In addition to shared layer methods like addTo() and remove() and popup methods like bindPopup() you can also use the following methods:
-
-
-
- Event
- Data
- Description
-
-
-
- move
- Event
- Fired when the marker is moved via setLatLng or by dragging. Old and new coordinates are included in event arguments as oldLatLng, latlng.
-
-
-
-
-
-Dragging events
-
-
-
-
- Event
- Data
- Description
-
-
-
- dragstart
- Event
- Fired when the user starts dragging the marker.
-
-
- movestart
- Event
- Fired when the marker starts moving (because of dragging).
-
-
- drag
- Event
- Fired repeatedly while the user drags the marker.
-
-
- dragend
- DragEndEvent
- Fired when the user stops dragging the marker.
-
-
- moveend
- Event
- Fired when the marker stops moving (because of dragging).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the marker (as a GeoJSON Point Feature).
-
-
-
- getLatLng()
- LatLng
- Returns the current geographical position of the marker.
-
-
-
- setLatLng(<LatLng> latlng)
- this
- Changes the marker position to the given point.
-
-
-
- setZIndexOffset(<Number> offset)
- this
- Changes the zIndex offset of the marker.
-
-
-
- setIcon(<Icon> icon)
- this
- Changes the marker icon.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the marker.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Properties
-
-
-
-Interaction handlers
-
-Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see Handler methods). Example:
-marker.dragging.disable();
-
-
-
-
- Property
- Type
- Description
-
-
-
- dragging
- Handler
- Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set marker.options.draggable).
-
-
-
-
-
-
- Popup
Used to open popups in certain places of the map. Use Map.openPopup to
-open popups while making sure that only one popup is open at one time
-(recommended for usability), or use Map.addLayer to open as many as you want.
-
-
-Usage example
-
-
-
-
-
-
-
-If you want to just bind a popup to marker click and then open it, it's really easy:
-marker.bindPopup(popupContent).openPopup();
-
-Path overlays like polylines also have a bindPopup method.
-Here's a more complicated way to open a popup on a map:
-var popup = L.popup()
- .setLatLng(latlng)
- .setContent('<p>Hello world!<br />This is a nice popup.</p>')
- .openOn(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.popup(<Popup options> options?, <Layer> source?)
- Instantiates a Popup object given an optional options object that describes its appearance and location and an optional source object that is used to tag the popup with a reference to the Layer to which it refers.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- maxWidth
- Number
- 300
- Max width of the popup, in pixels.
-
-
- minWidth
- Number
- 50
- Min width of the popup, in pixels.
-
-
- maxHeight
- Number
- null
- If set, creates a scrollable container of the given height
-inside a popup if its content exceeds it.
-
-
- autoPan
- Boolean
- true
- Set it to false if you don't want the map to do panning animation
-to fit the opened popup.
-
-
- autoPanPaddingTopLeft
- Point
- null
- The margin between the popup and the top left corner of the map
-view after autopanning was performed.
-
-
- autoPanPaddingBottomRight
- Point
- null
- The margin between the popup and the bottom right corner of the map
-view after autopanning was performed.
-
-
- autoPanPadding
- Point
- Point(5, 5)
- Equivalent of setting both top left and bottom right autopan padding to the same value.
-
-
- keepInView
- Boolean
- false
- Set it to true if you want to prevent users from panning the popup
-off of the screen while it is open.
-
-
- closeButton
- Boolean
- true
- Controls the presence of a close button in the popup.
-
-
- autoClose
- Boolean
- true
- Set it to false if you want to override the default behavior of
-the popup closing when another popup is opened.
-
-
- closeOnEscapeKey
- Boolean
- true
- Set it to false if you want to override the default behavior of
-the ESC key for closing of the popup.
-
-
- closeOnClick
- Boolean
- *
- Set it if you want to override the default behavior of the popup closing when user clicks
-on the map. Defaults to the map's closePopupOnClick option.
-
-
- className
- String
- ''
- A custom CSS class name to assign to the popup.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- offset
- Point
- Point(0, 7)
- The offset of the popup position. Useful to control the anchor
-of the popup when opening it on some overlays.
-
-
- pane
- String
- 'popupPane'
- Map pane where the popup will be added.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getLatLng()
- LatLng
- Returns the geographical point of popup.
-
-
-
- setLatLng(<LatLng> latlng)
- this
- Sets the geographical point where the popup will open.
-
-
-
- getContent()
- String|HTMLElement
- Returns the content of the popup.
-
-
-
- setContent(<String|HTMLElement|Function> htmlContent)
- this
- Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a String or HTMLElement to be used in the popup.
-
-
-
- getElement()
- String|HTMLElement
- Alias for getContent()
-
-
-
- update()
- null
- Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
-
-
-
- isOpen()
- Boolean
- Returns true when the popup is visible on the map.
-
-
-
- bringToFront()
- this
- Brings this popup in front of other popups (in the same map pane).
-
-
-
- bringToBack()
- this
- Brings this popup to the back of other popups (in the same map pane).
-
-
-
- openOn(<Map> map)
- this
- Adds the popup to the map and closes the previous one. The same as map.openPopup(popup).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Tooltip
Used to display small texts on top of map layers.
-
-
-Usage example
-
-
-
-
-
-
-
-marker.bindTooltip("my tooltip text").openTooltip();
-
-Note about tooltip offset. Leaflet takes two options in consideration
-for computing tooltip offsetting:
-
-- the
offset Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
-Add a positive x offset to move the tooltip to the right, and a positive y offset to
-move it to the bottom. Negatives will move to the left and top.
-- the
tooltipAnchor Icon option: this will only be considered for Marker. You
-should adapt this value if you use a custom icon.
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.tooltip(<Tooltip options> options?, <Layer> source?)
- Instantiates a Tooltip object given an optional options object that describes its appearance and location and an optional source object that is used to tag the tooltip with a reference to the Layer to which it refers.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'tooltipPane'
- Map pane where the tooltip will be added.
-
-
- offset
- Point
- Point(0, 0)
- Optional offset of the tooltip position.
-
-
- direction
- String
- 'auto'
- Direction where to open the tooltip. Possible values are: right, left,
-top, bottom, center, auto.
-auto will dynamically switch between right and left according to the tooltip
-position on the map.
-
-
- permanent
- Boolean
- false
- Whether to open the tooltip permanently or only on mouseover.
-
-
- sticky
- Boolean
- false
- If true, the tooltip will follow the mouse instead of being fixed at the feature center.
-
-
- interactive
- Boolean
- false
- If true, the tooltip will listen to the feature events.
-
-
- opacity
- Number
- 0.9
- Tooltip container opacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- className
- String
- ''
- A custom CSS class name to assign to the popup.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- TileLayer
Used to load and display tile layers on the map. Extends GridLayer.
-
-
-Usage example
-
-
-
-
-
-
-
-L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar'}).addTo(map);
-
-
-
-
-
-
-URL template
-
-
-
-A string of the following form:
-'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'
-
{s} means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; a, b or c by default, can be omitted), {z} — zoom level, {x} and {y} — tile coordinates. {r} can be used to add "@2x" to the URL to load retina tiles.
-You can use custom keys in the template, which will be evaluated from TileLayer options, like this:
-L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});
-
-
-
-
-
-
-
-Creation
-
-
-
-Extension methods
-
-
-
-
- Factory
- Description
-
-
-
- L.tilelayer(<String> urlTemplate, <TileLayer options> options?)
- Instantiates a tile layer object given a URL template and optionally an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- minZoom
- Number
- 0
- The minimum zoom level down to which this layer will be displayed (inclusive).
-
-
- maxZoom
- Number
- 18
- The maximum zoom level up to which this layer will be displayed (inclusive).
-
-
- subdomains
- String|String[]
- 'abc'
- Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
-
-
- errorTileUrl
- String
- ''
- URL to the tile image to show in place of the tile that failed to load.
-
-
- zoomOffset
- Number
- 0
- The zoom number used in tile URLs will be offset with this value.
-
-
- tms
- Boolean
- false
- If true, inverses Y axis numbering for tiles (turn this on for TMS services).
-
-
- zoomReverse
- Boolean
- false
- If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
-
-
- detectRetina
- Boolean
- false
- If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
-
-
- crossOrigin
- Boolean
- false
- If true, all tiles will have their crossOrigin attribute set to ''. This is needed if you want to access tile pixel data.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tileSize
- Number|Point
- 256
- Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
-
-
- opacity
- Number
- 1.0
- Opacity of the tiles. Can be used in the createTile() function.
-
-
- updateWhenIdle
- Boolean
- (depends)
- Load new tiles only when panning ends.
-true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-false otherwise in order to display new tiles during panning, since it is easy to pan outside the
-keepBuffer option in desktop browsers.
-
-
- updateWhenZooming
- Boolean
- true
- By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
-
-
- updateInterval
- Number
- 200
- Tiles will not update more than once every updateInterval milliseconds when panning.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- bounds
- LatLngBounds
- undefined
- If set, tiles will only be loaded inside the set LatLngBounds.
-
-
- maxNativeZoom
- Number
- undefined
- Maximum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels higher than maxNativeZoom will be loaded
-from maxNativeZoom level and auto-scaled.
-
-
- minNativeZoom
- Number
- undefined
- Minimum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels lower than minNativeZoom will be loaded
-from minNativeZoom level and auto-scaled.
-
-
- noWrap
- Boolean
- false
- Whether the layer is wrapped around the antimeridian. If true, the
-GridLayer will only be displayed once at low zoom levels. Has no
-effect when the map CRS doesn't wrap around. Can be used
-in combination with bounds to prevent requesting
-tiles outside the CRS limits.
-
-
- pane
- String
- 'tilePane'
- Map pane where the grid layer will be added.
-
-
- className
- String
- ''
- A custom class name to assign to the tile layer. Empty by default.
-
-
- keepBuffer
- Number
- 2
- When panning the map, keep this many rows and columns of tiles before unloading them.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- loading
- Event
- Fired when the grid layer starts loading tiles.
-
-
- tileunload
- TileEvent
- Fired when a tile is removed (e.g. when a tile goes off the screen).
-
-
- tileloadstart
- TileEvent
- Fired when a tile is requested and starts loading.
-
-
- tileerror
- TileErrorEvent
- Fired when there is an error loading a tile.
-
-
- tileload
- TileEvent
- Fired when a tile loads.
-
-
- load
- Event
- Fired when the grid layer loaded all visible tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setUrl(<String> url, <Boolean> noRedraw?)
- this
- Updates the layer's URL template and redraws it (unless noRedraw is set to true).
-
-
-
- createTile(<Object> coords, <Function> done?)
- HTMLElement
- Called only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropriate image URL given coords. The done
-callback is called when the tile has been loaded.
-
-
-
-
-
-
-Extension methods
-
-Layers extending TileLayer might reimplement the following method.
-
-
-
- Method
- Returns
- Description
-
-
-
- getTileUrl(<Object> coords)
- String
- Called only internally, returns the URL for a tile given its coordinates.
-Classes extending TileLayer can override this function to provide custom tile URL naming schemes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the tile layer to the top of all tile layers.
-
-
-
- bringToBack()
- this
- Brings the tile layer to the bottom of all tile layers.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the tiles for this layer.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the grid layer.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Changes the zIndex of the grid layer.
-
-
-
- isLoading()
- Boolean
- Returns true if any tile in the grid layer has not finished loading.
-
-
-
- redraw()
- this
- Causes the layer to clear all the tiles and request them again.
-
-
-
- getTileSize()
- Point
- Normalizes the tileSize option into a point. Used by the createTile() method.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- TileLayer.WMS
Used to display WMS services as tile layers on the map. Extends TileLayer.
-
-
-Usage example
-
-
-
-
-
-
-
-var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", {
- layers: 'nexrad-n0r-900913',
- format: 'image/png',
- transparent: true,
- attribution: "Weather data © 2012 IEM Nexrad"
-});
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.tileLayer.wms(<String> baseUrl, <TileLayer.WMS options> options)
- Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-If any custom options not documented here are used, they will be sent to the
-WMS server as extra parameters in each request URL. This can be useful for
-non-standard vendor WMS parameters.
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- layers
- String
- ''
- (required) Comma-separated list of WMS layers to show.
-
-
- styles
- String
- ''
- Comma-separated list of WMS styles.
-
-
- format
- String
- 'image/jpeg'
- WMS image format (use 'image/png' for layers with transparency).
-
-
- transparent
- Boolean
- false
- If true, the WMS service will return images with transparency.
-
-
- version
- String
- '1.1.1'
- Version of the WMS service to use
-
-
- crs
- CRS
- null
- Coordinate Reference System to use for the WMS requests, defaults to
-map CRS. Don't change this if you're not sure what it means.
-
-
- uppercase
- Boolean
- false
- If true, WMS request parameter keys will be uppercase.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- minZoom
- Number
- 0
- The minimum zoom level down to which this layer will be displayed (inclusive).
-
-
- maxZoom
- Number
- 18
- The maximum zoom level up to which this layer will be displayed (inclusive).
-
-
- subdomains
- String|String[]
- 'abc'
- Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
-
-
- errorTileUrl
- String
- ''
- URL to the tile image to show in place of the tile that failed to load.
-
-
- zoomOffset
- Number
- 0
- The zoom number used in tile URLs will be offset with this value.
-
-
- tms
- Boolean
- false
- If true, inverses Y axis numbering for tiles (turn this on for TMS services).
-
-
- zoomReverse
- Boolean
- false
- If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
-
-
- detectRetina
- Boolean
- false
- If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
-
-
- crossOrigin
- Boolean
- false
- If true, all tiles will have their crossOrigin attribute set to ''. This is needed if you want to access tile pixel data.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tileSize
- Number|Point
- 256
- Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
-
-
- opacity
- Number
- 1.0
- Opacity of the tiles. Can be used in the createTile() function.
-
-
- updateWhenIdle
- Boolean
- (depends)
- Load new tiles only when panning ends.
-true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-false otherwise in order to display new tiles during panning, since it is easy to pan outside the
-keepBuffer option in desktop browsers.
-
-
- updateWhenZooming
- Boolean
- true
- By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
-
-
- updateInterval
- Number
- 200
- Tiles will not update more than once every updateInterval milliseconds when panning.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- bounds
- LatLngBounds
- undefined
- If set, tiles will only be loaded inside the set LatLngBounds.
-
-
- maxNativeZoom
- Number
- undefined
- Maximum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels higher than maxNativeZoom will be loaded
-from maxNativeZoom level and auto-scaled.
-
-
- minNativeZoom
- Number
- undefined
- Minimum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels lower than minNativeZoom will be loaded
-from minNativeZoom level and auto-scaled.
-
-
- noWrap
- Boolean
- false
- Whether the layer is wrapped around the antimeridian. If true, the
-GridLayer will only be displayed once at low zoom levels. Has no
-effect when the map CRS doesn't wrap around. Can be used
-in combination with bounds to prevent requesting
-tiles outside the CRS limits.
-
-
- pane
- String
- 'tilePane'
- Map pane where the grid layer will be added.
-
-
- className
- String
- ''
- A custom class name to assign to the tile layer. Empty by default.
-
-
- keepBuffer
- Number
- 2
- When panning the map, keep this many rows and columns of tiles before unloading them.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- loading
- Event
- Fired when the grid layer starts loading tiles.
-
-
- tileunload
- TileEvent
- Fired when a tile is removed (e.g. when a tile goes off the screen).
-
-
- tileloadstart
- TileEvent
- Fired when a tile is requested and starts loading.
-
-
- tileerror
- TileErrorEvent
- Fired when there is an error loading a tile.
-
-
- tileload
- TileEvent
- Fired when a tile loads.
-
-
- load
- Event
- Fired when the grid layer loaded all visible tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setParams(<Object> params, <Boolean> noRedraw?)
- this
- Merges an object with the new parameters and re-requests tiles on the current screen (unless noRedraw was set to true).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setUrl(<String> url, <Boolean> noRedraw?)
- this
- Updates the layer's URL template and redraws it (unless noRedraw is set to true).
-
-
-
- createTile(<Object> coords, <Function> done?)
- HTMLElement
- Called only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropriate image URL given coords. The done
-callback is called when the tile has been loaded.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the tile layer to the top of all tile layers.
-
-
-
- bringToBack()
- this
- Brings the tile layer to the bottom of all tile layers.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the tiles for this layer.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the grid layer.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Changes the zIndex of the grid layer.
-
-
-
- isLoading()
- Boolean
- Returns true if any tile in the grid layer has not finished loading.
-
-
-
- redraw()
- this
- Causes the layer to clear all the tiles and request them again.
-
-
-
- getTileSize()
- Point
- Normalizes the tileSize option into a point. Used by the createTile() method.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- ImageOverlay
Used to load and display a single image over specific bounds of the map. Extends Layer.
-
-
-Usage example
-
-
-
-
-
-
-
-var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
- imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
-L.imageOverlay(imageUrl, imageBounds).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.imageOverlay(<String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options?)
- Instantiates an image overlay object given the URL of the image and the
-geographical bounds it is tied to.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- opacity
- Number
- 1.0
- The opacity of the image overlay.
-
-
- alt
- String
- ''
- Text for the alt attribute of the image (useful for accessibility).
-
-
- interactive
- Boolean
- false
- If true, the image overlay will emit mouse events when clicked or hovered.
-
-
- crossOrigin
- Boolean
- false
- If true, the image will have its crossOrigin attribute set to ''. This is needed if you want to access image pixel data.
-
-
- errorOverlayUrl
- String
- ''
- URL to the overlay image to show in place of the overlay that failed to load.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- className
- String
- ''
- A custom class name to assign to the image. Empty by default.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this layer will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- load
- Event
- Fired when the ImageOverlay layer has loaded its image
-
-
- error
- Event
- Fired when the ImageOverlay layer has loaded its image
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setOpacity(<Number> opacity)
- this
- Sets the opacity of the overlay.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all overlays.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all overlays.
-
-
-
- setUrl(<String> url)
- this
- Changes the URL of the image.
-
-
-
- setBounds(<LatLngBounds> bounds)
- this
- Update the bounds that this ImageOverlay covers
-Changes the zIndex of the image overlay.
-
-
-
- getBounds()
- LatLngBounds
- Get the bounds that this ImageOverlay covers
-
-
-
- getElement()
- HTMLElement
- Returns the instance of HTMLImageElement
-used by this overlay.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- VideoOverlay
Used to load and display a video player over specific bounds of the map. Extends ImageOverlay.
-A video overlay uses the <video>
-HTML5 element.
-
-
-Usage example
-
-
-
-
-
-
-
-var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
- videoBounds = [[ 32, -130], [ 13, -100]];
-L.VideoOverlay(videoUrl, videoBounds ).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.videoOverlay(<String|Array|HTMLVideoElement> video, <LatLngBounds> bounds, <VideoOverlay options> options?)
- Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
-geographical bounds it is tied to.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- autoplay
- Boolean
- true
- Whether the video starts playing automatically when loaded.
-
-
- loop
- Boolean
- true
- Whether the video will loop back to the beginning when played.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- opacity
- Number
- 1.0
- The opacity of the image overlay.
-
-
- alt
- String
- ''
- Text for the alt attribute of the image (useful for accessibility).
-
-
- interactive
- Boolean
- false
- If true, the image overlay will emit mouse events when clicked or hovered.
-
-
- crossOrigin
- Boolean
- false
- If true, the image will have its crossOrigin attribute set to ''. This is needed if you want to access image pixel data.
-
-
- errorOverlayUrl
- String
- ''
- URL to the overlay image to show in place of the overlay that failed to load.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- className
- String
- ''
- A custom class name to assign to the image. Empty by default.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this layer will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- load
- Event
- Fired when the video has finished loading the first frame
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- error
- Event
- Fired when the ImageOverlay layer has loaded its image
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getElement()
- HTMLVideoElement
- Returns the instance of HTMLVideoElement
-used by this overlay.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setOpacity(<Number> opacity)
- this
- Sets the opacity of the overlay.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all overlays.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all overlays.
-
-
-
- setUrl(<String> url)
- this
- Changes the URL of the image.
-
-
-
- setBounds(<LatLngBounds> bounds)
- this
- Update the bounds that this ImageOverlay covers
-Changes the zIndex of the image overlay.
-
-
-
- getBounds()
- LatLngBounds
- Get the bounds that this ImageOverlay covers
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Path
An abstract class that contains options and constants shared between vector
-overlays (Polygon, Polyline, Circle). Do not use it directly. Extends Layer.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Polyline
A class for drawing polyline overlays on a map. Extends Path.
-
-
-Usage example
-
-
-
-
-
-
-
-// create a red polyline from an array of LatLng points
-var latlngs = [
- [45.51, -122.68],
- [37.77, -122.43],
- [34.04, -118.2]
-];
-var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
-// zoom the map to the polyline
-map.fitBounds(polyline.getBounds());
-
-You can also pass a multi-dimensional array to represent a MultiPolyline shape:
-// create a red polyline from an array of arrays of LatLng points
-var latlngs = [
- [[45.51, -122.68],
- [37.77, -122.43],
- [34.04, -118.2]],
- [[40.78, -73.91],
- [41.83, -87.62],
- [32.76, -96.72]]
-];
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.polyline(<LatLng[]> latlngs, <Polyline options> options?)
- Instantiates a polyline object given an array of geographical points and
-optionally an options object. You can create a Polyline object with
-multiple separate lines (MultiPolyline) by passing an array of arrays
-of geographic points.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- smoothFactor
- Number
- 1.0
- How much to simplify the polyline on each zoom level. More means
-better performance and smoother look, and less means more accurate representation.
-
-
- noClip
- Boolean
- false
- Disable polyline clipping.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the polyline (as a GeoJSON LineString or MultiLineString Feature).
-
-
-
- getLatLngs()
- LatLng[]
- Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-
-
-
- setLatLngs(<LatLng[]> latlngs)
- this
- Replaces all the points in the polyline with the given array of geographical points.
-
-
-
- isEmpty()
- Boolean
- Returns true if the Polyline has no LatLngs.
-
-
-
- closestLayerPoint()
- Point
- Returns the point closest to p on the Polyline.
-
-
-
- getCenter()
- LatLng
- Returns the center (centroid) of the polyline.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
- addLatLng(<LatLng> latlng)
- this
- Adds a given point to the polyline. By default, adds to the first ring of
-the polyline in case of a multi-polyline, but can be overridden by passing
-a specific ring as a LatLng array (that you can earlier access with getLatLngs).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Polygon
A class for drawing polygon overlays on a map. Extends Polyline.
-Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
-
-
-Usage example
-
-
-
-
-
-
-
-// create a red polygon from an array of LatLng points
-var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
-var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
-// zoom the map to the polygon
-map.fitBounds(polygon.getBounds());
-
-You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
-var latlngs = [
- [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
- [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
-];
-
-Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
-var latlngs = [
- [ // first polygon
- [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
- [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
- ],
- [ // second polygon
- [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
- ]
-];
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.polygon(<LatLng[]> latlngs, <Polyline options> options?)
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- smoothFactor
- Number
- 1.0
- How much to simplify the polyline on each zoom level. More means
-better performance and smoother look, and less means more accurate representation.
-
-
- noClip
- Boolean
- false
- Disable polyline clipping.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the polygon (as a GeoJSON Polygon or MultiPolygon Feature).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getLatLngs()
- LatLng[]
- Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-
-
-
- setLatLngs(<LatLng[]> latlngs)
- this
- Replaces all the points in the polyline with the given array of geographical points.
-
-
-
- isEmpty()
- Boolean
- Returns true if the Polyline has no LatLngs.
-
-
-
- closestLayerPoint()
- Point
- Returns the point closest to p on the Polyline.
-
-
-
- getCenter()
- LatLng
- Returns the center (centroid) of the polyline.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
- addLatLng(<LatLng> latlng)
- this
- Adds a given point to the polyline. By default, adds to the first ring of
-the polyline in case of a multi-polyline, but can be overridden by passing
-a specific ring as a LatLng array (that you can earlier access with getLatLngs).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Rectangle
A class for drawing rectangle overlays on a map. Extends Polygon.
-
-
-Usage example
-
-
-
-
-
-
-
-// define rectangle geographical bounds
-var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
-// create an orange rectangle
-L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
-// zoom the map to the rectangle bounds
-map.fitBounds(bounds);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.rectangle(<LatLngBounds> latLngBounds, <Polyline options> options?)
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- smoothFactor
- Number
- 1.0
- How much to simplify the polyline on each zoom level. More means
-better performance and smoother look, and less means more accurate representation.
-
-
- noClip
- Boolean
- false
- Disable polyline clipping.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setBounds(<LatLngBounds> latLngBounds)
- this
- Redraws the rectangle with the passed bounds.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getLatLngs()
- LatLng[]
- Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-
-
-
- setLatLngs(<LatLng[]> latlngs)
- this
- Replaces all the points in the polyline with the given array of geographical points.
-
-
-
- isEmpty()
- Boolean
- Returns true if the Polyline has no LatLngs.
-
-
-
- closestLayerPoint()
- Point
- Returns the point closest to p on the Polyline.
-
-
-
- getCenter()
- LatLng
- Returns the center (centroid) of the polyline.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
- addLatLng(<LatLng> latlng)
- this
- Adds a given point to the polyline. By default, adds to the first ring of
-the polyline in case of a multi-polyline, but can be overridden by passing
-a specific ring as a LatLng array (that you can earlier access with getLatLngs).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Circle
A class for drawing circle overlays on a map. Extends CircleMarker.
-It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).
-
-
-Usage example
-
-
-
-
-
-
-
-L.circle([50.5, 30.5], {radius: 200}).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.circle(<LatLng> latlng, <Circle options> options?)
- Instantiates a circle object given a geographical point, and an options object
-which contains the circle radius.
-
-
- L.circle(<LatLng> latlng, <Number> radius, <Circle options> options?)
- Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
-Do not use in new applications or plugins.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- radius
- Number
-
- Radius of the circle, in meters.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setRadius(<Number> radius)
- this
- Sets the radius of a circle. Units are in meters.
-
-
-
- getRadius()
- Number
- Returns the current radius of a circle. Units are in meters.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
-
-
-
- setLatLng(<LatLng> latLng)
- this
- Sets the position of a circle marker to a new location.
-
-
-
- getLatLng()
- LatLng
- Returns the current geographical position of the circle marker
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- CircleMarker
A circle of a fixed size with radius specified in pixels. Extends Path.
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.circleMarker(<LatLng> latlng, <CircleMarker options> options?)
- Instantiates a circle marker object given a geographical point, and an optional options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- radius
- Number
- 10
- Radius of the circle marker, in pixels
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
-
-
-
- setLatLng(<LatLng> latLng)
- this
- Sets the position of a circle marker to a new location.
-
-
-
- getLatLng()
- LatLng
- Returns the current geographical position of the circle marker
-
-
-
- setRadius(<Number> radius)
- this
- Sets the radius of a circle marker. Units are in pixels.
-
-
-
- getRadius()
- Number
- Returns the current radius of the circle
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- SVG
Although SVG is not available on IE7 and IE8, these browsers support VML, and the SVG renderer will fall back to VML in this case.
-VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
-with old versions of Internet Explorer.
-Allows vector layers to be displayed with SVG.
-Inherits Renderer.
-Due to technical limitations, SVG is not
-available in all web browsers, notably Android 2.x and 3.x.
-Although SVG is not available on IE7 and IE8, these browsers support
-VML
-(a now deprecated technology), and the SVG renderer will fall back to VML in
-this case.
-
-
-Usage example
-
-
-
-
-
-
-
-Use SVG by default for all paths in the map:
-var map = L.map('map', {
- renderer: L.svg()
-});
-
-Use a SVG renderer with extra padding for specific vector geometries:
-var map = L.map('map');
-var myRenderer = L.svg({ padding: 0.5 });
-var line = L.polyline( coordinates, { renderer: myRenderer } );
-var circle = L.circle( center, { renderer: myRenderer } );
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.svg(<Renderer options> options?)
- Creates a SVG renderer with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- padding
- Number
- 0.1
- How much to extend the clip area around the map view (relative to its size)
-e.g. 0.1 would be 10% of map view in each direction
-
-
- tolerance
- Number
- 0
- How much to extend click tolerance round a path/object on the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- update
- Event
- Fired when the renderer updates its bounds, center and zoom, for example when
-its map has moved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-There are several static functions which can be called without instantiating L.SVG:
-
-
-
- Function
- Returns
- Description
-
-
-
- create(<String> name)
- SVGElement
- Returns a instance of SVGElement,
-corresponding to the class name passed. For example, using 'line' will return
-an instance of SVGLineElement.
-
-
- pointsToPath(<Point[]> rings, <Boolean> closed)
- String
- Generates a SVG path string for multiple rings, with each ring turning
-into "M..L..L.." instructions
-
-
-
-
-
-
- Canvas
Allows vector layers to be displayed with <canvas>.
-Inherits Renderer.
-Due to technical limitations, Canvas is not
-available in all web browsers, notably IE8, and overlapping geometries might
-not display properly in some edge cases.
-
-
-Usage example
-
-
-
-
-
-
-
-Use Canvas by default for all paths in the map:
-var map = L.map('map', {
- renderer: L.canvas()
-});
-
-Use a Canvas renderer with extra padding for specific vector geometries:
-var map = L.map('map');
-var myRenderer = L.canvas({ padding: 0.5 });
-var line = L.polyline( coordinates, { renderer: myRenderer } );
-var circle = L.circle( center, { renderer: myRenderer } );
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.canvas(<Renderer options> options?)
- Creates a Canvas renderer with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- padding
- Number
- 0.1
- How much to extend the clip area around the map view (relative to its size)
-e.g. 0.1 would be 10% of map view in each direction
-
-
- tolerance
- Number
- 0
- How much to extend click tolerance round a path/object on the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- update
- Event
- Fired when the renderer updates its bounds, center and zoom, for example when
-its map has moved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- LayerGroup
Used to group several layers and handle them as one. If you add it to the map,
-any layers added or removed from the group will be added/removed on the map as
-well. Extends Layer.
-
-
-Usage example
-
-
-
-
-
-
-
-L.layerGroup([marker1, marker2])
- .addLayer(polyline)
- .addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.layerGroup(<Layer[]> layers?, <Object> options?)
- Create a layer group, optionally given an initial set of layers and an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the group.
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the group.
-
-
-
- removeLayer(<Number> id)
- this
- Removes the layer with the given internal ID from the group.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the group.
-
-
-
- hasLayer(<Number> id)
- Boolean
- Returns true if the given internal ID is currently added to the group.
-
-
-
- clearLayers()
- this
- Removes all the layers from the group.
-
-
-
- invoke(<String> methodName, …)
- this
- Calls methodName on every layer contained in this group, passing any
-additional parameters. Has no effect if the layers contained do not
-implement methodName.
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the group, optionally specifying context of the iterator function.
-group.eachLayer(function (layer) {
- layer.bindPopup('Hello');
-});
-
-
-
-
- getLayer(<Number> id)
- Layer
- Returns the layer with the given internal ID.
-
-
-
- getLayers()
- Layer[]
- Returns an array of all the layers added to the group.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Calls setZIndex on every layer contained in this group, passing the z-index.
-
-
-
- getLayerId(<Layer> layer)
- Number
- Returns the internal ID for a layer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- FeatureGroup
Extended LayerGroup that makes it easier to do the same thing to all its member layers:
-
-bindPopup binds a popup to all of the layers at once (likewise with bindTooltip)
-- Events are propagated to the
FeatureGroup, so if the group has an event
-handler, it will handle events from any of the layers. This includes mouse events
-and custom events.
-- Has
layeradd and layerremove events
-
-
-
-Usage example
-
-
-
-
-
-
-
-L.featureGroup([marker1, marker2, polyline])
- .bindPopup('Hello world!')
- .on('click', function() { alert('Clicked on a member of the group!'); })
- .addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.featureGroup(<Layer[]> layers)
- Create a feature group, optionally given an initial set of layers.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- layeradd
- LayerEvent
- Fired when a layer is added to this FeatureGroup
-
-
- layerremove
- LayerEvent
- Fired when a layer is removed from this FeatureGroup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setStyle(<Path options> style)
- this
- Sets the given path options to each layer of the group that has a setStyle method.
-
-
-
- bringToFront()
- this
- Brings the layer group to the top of all other layers
-
-
-
- bringToBack()
- this
- Brings the layer group to the back of all other layers
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the group.
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the group.
-
-
-
- removeLayer(<Number> id)
- this
- Removes the layer with the given internal ID from the group.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the group.
-
-
-
- hasLayer(<Number> id)
- Boolean
- Returns true if the given internal ID is currently added to the group.
-
-
-
- clearLayers()
- this
- Removes all the layers from the group.
-
-
-
- invoke(<String> methodName, …)
- this
- Calls methodName on every layer contained in this group, passing any
-additional parameters. Has no effect if the layers contained do not
-implement methodName.
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the group, optionally specifying context of the iterator function.
-group.eachLayer(function (layer) {
- layer.bindPopup('Hello');
-});
-
-
-
-
- getLayer(<Number> id)
- Layer
- Returns the layer with the given internal ID.
-
-
-
- getLayers()
- Layer[]
- Returns an array of all the layers added to the group.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Calls setZIndex on every layer contained in this group, passing the z-index.
-
-
-
- getLayerId(<Layer> layer)
- Number
- Returns the internal ID for a layer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- GeoJSON
Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse
-GeoJSON data and display it on the map. Extends FeatureGroup.
-
-
-Usage example
-
-
-
-
-
-
-
-L.geoJSON(data, {
- style: function (feature) {
- return {color: feature.properties.color};
- }
-}).bindPopup(function (layer) {
- return layer.feature.properties.description;
-}).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.geoJSON(<Object> geojson?, <GeoJSON options> options?)
- Creates a GeoJSON layer. Optionally accepts an object in
-GeoJSON format to display on the map
-(you can alternatively add it later with addData method) and an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pointToLayer
- Function
- *
- A Function defining how GeoJSON points spawn Leaflet layers. It is internally
-called when data is added, passing the GeoJSON point feature and its LatLng.
-The default is to spawn a default Marker:
-function(geoJsonPoint, latlng) {
- return L.marker(latlng);
-}
-
-
-
- style
- Function
- *
- A Function defining the Path options for styling GeoJSON lines and polygons,
-called internally when data is added.
-The default value is to not override any defaults:
-function (geoJsonFeature) {
- return {}
-}
-
-
-
- onEachFeature
- Function
- *
- A Function that will be called once for each created Feature, after it has
-been created and styled. Useful for attaching events and popups to features.
-The default is to do nothing with the newly created layers:
-function (feature, layer) {}
-
-
-
- filter
- Function
- *
- A Function that will be used to decide whether to include a feature or not.
-The default is to include all features:
-function (geoJsonFeature) {
- return true;
-}
-
-Note: dynamically changing the filter option will have effect only on newly
-added data. It will not re-evaluate already included features.
-
-
- coordsToLatLng
- Function
- *
- A Function that will be used for converting GeoJSON coordinates to LatLngs.
-The default is the coordsToLatLng static method.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- layeradd
- LayerEvent
- Fired when a layer is added to this FeatureGroup
-
-
- layerremove
- LayerEvent
- Fired when a layer is removed from this FeatureGroup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addData(data)
- this
- Adds a GeoJSON object to the layer.
-
-
-
- resetStyle(layer)
- this
- Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
-
-
-
- setStyle(style)
- this
- Changes styles of GeoJSON vector layers with the given style function.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the layer group to the top of all other layers
-
-
-
- bringToBack()
- this
- Brings the layer group to the back of all other layers
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the group.
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the group.
-
-
-
- removeLayer(<Number> id)
- this
- Removes the layer with the given internal ID from the group.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the group.
-
-
-
- hasLayer(<Number> id)
- Boolean
- Returns true if the given internal ID is currently added to the group.
-
-
-
- clearLayers()
- this
- Removes all the layers from the group.
-
-
-
- invoke(<String> methodName, …)
- this
- Calls methodName on every layer contained in this group, passing any
-additional parameters. Has no effect if the layers contained do not
-implement methodName.
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the group, optionally specifying context of the iterator function.
-group.eachLayer(function (layer) {
- layer.bindPopup('Hello');
-});
-
-
-
-
- getLayer(<Number> id)
- Layer
- Returns the layer with the given internal ID.
-
-
-
- getLayers()
- Layer[]
- Returns an array of all the layers added to the group.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Calls setZIndex on every layer contained in this group, passing the z-index.
-
-
-
- getLayerId(<Layer> layer)
- Number
- Returns the internal ID for a layer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-There are several static functions which can be called without instantiating L.GeoJSON:
-
-
-
- Function
- Returns
- Description
-
-
-
- geometryToLayer(<Object> featureData, <GeoJSON options> options?)
- Layer
- Creates a Layer from a given GeoJSON feature. Can use a custom
-pointToLayer and/or coordsToLatLng
-functions if provided as options.
-
-
- coordsToLatLng(<Array> coords)
- LatLng
- Creates a LatLng object from an array of 2 numbers (longitude, latitude)
-or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
-
-
- coordsToLatLngs(<Array> coords, <Number> levelsDeep?, <Function> coordsToLatLng?)
- Array
- Creates a multidimensional array of LatLngs from a GeoJSON coordinates array.
-levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).
-Can use a custom coordsToLatLng function.
-
-
- latLngToCoords(<LatLng> latlng, <Number> precision?)
- Array
- Reverse of coordsToLatLng
-
-
- latLngsToCoords(<Array> latlngs, <Number> levelsDeep?, <Boolean> closed?)
- Array
- Reverse of coordsToLatLngs
-closed determines whether the first point should be appended to the end of the array to close the feature, only used when levelsDeep is 0. False by default.
-
-
- asFeature(<Object> geojson)
- Object
- Normalize GeoJSON geometries/features into GeoJSON features.
-
-
-
-
-
-
- GridLayer
Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces TileLayer.Canvas.
-GridLayer can be extended to create a tiled grid of HTML elements like <canvas>, <img> or <div>. GridLayer will handle creating and animating these DOM elements for you.
-
-
-Usage example
-
-
-
-Synchronous usage
-
-
-
-To create a custom layer, extend GridLayer and implement the createTile() method, which will be passed a Point object with the x, y, and z (zoom level) coordinates to draw your tile.
-var CanvasLayer = L.GridLayer.extend({
- createTile: function(coords){
- // create a <canvas> element for drawing
- var tile = L.DomUtil.create('canvas', 'leaflet-tile');
- // setup tile width and height according to the options
- var size = this.getTileSize();
- tile.width = size.x;
- tile.height = size.y;
- // get a canvas context and draw something on it using coords.x, coords.y and coords.z
- var ctx = tile.getContext('2d');
- // return the tile so it can be rendered on screen
- return tile;
- }
-});
-
-
-
-
-
-
-Asynchronous usage
-
-
-
-Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the done() callback.
-var CanvasLayer = L.GridLayer.extend({
- createTile: function(coords, done){
- var error;
- // create a <canvas> element for drawing
- var tile = L.DomUtil.create('canvas', 'leaflet-tile');
- // setup tile width and height according to the options
- var size = this.getTileSize();
- tile.width = size.x;
- tile.height = size.y;
- // draw something asynchronously and pass the tile to the done() callback
- setTimeout(function() {
- done(error, tile);
- }, 1000);
- return tile;
- }
-});
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.gridLayer(<GridLayer options> options?)
- Creates a new instance of GridLayer with the supplied options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tileSize
- Number|Point
- 256
- Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
-
-
- opacity
- Number
- 1.0
- Opacity of the tiles. Can be used in the createTile() function.
-
-
- updateWhenIdle
- Boolean
- (depends)
- Load new tiles only when panning ends.
-true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-false otherwise in order to display new tiles during panning, since it is easy to pan outside the
-keepBuffer option in desktop browsers.
-
-
- updateWhenZooming
- Boolean
- true
- By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
-
-
- updateInterval
- Number
- 200
- Tiles will not update more than once every updateInterval milliseconds when panning.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- bounds
- LatLngBounds
- undefined
- If set, tiles will only be loaded inside the set LatLngBounds.
-
-
- minZoom
- Number
- 0
- The minimum zoom level down to which this layer will be displayed (inclusive).
-
-
- maxZoom
- Number
- undefined
- The maximum zoom level up to which this layer will be displayed (inclusive).
-
-
- maxNativeZoom
- Number
- undefined
- Maximum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels higher than maxNativeZoom will be loaded
-from maxNativeZoom level and auto-scaled.
-
-
- minNativeZoom
- Number
- undefined
- Minimum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels lower than minNativeZoom will be loaded
-from minNativeZoom level and auto-scaled.
-
-
- noWrap
- Boolean
- false
- Whether the layer is wrapped around the antimeridian. If true, the
-GridLayer will only be displayed once at low zoom levels. Has no
-effect when the map CRS doesn't wrap around. Can be used
-in combination with bounds to prevent requesting
-tiles outside the CRS limits.
-
-
- pane
- String
- 'tilePane'
- Map pane where the grid layer will be added.
-
-
- className
- String
- ''
- A custom class name to assign to the tile layer. Empty by default.
-
-
- keepBuffer
- Number
- 2
- When panning the map, keep this many rows and columns of tiles before unloading them.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- loading
- Event
- Fired when the grid layer starts loading tiles.
-
-
- tileunload
- TileEvent
- Fired when a tile is removed (e.g. when a tile goes off the screen).
-
-
- tileloadstart
- TileEvent
- Fired when a tile is requested and starts loading.
-
-
- tileerror
- TileErrorEvent
- Fired when there is an error loading a tile.
-
-
- tileload
- TileEvent
- Fired when a tile loads.
-
-
- load
- Event
- Fired when the grid layer loaded all visible tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the tile layer to the top of all tile layers.
-
-
-
- bringToBack()
- this
- Brings the tile layer to the bottom of all tile layers.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the tiles for this layer.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the grid layer.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Changes the zIndex of the grid layer.
-
-
-
- isLoading()
- Boolean
- Returns true if any tile in the grid layer has not finished loading.
-
-
-
- redraw()
- this
- Causes the layer to clear all the tiles and request them again.
-
-
-
- getTileSize()
- Point
- Normalizes the tileSize option into a point. Used by the createTile() method.
-
-
-
-
-
-
-Extension methods
-
-Layers extending GridLayer shall reimplement the following method.
-
-
-
- Method
- Returns
- Description
-
-
-
- createTile(<Object> coords, <Function> done?)
- HTMLElement
- Called only internally, must be overridden by classes extending GridLayer.
-Returns the HTMLElement corresponding to the given coords. If the done callback
-is specified, it must be called when the tile has finished loading and drawing.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- LatLng
Represents a geographical point with a certain latitude and longitude.
-
-
-Usage example
-
-
-
-
-
-
-
-var latlng = L.latLng(50.5, 30.5);
-
All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:
-map.panTo([50, 30]);
-map.panTo({lon: 30, lat: 50});
-map.panTo({lat: 50, lng: 30});
-map.panTo(L.latLng(50, 30));
-
Note that LatLng does not inherit from Leafet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.latLng(<Number> latitude, <Number> longitude, <Number> altitude?)
- Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).
-
-
- L.latLng(<Array> coords)
- Expects an array of the form [Number, Number] or [Number, Number, Number] instead.
-
-
- L.latLng(<Object> coords)
- Expects an plain object of the form {lat: Number, lng: Number} or {lat: Number, lng: Number, alt: Number} instead.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- equals(<LatLng> otherLatLng, <Number> maxMargin?)
- Boolean
- Returns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overridden by setting maxMargin to a small number.
-
-
-
- toString()
- String
- Returns a string representation of the point (for debugging purposes).
-
-
-
- distanceTo(<LatLng> otherLatLng)
- Number
- Returns the distance (in meters) to the given LatLng calculated using the Spherical Law of Cosines.
-
-
-
- wrap()
- LatLng
- Returns a new LatLng object with the longitude wrapped so it's always between -180 and +180 degrees.
-
-
-
- toBounds(<Number> sizeInMeters)
- LatLngBounds
- Returns a new LatLngBounds object in which each boundary is sizeInMeters/2 meters apart from the LatLng.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- lat
- Number
- Latitude in degrees
-
-
- lng
- Number
- Longitude in degrees
-
-
- alt
- Number
- Altitude in meters (optional)
-
-
-
-
-
-
- LatLngBounds
Represents a rectangular geographical area on a map.
-
-
-Usage example
-
-
-
-
-
-
-
-var corner1 = L.latLng(40.712, -74.227),
-corner2 = L.latLng(40.774, -74.125),
-bounds = L.latLngBounds(corner1, corner2);
-
-All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-map.fitBounds([
- [40.712, -74.227],
- [40.774, -74.125]
-]);
-
-Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners outside the [-180, 180] degrees longitude range.
-Note that LatLngBounds does not inherit from Leafet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.latLngBounds(<LatLng> corner1, <LatLng> corner2)
- Creates a LatLngBounds object by defining two diagonally opposite corners of the rectangle.
-
-
- L.latLngBounds(<LatLng[]> latlngs)
- Creates a LatLngBounds object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with fitBounds.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- extend(<LatLng> latlng)
- this
- Extend the bounds to contain the given point
-
-
-
- extend(<LatLngBounds> otherBounds)
- this
- Extend the bounds to contain the given bounds
-
-
-
- pad(<Number> bufferRatio)
- LatLngBounds
- Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
-For example, a ratio of 0.5 extends the bounds by 50% in each direction.
-Negative values will retract the bounds.
-
-
-
- getCenter()
- LatLng
- Returns the center point of the bounds.
-
-
-
- getSouthWest()
- LatLng
- Returns the south-west point of the bounds.
-
-
-
- getNorthEast()
- LatLng
- Returns the north-east point of the bounds.
-
-
-
- getNorthWest()
- LatLng
- Returns the north-west point of the bounds.
-
-
-
- getSouthEast()
- LatLng
- Returns the south-east point of the bounds.
-
-
-
- getWest()
- Number
- Returns the west longitude of the bounds
-
-
-
- getSouth()
- Number
- Returns the south latitude of the bounds
-
-
-
- getEast()
- Number
- Returns the east longitude of the bounds
-
-
-
- getNorth()
- Number
- Returns the north latitude of the bounds
-
-
-
- contains(<LatLngBounds> otherBounds)
- Boolean
- Returns true if the rectangle contains the given one.
-
-
-
- contains(<LatLng> latlng)
- Boolean
- Returns true if the rectangle contains the given point.
-
-
-
- intersects(<LatLngBounds> otherBounds)
- Boolean
- Returns true if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
-
-
-
- overlaps(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
-
-
-
- toBBoxString()
- String
- Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
-
-
-
- equals(<LatLngBounds> otherBounds, <Number> maxMargin?)
- Boolean
- Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting maxMargin to a small number.
-
-
-
- isValid()
- Boolean
- Returns true if the bounds are properly initialized.
-
-
-
-
-
-
-
- Point
Represents a point with x and y coordinates in pixels.
-
-
-Usage example
-
-
-
-
-
-
-
-var point = L.point(200, 300);
-
-All Leaflet methods and options that accept Point objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:
-map.panBy([200, 300]);
-map.panBy(L.point(200, 300));
-
-Note that Point does not inherit from Leafet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.point(<Number> x, <Number> y, <Boolean> round?)
- Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values.
-
-
- L.point(<Number[]> coords)
- Expects an array of the form [x, y] instead.
-
-
- L.point(<Object> coords)
- Expects a plain object of the form {x: Number, y: Number} instead.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- clone()
- Point
- Returns a copy of the current point.
-
-
-
- add(<Point> otherPoint)
- Point
- Returns the result of addition of the current and the given points.
-
-
-
- subtract(<Point> otherPoint)
- Point
- Returns the result of subtraction of the given point from the current.
-
-
-
- divideBy(<Number> num)
- Point
- Returns the result of division of the current point by the given number.
-
-
-
- multiplyBy(<Number> num)
- Point
- Returns the result of multiplication of the current point by the given number.
-
-
-
- scaleBy(<Point> scale)
- Point
- Multiply each coordinate of the current point by each coordinate of
-scale. In linear algebra terms, multiply the point by the
-scaling matrix
-defined by scale.
-
-
-
- unscaleBy(<Point> scale)
- Point
- Inverse of scaleBy. Divide each coordinate of the current point by
-each coordinate of scale.
-
-
-
- round()
- Point
- Returns a copy of the current point with rounded coordinates.
-
-
-
- floor()
- Point
- Returns a copy of the current point with floored coordinates (rounded down).
-
-
-
- ceil()
- Point
- Returns a copy of the current point with ceiled coordinates (rounded up).
-
-
-
- trunc()
- Point
- Returns a copy of the current point with truncated coordinates (rounded towards zero).
-
-
-
- distanceTo(<Point> otherPoint)
- Number
- Returns the cartesian distance between the current and the given points.
-
-
-
- equals(<Point> otherPoint)
- Boolean
- Returns true if the given point has the same coordinates.
-
-
-
- contains(<Point> otherPoint)
- Boolean
- Returns true if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
-
-
-
- toString()
- String
- Returns a string representation of the point for debugging purposes.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- x
- Number
- The x coordinate of the point
-
-
- y
- Number
- The y coordinate of the point
-
-
-
-
-
-
- Bounds
Represents a rectangular area in pixel coordinates.
-
-
-Usage example
-
-
-
-
-
-
-
-var p1 = L.point(10, 10),
-p2 = L.point(40, 60),
-bounds = L.bounds(p1, p2);
-
-All Leaflet methods that accept Bounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-otherBounds.intersects([[10, 10], [40, 60]]);
-
-Note that Bounds does not inherit from Leafet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.bounds(<Point> corner1, <Point> corner2)
- Creates a Bounds object from two corners coordinate pairs.
-
-
- L.bounds(<Point[]> points)
- Creates a Bounds object from the given array of points.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- extend(<Point> point)
- this
- Extends the bounds to contain the given point.
-
-
-
- getCenter(<Boolean> round?)
- Point
- Returns the center point of the bounds.
-
-
-
- getBottomLeft()
- Point
- Returns the bottom-left point of the bounds.
-
-
-
- getTopRight()
- Point
- Returns the top-right point of the bounds.
-
-
-
- getTopLeft()
- Point
- Returns the top-left point of the bounds (i.e. this.min).
-
-
-
- getBottomRight()
- Point
- Returns the bottom-right point of the bounds (i.e. this.max).
-
-
-
- getSize()
- Point
- Returns the size of the given bounds
-
-
-
- contains(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle contains the given one.
-
-
-
- contains(<Point> point)
- Boolean
- Returns true if the rectangle contains the given point.
-
-
-
- intersects(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle intersects the given bounds. Two bounds
-intersect if they have at least one point in common.
-
-
-
- overlaps(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle overlaps the given bounds. Two bounds
-overlap if their intersection is an area.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- min
- Point
- The top left corner of the rectangle.
-
-
- max
- Point
- The bottom right corner of the rectangle.
-
-
-
-
-
-
- Icon
Represents an icon to provide when creating a marker.
-
-
-Usage example
-
-
-
-
-
-
-
-var myIcon = L.icon({
- iconUrl: 'my-icon.png',
- iconSize: [38, 95],
- iconAnchor: [22, 94],
- popupAnchor: [-3, -76],
- shadowUrl: 'my-icon-shadow.png',
- shadowSize: [68, 95],
- shadowAnchor: [22, 94]
-});
-L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-
-L.Icon.Default extends L.Icon and is the blue icon Leaflet uses for markers by default.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.icon(<Icon options> options)
- Creates an icon instance with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- iconUrl
- String
- null
- (required) The URL to the icon image (absolute or relative to your script path).
-
-
- iconRetinaUrl
- String
- null
- The URL to a retina sized version of the icon image (absolute or relative to your
-script path). Used for Retina screen devices.
-
-
- iconSize
- Point
- null
- Size of the icon image in pixels.
-
-
- iconAnchor
- Point
- null
- The coordinates of the "tip" of the icon (relative to its top left corner). The icon
-will be aligned so that this point is at the marker's geographical location. Centered
-by default if size is specified, also can be set in CSS with negative margins.
-
-
- popupAnchor
- Point
- [0, 0]
- The coordinates of the point from which popups will "open", relative to the icon anchor.
-
-
- tooltipAnchor
- Point
- [0, 0]
- The coordinates of the point from which tooltips will "open", relative to the icon anchor.
-
-
- shadowUrl
- String
- null
- The URL to the icon shadow image. If not specified, no shadow image will be created.
-
-
- shadowRetinaUrl
- String
- null
-
-
-
- shadowSize
- Point
- null
- Size of the shadow image in pixels.
-
-
- shadowAnchor
- Point
- null
- The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
-as iconAnchor if not specified).
-
-
- className
- String
- ''
- A custom class name to assign to both icon and shadow images. Empty by default.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- createIcon(<HTMLElement> oldIcon?)
- HTMLElement
- Called internally when the icon has to be shown, returns a <img> HTML element
-styled according to the options.
-
-
-
- createShadow(<HTMLElement> oldIcon?)
- HTMLElement
- As createIcon, but for the shadow beneath it.
-
-
-
-
-
-
-
-
-
-
-Icon.Default
-
-
-
-
-
-A trivial subclass of Icon, represents the icon to use in Markers when
-no icon is specified. Points to the blue marker image distributed with Leaflet
-releases.
-In order to customize the default icon, just change the properties of L.Icon.Default.prototype.options
-(which is a set of Icon options).
-If you want to completely replace the default icon, override the
-L.Marker.prototype.options.icon with your own icon instead.
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- imagePath
- String
-
- Icon.Default will try to auto-detect the location of the
-blue icon images. If you are placing these images in a non-standard
-way, set this option to point to the right path.
-
-
-
-
-
-
- DivIcon
Represents a lightweight icon for markers that uses a simple <div>
-element instead of an image. Inherits from Icon but ignores the iconUrl and shadow options.
-
-
-Usage example
-
-
-
-
-
-
-
-var myIcon = L.divIcon({className: 'my-div-icon'});
-// you can set .my-div-icon styles in CSS
-L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-
-By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.divIcon(<DivIcon options> options)
- Creates a DivIcon instance with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- html
- String
- ''
- Custom HTML code to put inside the div element, empty by default.
-
-
- bgPos
- Point
- [0, 0]
- Optional relative position of the background, in pixels
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- iconUrl
- String
- null
- (required) The URL to the icon image (absolute or relative to your script path).
-
-
- iconRetinaUrl
- String
- null
- The URL to a retina sized version of the icon image (absolute or relative to your
-script path). Used for Retina screen devices.
-
-
- iconSize
- Point
- null
- Size of the icon image in pixels.
-
-
- iconAnchor
- Point
- null
- The coordinates of the "tip" of the icon (relative to its top left corner). The icon
-will be aligned so that this point is at the marker's geographical location. Centered
-by default if size is specified, also can be set in CSS with negative margins.
-
-
- popupAnchor
- Point
- [0, 0]
- The coordinates of the point from which popups will "open", relative to the icon anchor.
-
-
- tooltipAnchor
- Point
- [0, 0]
- The coordinates of the point from which tooltips will "open", relative to the icon anchor.
-
-
- shadowUrl
- String
- null
- The URL to the icon shadow image. If not specified, no shadow image will be created.
-
-
- shadowRetinaUrl
- String
- null
-
-
-
- shadowSize
- Point
- null
- Size of the shadow image in pixels.
-
-
- shadowAnchor
- Point
- null
- The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
-as iconAnchor if not specified).
-
-
- className
- String
- ''
- A custom class name to assign to both icon and shadow images. Empty by default.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- createIcon(<HTMLElement> oldIcon?)
- HTMLElement
- Called internally when the icon has to be shown, returns a <img> HTML element
-styled according to the options.
-
-
-
- createShadow(<HTMLElement> oldIcon?)
- HTMLElement
- As createIcon, but for the shadow beneath it.
-
-
-
-
-
-
-
-
- Control.Zoom
A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its zoomControl option to false. Extends Control.
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.zoom(<Control.Zoom options> options)
- Creates a zoom control
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- zoomInText
- String
- '+'
- The text set on the 'zoom in' button.
-
-
- zoomInTitle
- String
- 'Zoom in'
- The title set on the 'zoom in' button.
-
-
- zoomOutText
- String
- '−
- '
-The text set on the 'zoom out' button.
-
-
- zoomOutTitle
- String
- 'Zoom out'
- The title set on the 'zoom out' button.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Control.Attribution
The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its attributionControl option to false, and it fetches attribution texts from layers with the getAttribution method automatically. Extends Control.
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.attribution(<Control.Attribution options> options)
- Creates an attribution control.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- prefix
- String
- 'Leaflet'
- The HTML text shown before the attributions. Pass false to disable.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setPrefix(<String> prefix)
- this
- Sets the text before the attributions.
-
-
-
- addAttribution(<String> text)
- this
- Adds an attribution text (e.g. 'Vector data © Mapbox').
-
-
-
- removeAttribution(<String> text)
- this
- Removes an attribution text.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Control.Layers
The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the detailed example). Extends Control.
-
-
-Usage example
-
-
-
-
-
-
-
-var baseLayers = {
- "Mapbox": mapbox,
- "OpenStreetMap": osm
-};
-var overlays = {
- "Marker": marker,
- "Roads": roadsLayer
-};
-L.control.layers(baseLayers, overlays).addTo(map);
-
-The baseLayers and overlays parameters are object literals with layer names as keys and Layer objects as values:
-{
- "<someName1>": layer1,
- "<someName2>": layer2
-}
-
-The layer names can contain HTML, which allows you to add additional styling to the items:
-{"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.layers(<Object> baselayers?, <Object> overlays?, <Control.Layers options> options?)
- Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- collapsed
- Boolean
- true
- If true, the control will be collapsed into an icon and expanded on mouse hover or touch.
-
-
- autoZIndex
- Boolean
- true
- If true, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
-
-
- hideSingleBase
- Boolean
- false
- If true, the base layers in the control will be hidden when there is only one.
-
-
- sortLayers
- Boolean
- false
- Whether to sort the layers. When false, layers will keep the order
-in which they were added to the control.
-
-
- sortFunction
- Function
- *
- A compare function
-that will be used for sorting the layers, when sortLayers is true.
-The function receives both the L.Layer instances and their names, as in
-sortFunction(layerA, layerB, nameA, nameB).
-By default, it sorts layers alphabetically by their name.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addBaseLayer(<Layer> layer, <String> name)
- this
- Adds a base layer (radio button entry) with the given name to the control.
-
-
-
- addOverlay(<Layer> layer, <String> name)
- this
- Adds an overlay (checkbox entry) with the given name to the control.
-
-
-
- removeLayer(<Layer> layer)
- this
- Remove the given layer from the control.
-
-
-
- expand()
- this
- Expand the control container if collapsed.
-
-
-
- collapse()
- this
- Collapse the control container if expanded.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Control.Scale
A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends Control.
-
-
-Usage example
-
-
-
-
-
-
-
-L.control.scale().addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.scale(<Control.Scale options> options?)
- Creates an scale control with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- maxWidth
- Number
- 100
- Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
-
-
- metric
- Boolean
- True
- Whether to show the metric scale line (m/km).
-
-
- imperial
- Boolean
- True
- Whether to show the imperial scale line (mi/ft).
-
-
- updateWhenIdle
- Boolean
- false
- If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Browser
A namespace with static properties for browser/feature detection used by Leaflet internally.
-
-
-Usage example
-
-
-
-
-
-
-
-if (L.Browser.ielt9) {
- alert('Upgrade your browser, dude!');
-}
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- ie
- Boolean
- true for all Internet Explorer versions (not Edge).
-
-
- ielt9
- Boolean
- true for Internet Explorer versions less than 9.
-
-
- edge
- Boolean
- true for the Edge web browser.
-
-
- webkit
- Boolean
- true for webkit-based browsers like Chrome and Safari (including mobile versions).
-
-
- android
- Boolean
- true for any browser running on an Android platform.
-
-
- android23
- Boolean
- true for browsers running on Android 2 or Android 3.
-
-
- androidStock
- Boolean
- true for the Android stock browser (i.e. not Chrome)
-
-
- opera
- Boolean
- true for the Opera browser
-
-
- chrome
- Boolean
- true for the Chrome browser.
-
-
- gecko
- Boolean
- true for gecko-based browsers like Firefox.
-
-
- safari
- Boolean
- true for the Safari browser.
-
-
- opera12
- Boolean
- true for the Opera browser supporting CSS transforms (version 12 or later).
-
-
- win
- Boolean
- true when the browser is running in a Windows platform
-
-
- ie3d
- Boolean
- true for all Internet Explorer versions supporting CSS transforms.
-
-
- webkit3d
- Boolean
- true for webkit-based browsers supporting CSS transforms.
-
-
- gecko3d
- Boolean
- true for gecko-based browsers supporting CSS transforms.
-
-
- any3d
- Boolean
- true for all browsers supporting CSS transforms.
-
-
- mobile
- Boolean
- true for all browsers running in a mobile device.
-
-
- mobileWebkit
- Boolean
- true for all webkit-based browsers in a mobile device.
-
-
- mobileWebkit3d
- Boolean
- true for all webkit-based browsers in a mobile device supporting CSS transforms.
-
-
- msPointer
- Boolean
- true for browsers implementing the Microsoft touch events model (notably IE10).
-
-
- pointer
- Boolean
- true for all browsers supporting pointer events.
-
-
- touch
- Boolean
- true for all browsers supporting touch events.
-This does not necessarily mean that the browser is running in a computer with
-a touchscreen, it only means that the browser is capable of understanding
-touch events.
-
-
- mobileOpera
- Boolean
- true for the Opera browser in a mobile device.
-
-
- mobileGecko
- Boolean
- true for gecko-based browsers running in a mobile device.
-
-
- retina
- Boolean
- true for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
-
-
- canvas
- Boolean
- true when the browser supports <canvas>.
-
-
- svg
- Boolean
- true when the browser supports SVG.
-
-
- vml
- Boolean
- true if the browser supports VML.
-
-
-
-
-
-
- Util
Various utility functions, used by Leaflet internally.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- extend(<Object> dest, <Object> src?)
- Object
- Merges the properties of the src object (or multiple objects) into dest object and returns the latter. Has an L.extend shortcut.
-
-
- create(<Object> proto, <Object> properties?)
- Object
- Compatibility polyfill for Object.create
-
-
- bind(<Function> fn, …)
- Function
- Returns a new function bound to the arguments passed, like Function.prototype.bind.
-Has a L.bind() shortcut.
-
-
- stamp(<Object> obj)
- Number
- Returns the unique ID of an object, assigning it one if it doesn't have it.
-
-
- throttle(<Function> fn, <Number> time, <Object> context)
- Function
- Returns a function which executes function fn with the given scope context
-(so that the this keyword refers to context inside fn's code). The function
-fn will be called no more than one time per given amount of time. The arguments
-received by the bound function will be any arguments passed when binding the
-function, followed by any arguments passed when invoking the bound function.
-Has an L.throttle shortcut.
-
-
- wrapNum(<Number> num, <Number[]> range, <Boolean> includeMax?)
- Number
- Returns the number num modulo range in such a way so it lies within
-range[0] and range[1]. The returned value will be always smaller than
-range[1] unless includeMax is set to true.
-
-
- falseFn()
- Function
- Returns a function which always returns false.
-
-
- formatNum(<Number> num, <Number> digits?)
- Number
- Returns the number num rounded to digits decimals, or to 6 decimals by default.
-
-
- trim(<String> str)
- String
- Compatibility polyfill for String.prototype.trim
-
-
- splitWords(<String> str)
- String[]
- Trims and splits the string on whitespace and returns the array of parts.
-
-
- setOptions(<Object> obj, <Object> options)
- Object
- Merges the given properties to the options of the obj object, returning the resulting options. See Class options. Has an L.setOptions shortcut.
-
-
- getParamString(<Object> obj, <String> existingUrl?, <Boolean> uppercase?)
- String
- Converts an object into a parameter URL string, e.g. {a: "foo", b: "bar"}
-translates to '?a=foo&b=bar'. If existingUrl is set, the parameters will
-be appended at the end. If uppercase is true, the parameter names will
-be uppercased (e.g. '?A=foo&B=bar')
-
-
- template(<String> str, <Object> data)
- String
- Simple templating facility, accepts a template string of the form 'Hello {a}, {b}'
-and a data object like {a: 'foo', b: 'bar'}, returns evaluated string
-('Hello foo, bar'). You can also specify functions instead of strings for
-data values — they will be evaluated passing data as an argument.
-
-
- isArray(obj)
- Boolean
- Compatibility polyfill for Array.isArray
-
-
- indexOf(<Array> array, <Object> el)
- Number
- Compatibility polyfill for Array.prototype.indexOf
-
-
- requestAnimFrame(<Function> fn, <Object> context?, <Boolean> immediate?)
- Number
- Schedules fn to be executed when the browser repaints. fn is bound to
-context if given. When immediate is set, fn is called immediately if
-the browser doesn't have native support for
-window.requestAnimationFrame,
-otherwise it's delayed. Returns a request ID that can be used to cancel the request.
-
-
- cancelAnimFrame(<Number> id)
- undefined
- Cancels a previous requestAnimFrame. See also window.cancelAnimationFrame.
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- lastId
- Number
- Last unique ID used by stamp()
-
-
- emptyImageUrl
- String
- Data URI string containing a base64-encoded empty GIF image.
-Used as a hack to free memory from unused images on WebKit-powered
-mobile devices (by setting image src to this string).
-
-
-
-
-
-
- Transformation
Represents an affine transformation: a set of coefficients a, b, c, d
-for transforming a point of a form (x, y) into (a*x + b, c*y + d) and doing
-the reverse. Used by Leaflet in its projections code.
-
-
-Usage example
-
-
-
-
-
-
-
-var transformation = L.transformation(2, 5, -1, 10),
- p = L.point(1, 2),
- p2 = transformation.transform(p), // L.point(7, 8)
- p3 = transformation.untransform(p2); // L.point(1, 2)
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.transformation(<Number> a, <Number> b, <Number> c, <Number> d)
- Instantiates a Transformation object with the given coefficients.
-
-
- L.transformation(<Array> coefficients)
- Expects an coefficients array of the form
-[a: Number, b: Number, c: Number, d: Number].
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- transform(<Point> point, <Number> scale?)
- Point
- Returns a transformed point, optionally multiplied by the given scale.
-Only accepts actual L.Point instances, not arrays.
-
-
-
- untransform(<Point> point, <Number> scale?)
- Point
- Returns the reverse transformation of the given point, optionally divided
-by the given scale. Only accepts actual L.Point instances, not arrays.
-
-
-
-
-
-
-
- LineUtil
Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- simplify(<Point[]> points, <Number> tolerance)
- Point[]
- Dramatically reduces the number of points in a polyline while retaining
-its shape and returns a new array of simplified points, using the
-Douglas-Peucker algorithm.
-Used for a huge performance boost when processing/displaying Leaflet polylines for
-each zoom level and also reducing visual noise. tolerance affects the amount of
-simplification (lesser value means higher quality but slower and with more points).
-Also released as a separated micro-library Simplify.js.
-
-
- pointToSegmentDistance(<Point> p, <Point> p1, <Point> p2)
- Number
- Returns the distance between point p and segment p1 to p2.
-
-
- closestPointOnSegment(<Point> p, <Point> p1, <Point> p2)
- Number
- Returns the closest point from a point p on a segment p1 to p2.
-
-
- clipSegment(<Point> a, <Point> b, <Bounds> bounds, <Boolean> useLastCode?, <Boolean> round?)
- Point[]|Boolean
- Clips the segment a to b by rectangular bounds with the
-Cohen-Sutherland algorithm
-(modifying the segment points directly!). Used by Leaflet to only show polyline
-points that are on the screen or near, increasing performance.
-
-
- isFlat(<LatLng[]> latlngs)
- Boolean
- Returns true if latlngs is a flat array, false is nested.
-
-
-
-
-
-
- PolyUtil
Various utility functions for polygon geometries.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- clipPolygon(<Point[]> points, <Bounds> bounds, <Boolean> round?)
- Point[]
- Clips the polygon geometry defined by the given points by the given bounds (using the Sutherland-Hodgman algorithm).
-Used by Leaflet to only show polygon points that are on the screen or near, increasing
-performance. Note that polygon points needs different algorithm for clipping
-than polyline, so there's a separate method for it.
-
-
-
-
-
-
- DomEvent
Utility functions to work with the DOM events, used by Leaflet internally.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- on(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular DOM event type of the
-element el. You can optionally specify the context of the listener
-(object the this keyword will point to). You can also pass several
-space-separated types (e.g. 'click dblclick').
-
-
- on(<HTMLElement> el, <Object> eventMap, <Object> context?)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
- off(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
- this
- Removes a previously added listener function.
-Note that if you passed a custom context to on, you must pass the same
-context to off in order to remove the listener.
-
-
- off(<HTMLElement> el, <Object> eventMap, <Object> context?)
- this
- Removes a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
- stopPropagation(<DOMEvent> ev)
- this
- Stop the given event from propagation to parent elements. Used inside the listener functions:
-L.DomEvent.on(div, 'click', function (ev) {
- L.DomEvent.stopPropagation(ev);
-});
-
-
-
- disableScrollPropagation(<HTMLElement> el)
- this
- Adds stopPropagation to the element's 'mousewheel' events (plus browser variants).
-
-
- disableClickPropagation(<HTMLElement> el)
- this
- Adds stopPropagation to the element's 'click', 'doubleclick',
-'mousedown' and 'touchstart' events (plus browser variants).
-
-
- preventDefault(<DOMEvent> ev)
- this
- Prevents the default action of the DOM Event ev from happening (such as
-following a link in the href of the a element, or doing a POST request
-with page reload when a <form> is submitted).
-Use it inside listener functions.
-
-
- stop(<DOMEvent> ev)
- this
- Does stopPropagation and preventDefault at the same time.
-
-
- getMousePosition(<DOMEvent> ev, <HTMLElement> container?)
- Point
- Gets normalized mouse position from a DOM event relative to the
-container or to the whole page if not specified.
-
-
- getWheelDelta(<DOMEvent> ev)
- Number
- Gets normalized wheel delta from a mousewheel DOM event, in vertical
-pixels scrolled (negative if scrolling down).
-Events from pointing devices without precise scrolling are mapped to
-a best guess of 60 pixels.
-
-
- addListener(…)
- this
- Alias to L.DomEvent.on
-
-
- removeListener(…)
- this
- Alias to L.DomEvent.off
-
-
-
-
-
-
- DomUtil
Utility functions to work with the DOM
-tree, used by Leaflet internally.
-Most functions expecting or returning a HTMLElement also work for
-SVG elements. The only difference is that classes refer to CSS classes
-in HTML and SVG classes in SVG.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- get(<String|HTMLElement> id)
- HTMLElement
- Returns an element given its DOM id, or returns the element itself
-if it was passed directly.
-
-
- getStyle(<HTMLElement> el, <String> styleAttrib)
- String
- Returns the value for a certain style attribute on an element,
-including computed values or values set through CSS.
-
-
- create(<String> tagName, <String> className?, <HTMLElement> container?)
- HTMLElement
- Creates an HTML element with tagName, sets its class to className, and optionally appends it to container element.
-
-
- remove(<HTMLElement> el)
-
- Removes el from its parent element
-
-
- empty(<HTMLElement> el)
-
- Removes all of el's children elements from el
-
-
- toFront(<HTMLElement> el)
-
- Makes el the last child of its parent, so it renders in front of the other children.
-
-
- toBack(<HTMLElement> el)
-
- Makes el the first child of its parent, so it renders behind the other children.
-
-
- hasClass(<HTMLElement> el, <String> name)
- Boolean
- Returns true if the element's class attribute contains name.
-
-
- addClass(<HTMLElement> el, <String> name)
-
- Adds name to the element's class attribute.
-
-
- removeClass(<HTMLElement> el, <String> name)
-
- Removes name from the element's class attribute.
-
-
- setClass(<HTMLElement> el, <String> name)
-
- Sets the element's class.
-
-
- getClass(<HTMLElement> el)
- String
- Returns the element's class.
-
-
- setOpacity(<HTMLElement> el, <Number> opacity)
-
- Set the opacity of an element (including old IE support).
-opacity must be a number from 0 to 1.
-
-
- testProp(<String[]> props)
- String|false
- Goes through the array of style names and returns the first name
-that is a valid style name for an element. If no such name is found,
-it returns false. Useful for vendor-prefixed styles like transform.
-
-
- setTransform(<HTMLElement> el, <Point> offset, <Number> scale?)
-
- Resets the 3D CSS transform of el so it is translated by offset pixels
-and optionally scaled by scale. Does not have an effect if the
-browser doesn't support 3D CSS transforms.
-
-
- setPosition(<HTMLElement> el, <Point> position)
-
- Sets the position of el to coordinates specified by position,
-using CSS translate or top/left positioning depending on the browser
-(used by Leaflet internally to position its layers).
-
-
- getPosition(<HTMLElement> el)
- Point
- Returns the coordinates of an element previously positioned with setPosition.
-
-
- disableTextSelection()
-
- Prevents the user from generating selectstart DOM events, usually generated
-when the user drags the mouse through a page with text. Used internally
-by Leaflet to override the behaviour of any click-and-drag interaction on
-the map. Affects drag interactions on the whole document.
-
-
- enableTextSelection()
-
- Cancels the effects of a previous L.DomUtil.disableTextSelection.
-
-
- disableImageDrag()
-
- As L.DomUtil.disableTextSelection, but
-for dragstart DOM events, usually generated when the user drags an image.
-
-
- enableImageDrag()
-
- Cancels the effects of a previous L.DomUtil.disableImageDrag.
-
-
- preventOutline(<HTMLElement> el)
-
- Makes the outline
-of the element el invisible. Used internally by Leaflet to prevent
-focusable elements from displaying an outline when the user performs a
-drag interaction on them.
-
-
- restoreOutline()
-
- Cancels the effects of a previous L.DomUtil.preventOutline.
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- TRANSFORM
- String
- Vendor-prefixed transform style name (e.g. 'webkitTransform' for WebKit).
-
-
- TRANSITION
- String
- Vendor-prefixed transition style name.
-
-
- TRANSITION_END
- String
- Vendor-prefixed transitionend event name.
-
-
-
-
-
-
- PosAnimation
Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.
-
-
-Usage example
-
-
-
-
-
-
-
-var fx = new L.PosAnimation();
-fx.run(el, [300, 500], 0.5);
-
-
-
-
-
-
-
-
-Constructor
-
-
-
-
-
-
-
-
- Constructor
- Description
-
-
-
- L.PosAnimation()
- Creates a PosAnimation object.
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- start
- Event
- Fired when the animation starts
-
-
- step
- Event
- Fired continuously during the animation.
-
-
- end
- Event
- Fired when the animation ends.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- run(<HTMLElement> el, <Point> newPos, <Number> duration?, <Number> easeLinearity?)
-
- Run an animation of a given element to a new position, optionally setting
-duration in seconds (0.25 by default) and easing linearity factor (3rd
-argument of the cubic bezier curve,
-0.5 by default).
-
-
-
- stop()
-
- Stops the animation (if currently running).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Draggable
A class for making DOM elements draggable (including touch support).
-Used internally for map and marker dragging. Only works for elements
-that were positioned with L.DomUtil.setPosition.
-
-
-Usage example
-
-
-
-
-
-
-
-var draggable = new L.Draggable(elementToDrag);
-draggable.enable();
-
-
-
-
-
-
-
-
-Constructor
-
-
-
-
-
-
-
-
- Constructor
- Description
-
-
-
- L.Draggable(<HTMLElement> el, <HTMLElement> dragHandle?, <Boolean> preventOutline?, <Draggable options> options?)
- Creates a Draggable object for moving el when you start dragging the dragHandle element (equals el itself by default).
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- clickTolerance
- Number
- 3
- The max number of pixels a user can shift the mouse pointer during a click
-for it to be considered a valid click (as opposed to a mouse drag).
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- down
- Event
- Fired when a drag is about to start.
-
-
- dragstart
- Event
- Fired when a drag starts
-
-
- predrag
- Event
- Fired continuously during dragging before each corresponding
-update of the element's position.
-
-
- drag
- Event
- Fired continuously during dragging.
-
-
- dragend
- DragEndEvent
- Fired when the drag ends.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- enable()
-
- Enables the dragging ability
-
-
-
- disable()
-
- Disables the dragging ability
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Class
L.Class powers the OOP facilities of Leaflet and is used to create almost all of the Leaflet classes documented here.
-In addition to implementing a simple classical inheritance model, it introduces several special properties for convenient code organization — options, includes and statics.
-
-
-Usage example
-
-
-
-
-
-
-
-var MyClass = L.Class.extend({
-initialize: function (greeter) {
- this.greeter = greeter;
- // class constructor
-},
-greet: function (name) {
- alert(this.greeter + ', ' + name)
- }
-});
-// create instance of MyClass, passing "Hello" to the constructor
-var a = new MyClass("Hello");
-// call greet method, alerting "Hello, World"
-a.greet("World");
-
-
-
-
-
-
-Class Factories
-
-
-
-You may have noticed that Leaflet objects are created without using
-the new keyword. This is achieved by complementing each class with a
-lowercase factory method:
-new L.Map('map'); // becomes:
-L.map('map');
-
-The factories are implemented very easily, and you can do this for your own classes:
-L.map = function (id, options) {
- return new L.Map(id, options);
-};
-
-
-
-
-
-
-Inheritance
-
-
-
-You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it:
-var MyChildClass = MyClass.extend({
- // ... new properties and methods
-});
-
-This will create a class that inherits all methods and properties of the parent class (through a proper prototype chain), adding or overriding the ones you pass to extend. It will also properly react to instanceof:
-var a = new MyChildClass();
-a instanceof MyChildClass; // true
-a instanceof MyClass; // true
-
-You can call parent methods (including constructor) from corresponding child ones (as you do with super calls in other languages) by accessing parent class prototype and using JavaScript's call or apply:
-var MyChildClass = MyClass.extend({
- initialize: function () {
- MyClass.prototype.initialize.call(this, "Yo");
- },
- greet: function (name) {
- MyClass.prototype.greet.call(this, 'bro ' + name + '!');
- }
-});
-var a = new MyChildClass();
-a.greet('Jason'); // alerts "Yo, bro Jason!"
-
-
-
-
-
-Options
-
-
-
-options is a special property that unlike other objects that you pass
-to extend will be merged with the parent one instead of overriding it
-completely, which makes managing configuration of objects and default
-values convenient:
-var MyClass = L.Class.extend({
- options: {
- myOption1: 'foo',
- myOption2: 'bar'
- }
-});
-var MyChildClass = MyClass.extend({
- options: {
- myOption1: 'baz',
- myOption3: 5
- }
-});
-var a = new MyChildClass();
-a.options.myOption1; // 'baz'
-a.options.myOption2; // 'bar'
-a.options.myOption3; // 5
-
-There's also L.Util.setOptions, a method for
-conveniently merging options passed to constructor with the defaults
-defines in the class:
-var MyClass = L.Class.extend({
- options: {
- foo: 'bar',
- bla: 5
- },
- initialize: function (options) {
- L.Util.setOptions(this, options);
- ...
- }
-});
-var a = new MyClass({bla: 10});
-a.options; // {foo: 'bar', bla: 10}
-
-Note that the options object allows any keys, not just
-the options defined by the class and its base classes.
-This means you can use the options object to store
-application specific information, as long as you avoid
-keys that are already used by the class in question.
-
-
-
-
-
-Includes
-
-
-
-includes is a special class property that merges all specified objects into the class (such objects are called mixins).
- var MyMixin = {
- foo: function () { ... },
- bar: 5
-};
-var MyClass = L.Class.extend({
- includes: MyMixin
-});
-var a = new MyClass();
-a.foo();
-
-You can also do such includes in runtime with the include method:
-MyClass.include(MyMixin);
-
-statics is just a convenience property that injects specified object properties as the static properties of the class, useful for defining constants:
-var MyClass = L.Class.extend({
- statics: {
- FOO: 'bar',
- BLA: 5
- }
-});
-MyClass.FOO; // 'bar'
-
-
-
-
-
-
-Constructor hooks
-
-
-
-If you're a plugin developer, you often need to add additional initialization code to existing classes (e.g. editing hooks for L.Polyline). Leaflet comes with a way to do it easily using the addInitHook method:
-MyClass.addInitHook(function () {
- // ... do something in constructor additionally
- // e.g. add event listeners, set custom properties etc.
-});
-
-You can also use the following shortcut when you just need to make one additional method call:
-MyClass.addInitHook('methodName', arg1, arg2, …);
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- extend(<Object> props)
- Function
- Extends the current class given the properties to be included.
-Returns a Javascript function that is a class constructor (to be called with new).
-
-
- include(<Object> properties)
- this
- Includes a mixin into the current class.
-
-
- mergeOptions(<Object> options)
- this
- Merges options into the defaults of the class.
-
-
- addInitHook(<Function> fn)
- this
- Adds a constructor hook to the class.
-
-
-
-
-
-
- Evented
A set of methods shared between event-powered classes (like Map and Marker). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire 'click' event).
-
-
-Usage example
-
-
-
-
-
-
-
-map.on('click', function(e) {
- alert(e.latlng);
-} );
-
-Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
-function onClick(e) { ... }
-map.on('click', onClick);
-map.off('click', onClick);
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
- Layer
A set of methods from the Layer base class that all Leaflet layers use.
-Inherits all methods, options and events from L.Evented.
-
-
-Usage example
-
-
-
-
-
-
-
-var layer = L.Marker(latlng).addTo(map);
-layer.addTo(map);
-layer.remove();
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- add
- Event
- Fired after the layer is added to a map
-
-
- remove
- Event
- Fired after the layer is removed from a map
-
-
-
-
-
-Popup events
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-Tooltip events
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-Classes extending L.Layer will inherit the following methods:
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-Extension methods
-
-Every layer should extend from L.Layer and (re-)implement the following methods.
-
-
-
- Method
- Returns
- Description
-
-
-
- onAdd(<Map> map)
- this
- Should contain code that creates DOM elements for the layer, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).
-
-
-
- onRemove(<Map> map)
- this
- Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
-
-
-
- getEvents()
- Object
- This optional method should return an object like { viewreset: this._reset } for addEventListener. The event handlers in this object will be automatically added and removed from the map with your layer.
-
-
-
- getAttribution()
- String
- This optional method should return a string containing HTML to be shown on the Attribution control whenever the layer is visible.
-
-
-
- beforeAdd(<Map> map)
- this
- Optional method. Called on map.addLayer(layer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
-
-
-
-
-
-
-Popup methods
-
-All layers share a set of methods convenient for binding popups to it.
-var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);
-layer.openPopup();
-layer.closePopup();
-
-Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-Tooltip methods
-
-All layers share a set of methods convenient for binding tooltips to it.
-var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
-layer.openTooltip();
-layer.closeTooltip();
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Interactive layer
Some Layers can be made interactive - when the user interacts
-with such a layer, mouse events like click and mouseover can be handled.
-Use the event handling methods to handle these events.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this layer will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-Mouse events
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Control
L.Control is a base class for implementing map controls. Handles positioning.
-All other controls extend from this class.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-Classes extending L.Control will inherit the following methods:
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-Extension methods
-
-Every control should extend from L.Control and (re-)implement the following methods.
-
-
-
- Method
- Returns
- Description
-
-
-
- onAdd(<Map> map)
- HTMLElement
- Should return the container DOM element for the control and add listeners on relevant map events. Called on control.addTo(map).
-
-
-
- onRemove(<Map> map)
-
- Optional method. Should contain all clean up code that removes the listeners previously added in onAdd. Called on control.remove().
-
-
-
-
-
-
-
- Handler
Abstract class for map interaction handlers
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- enable()
- this
- Enables the handler
-
-
-
- disable()
- this
- Disables the handler
-
-
-
- enabled()
- Boolean
- Returns true if the handler is enabled
-
-
-
-
-
-
-Extension methods
-
-Classes inheriting from Handler must implement the two following methods:
-
-
-
- Method
- Returns
- Description
-
-
-
- addHooks()
-
- Called when the handler is enabled, should add event hooks.
-
-
-
- removeHooks()
-
- Called when the handler is disabled, should remove the event hooks added previously.
-
-
-
-
-
-
-
-
-Functions
-
-
-
-There is static function which can be called without instantiating L.Handler:
-
-
-
-
- Function
- Returns
- Description
-
-
-
- addTo(<Map> map, <String> name)
- this
- Adds a new Handler to the given map with the given name.
-
-
-
-
-
-
- Projection
An object with methods for projecting geographical coordinates of the world onto
-a flat surface (and back). See Map projection.
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- project(<LatLng> latlng)
- Point
- Projects geographical coordinates into a 2D point.
-Only accepts actual L.LatLng instances, not arrays.
-
-
-
- unproject(<Point> point)
- LatLng
- The inverse of project. Projects a 2D point into a geographical location.
-Only accepts actual L.Point instances, not arrays.
-Note that the projection instances do not inherit from Leafet's Class object,
-and can't be instantiated. Also, new classes can't inherit from them,
-and methods can't be added to them with the include function.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- bounds
- Bounds
- The bounds (specified in CRS units) where the projection is valid
-
-
-
-
-
-
-
-Defined projections
-
-
-
-
-
-Leaflet comes with a set of already defined Projections out of the box:
-
-
-
- Projection
- Description
-
-
-
- L.Projection.LonLat
- Equirectangular, or Plate Carree projection — the most simple projection,
-mostly used by GIS enthusiasts. Directly maps x as longitude, and y as
-latitude. Also suitable for flat worlds, e.g. game maps. Used by the
-EPSG:4326 and Simple CRS.
-
-
- L.Projection.Mercator
- Elliptical Mercator projection — more complex than Spherical Mercator. Takes into account that Earth is a geoid, not a perfect sphere. Used by the EPSG:3395 CRS.
-
-
- L.Projection.SphericalMercator
- Spherical Mercator projection — the most common projection for online maps,
-used by almost all free and commercial tile providers. Assumes that Earth is
-a sphere. Used by the EPSG:3857 CRS.
-
-
-
-
-
-
- CRS
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- latLngToPoint(<LatLng> latlng, <Number> zoom)
- Point
- Projects geographical coordinates into pixel coordinates for a given zoom.
-
-
-
- pointToLatLng(<Point> point, <Number> zoom)
- LatLng
- The inverse of latLngToPoint. Projects pixel coordinates on a given
-zoom into geographical coordinates.
-
-
-
- project(<LatLng> latlng)
- Point
- Projects geographical coordinates into coordinates in units accepted for
-this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
-
-
-
- unproject(<Point> point)
- LatLng
- Given a projected coordinate returns the corresponding LatLng.
-The inverse of project.
-
-
-
- scale(<Number> zoom)
- Number
- Returns the scale used when transforming projected coordinates into
-pixel coordinates for a particular zoom. For example, it returns
-256 * 2^zoom for Mercator-based CRS.
-
-
-
- zoom(<Number> scale)
- Number
- Inverse of scale(), returns the zoom level corresponding to a scale
-factor of scale.
-
-
-
- getProjectedBounds(<Number> zoom)
- Bounds
- Returns the projection's bounds scaled and transformed for the provided zoom.
-
-
-
- distance(<LatLng> latlng1, <LatLng> latlng2)
- Number
- Returns the distance between two geographical coordinates.
-
-
-
- wrapLatLng(<LatLng> latlng)
- LatLng
- Returns a LatLng where lat and lng has been wrapped according to the
-CRS's wrapLat and wrapLng properties, if they are outside the CRS's bounds.
-
-
-
- wrapLatLngBounds(<LatLngBounds> bounds)
- LatLngBounds
- Returns a LatLngBounds with the same size as the given one, ensuring
-that its center is within the CRS's bounds.
-Only accepts actual L.LatLngBounds instances, not arrays.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- code
- String
- Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857')
-
-
- wrapLng
- Number[]
- An array of two numbers defining whether the longitude (horizontal) coordinate
-axis wraps around a given range and how. Defaults to [-180, 180] in most
-geographical CRSs. If undefined, the longitude axis does not wrap around.
-
-
- wrapLat
- Number[]
- Like wrapLng, but for the latitude (vertical) axis.
-
-
- infinite
- Boolean
- If true, the coordinate space will be unbounded (infinite in both axes)
-
-
-
-
-
-
-
-Defined CRSs
-
-
-
-
-
-
-
-
- CRS
- Description
-
-
-
- L.CRS.EPSG3395
- Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
-
-
- L.CRS.EPSG3857
- The most common CRS for online maps, used by almost all free and commercial
-tile providers. Uses Spherical Mercator projection. Set in by default in
-Map's crs option.
-
-
- L.CRS.EPSG4326
- A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
-Leaflet 1.0.x complies with the TMS coordinate scheme for EPSG:4326,
-which is a breaking change from 0.7.x behaviour. If you are using a TileLayer
-with this CRS, ensure that there are two 256x256 pixel tiles covering the
-whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),
-or (-180,-90) for TileLayers with the tms option set.
-
-
- L.CRS.Earth
- Serves as the base for CRS that are global such that they cover the earth.
-Can only be used as the base for other CRS and cannot be used directly,
-since it does not have a code, projection or transformation. distance() returns
-meters.
-
-
- L.CRS.Simple
- A simple CRS that maps longitude and latitude into x and y directly.
-May be used for maps of flat surfaces (e.g. game maps). Note that the y
-axis should still be inverted (going from bottom to top). distance() returns
-simple euclidean distance.
-
-
- L.CRS.Base
- Object that defines coordinate reference systems for projecting
-geographical points into pixel (screen) coordinates and back (and to
-coordinates in other units for WMS services). See
-spatial reference system.
-Leaflet defines the most usual CRSs by default. If you want to use a
-CRS not defined by default, take a look at the
-Proj4Leaflet plugin.
-Note that the CRS instances do not inherit from Leafet's Class object,
-and can't be instantiated. Also, new classes can't inherit from them,
-and methods can't be added to them with the include function.
-
-
-
-
-
-
- Renderer
Base class for vector renderer implementations (SVG, Canvas). Handles the
-DOM container of the renderer, its bounds, and its zoom animation.
-A Renderer works as an implicit layer group for all Paths - the renderer
-itself can be added or removed to the map. All paths use a renderer, which can
-be implicit (the map will decide the type of renderer and use it automatically)
-or explicit (using the renderer option of the path).
-Do not use this class directly, use SVG and Canvas instead.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- padding
- Number
- 0.1
- How much to extend the clip area around the map view (relative to its size)
-e.g. 0.1 would be 10% of map view in each direction
-
-
- tolerance
- Number
- 0
- How much to extend click tolerance round a path/object on the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- update
- Event
- Fired when the renderer updates its bounds, center and zoom, for example when
-its map has moved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Event objects
Whenever a class inheriting from Evented fires an event, a listener function
-will be called with an event argument, which is a plain object containing
-information about the event. For example:
-map.on('click', function(ev) {
- alert(ev.latlng); // ev is an event object (MouseEvent in this case)
-});
-
-The information available depends on the event type:
-
-
-
-
-Event
-
-
-
-
-
-The base event object. All other event objects contain these properties too.
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-KeyboardEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- originalEvent
- DOMEvent
- The original DOM KeyboardEvent that triggered this Leaflet event.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-MouseEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- latlng
- LatLng
- The geographical point where the mouse event occured.
-
-
- layerPoint
- Point
- Pixel coordinates of the point where the mouse event occured relative to the map layer.
-
-
- containerPoint
- Point
- Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
-
-
- originalEvent
- DOMEvent
- The original DOM MouseEvent or DOM TouchEvent that triggered this Leaflet event.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-LocationEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- latlng
- LatLng
- Detected geographical location of the user.
-
-
- bounds
- LatLngBounds
- Geographical bounds of the area user is located in (with respect to the accuracy of location).
-
-
- accuracy
- Number
- Accuracy of location in meters.
-
-
- altitude
- Number
- Height of the position above the WGS84 ellipsoid in meters.
-
-
- altitudeAccuracy
- Number
- Accuracy of altitude in meters.
-
-
- heading
- Number
- The direction of travel in degrees counting clockwise from true North.
-
-
- speed
- Number
- Current velocity in meters per second.
-
-
- timestamp
- Number
- The time when the position was acquired.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-ErrorEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- message
- String
- Error message.
-
-
- code
- Number
- Error code (if applicable).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-LayerEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- layer
- Layer
- The layer that was added or removed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
-
-
-
-
-
-
-
-
-LayersControlEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- layer
- Layer
- The layer that was added or removed.
-
-
- name
- String
- The name of the layer that was added or removed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
-
-
-
-
-
-
-
-
-TileEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- tile
- HTMLElement
- The tile element (image).
-
-
- coords
- Point
- Point object with the tile's x, y, and z (zoom level) coordinates.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-TileErrorEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- tile
- HTMLElement
- The tile element (image).
-
-
- coords
- Point
- Point object with the tile's x, y, and z (zoom level) coordinates.
-
-
- error
- *
- Error passed to the tile's done() callback.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-ResizeEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- oldSize
- Point
- The old size before resize event.
-
-
- newSize
- Point
- The new size after the resize event.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-GeoJSONEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- layer
- Layer
- The layer for the GeoJSON feature that is being added to the map.
-
-
- properties
- Object
- GeoJSON properties of the feature.
-
-
- geometryType
- String
- GeoJSON geometry type of the feature.
-
-
- id
- String
- GeoJSON ID of the feature (if present).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
-
-
-
-
-
-
-
-
-PopupEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- popup
- Popup
- The popup that was opened or closed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-TooltipEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- tooltip
- Tooltip
- The tooltip that was opened or closed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-DragEndEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- distance
- Number
- The distance in pixels the draggable element was moved by.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-ZoomAnimEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- center
- LatLng
- The current center of the map
-
-
- zoom
- Number
- The current zoom level of the map
-
-
- noUpdate
- Boolean
- Whether layers should update their contents due to this event
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
- DivOverlay
Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- offset
- Point
- Point(0, 7)
- The offset of the popup position. Useful to control the anchor
-of the popup when opening it on some overlays.
-
-
- className
- String
- ''
- A custom CSS class name to assign to the popup.
-
-
- pane
- String
- 'popupPane'
- Map pane where the popup will be added.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Global Switches
Global switches are created for rare cases and generally make
-Leaflet to not detect a particular browser feature even if it's
-there. You need to set the switch as a global variable to true
-before including Leaflet on the page, like this:
-<script>L_NO_TOUCH = true;</script>
-<script src="leaflet.js"></script>
-
-
-
-
-Switch
-Description
-
-
-
-
-L_NO_TOUCH
-Forces Leaflet to not use touch events even if it detects them.
-
-
-L_DISABLE_3D
-Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning (which may cause glitches in some rare environments) even if they're supported.
-
-
-
-
-noConflict
This method restores the L global variable to the original value
-it had before Leaflet inclusion, and returns the real Leaflet
-namespace so you can put it elsewhere, like this:
-<script src='libs/l.js'>
-<!-- L points to some other library -->
-<script src='leaflet.js'>
-<!-- you include Leaflet, it replaces the L variable to Leaflet namespace -->
-<script>
-var Leaflet = L.noConflict();
-// now L points to that other library again, and you can use Leaflet.Map etc.
-</script>
-
-
-version
A constant that represents the Leaflet version in use.
-L.version; // contains "1.0.0" (or whatever version is currently in use)
-
diff --git a/docs/reference-1.3.1.html b/docs/reference-1.3.1.html
deleted file mode 100644
index 35d96e2b997..00000000000
--- a/docs/reference-1.3.1.html
+++ /dev/null
@@ -1,4 +0,0 @@
----
-layout: redirected
-redirect_to: reference-1.3.0.html
----
\ No newline at end of file
diff --git a/docs/reference-1.3.2.html b/docs/reference-1.3.2.html
deleted file mode 100644
index 0299016d9df..00000000000
--- a/docs/reference-1.3.2.html
+++ /dev/null
@@ -1,23924 +0,0 @@
----
-layout: v2
-title: Documentation
-bodyclass: api-page
----
-
-Leaflet API reference
-
-This reference reflects Leaflet 1.3.2 and Leaflet 1.3.3. Check this list if you are using a different version of Leaflet.
-
-
-
- Map
-
- - Usage example
- - Creation
- - Options
- - Events
-
- Map Methods
-
- - Modifying map state
- - Getting map state
- - Layers and controls
- - Conversion methods
- - Other methods
-
- Map Misc
-
- - Properties
- - Panes
-
-
-
- UI Layers
-
- Raster Layers
-
- - TileLayer
- - TileLayer.WMS
- - ImageOverlay
- - VideoOverlay
-
- Vector Layers
-
-
-
- Other Layers
-
- - LayerGroup
- - FeatureGroup
- - GeoJSON
- - GridLayer
-
- Basic Types
-
- Controls
-
- - Zoom
- - Attribution
- - Layers
- - Scale
-
-
-
-
-
-
-
-
-
- Utility
-
- - Browser
- - Util
- - Transformation
- - LineUtil
- - PolyUtil
-
- DOM Utility
-
- - DomEvent
- - DomUtil
- - PosAnimation
- - Draggable
-
-
-
- Base Classes
-
- - Class
- - Evented
- - Layer
- - Interactive layer
- - Control
- - Handler
-
- - Projection
- - CRS
- - Renderer
-
-
- Misc
-
- - Event objects
- - global switches
- - noConflict
- - version
-
-
-
-
- Map
The central class of the API — it is used to create a map on a page and manipulate it.
-
-
-Usage example
-
-
-
-
-
-
-
-// initialize the map on the "map" div with a given center and zoom
-var map = L.map('map', {
- center: [51.505, -0.09],
- zoom: 13
-});
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.map(<String> id, <Map options> options?)
- Instantiates a map object given the DOM ID of a <div> element
-and optionally an object literal with Map options.
-
-
- L.map(<HTMLElement> el, <Map options> options?)
- Instantiates a map object given an instance of a <div> HTML element
-and optionally an object literal with Map options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- preferCanvas
- Boolean
- false
- Whether Paths should be rendered on a Canvas renderer.
-By default, all Paths are rendered in a SVG renderer.
-
-
-
-
-
-Control options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attributionControl
- Boolean
- true
- Whether a attribution control is added to the map by default.
-
-
- zoomControl
- Boolean
- true
- Whether a zoom control is added to the map by default.
-
-
-
-
-
-Interaction Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- closePopupOnClick
- Boolean
- true
- Set it to false if you don't want popups to close when user clicks the map.
-
-
- boxZoom
- Boolean
- true
- Whether the map can be zoomed to a rectangular area specified by
-dragging the mouse while pressing the shift key.
-
-
- doubleClickZoom
- Boolean|String
- true
- Whether the map can be zoomed in by double clicking on it and
-zoomed out by double clicking while holding shift. If passed
-'center', double-click zoom will zoom to the center of the
- view regardless of where the mouse was.
-
-
- dragging
- Boolean
- true
- Whether the map be draggable with mouse/touch or not.
-
-
- zoomSnap
- Number
- 1
- Forces the map's zoom level to always be a multiple of this, particularly
-right after a fitBounds() or a pinch-zoom.
-By default, the zoom level snaps to the nearest integer; lower values
-(e.g. 0.5 or 0.1) allow for greater granularity. A value of 0
-means the zoom level will not be snapped after fitBounds or a pinch-zoom.
-
-
- zoomDelta
- Number
- 1
- Controls how much the map's zoom level will change after a
-zoomIn(), zoomOut(), pressing +
-or - on the keyboard, or using the zoom controls.
-Values smaller than 1 (e.g. 0.5) allow for greater granularity.
-
-
- trackResize
- Boolean
- true
- Whether the map automatically handles browser window resize to update itself.
-
-
-
-
-
-Panning Inertia Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- inertia
- Boolean
- *
- If enabled, panning of the map will have an inertia effect where
-the map builds momentum while dragging and continues moving in
-the same direction for some time. Feels especially nice on touch
-devices. Enabled by default unless running on old Android devices.
-
-
- inertiaDeceleration
- Number
- 3000
- The rate with which the inertial movement slows down, in pixels/second².
-
-
- inertiaMaxSpeed
- Number
- Infinity
- Max speed of the inertial movement, in pixels/second.
-
-
- easeLinearity
- Number
- 0.2
-
-
-
- worldCopyJump
- Boolean
- false
- With this option enabled, the map tracks when you pan to another "copy"
-of the world and seamlessly jumps to the original one so that all overlays
-like markers and vector layers are still visible.
-
-
- maxBoundsViscosity
- Number
- 0.0
- If maxBounds is set, this option will control how solid the bounds
-are when dragging the map around. The default value of 0.0 allows the
-user to drag outside the bounds at normal speed, higher values will
-slow down map dragging outside bounds, and 1.0 makes the bounds fully
-solid, preventing the user from dragging outside the bounds.
-
-
-
-
-
-Keyboard Navigation Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- keyboard
- Boolean
- true
- Makes the map focusable and allows users to navigate the map with keyboard
-arrows and +/- keys.
-
-
- keyboardPanDelta
- Number
- 80
- Amount of pixels to pan when pressing an arrow key.
-
-
-
-
-
-Mousewheel options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- scrollWheelZoom
- Boolean|String
- true
- Whether the map can be zoomed by using the mouse wheel. If passed 'center',
-it will zoom to the center of the view regardless of where the mouse was.
-
-
- wheelDebounceTime
- Number
- 40
- Limits the rate at which a wheel can fire (in milliseconds). By default
-user can't zoom via wheel more often than once per 40 ms.
-
-
- wheelPxPerZoomLevel
- Number
- 60
- How many scroll pixels (as reported by L.DomEvent.getWheelDelta)
-mean a change of one full zoom level. Smaller values will make wheel-zooming
-faster (and vice versa).
-
-
-
-
-
-Touch interaction options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tap
- Boolean
- true
- Enables mobile hacks for supporting instant taps (fixing 200ms click
-delay on iOS/Android) and touch holds (fired as contextmenu events).
-
-
- tapTolerance
- Number
- 15
- The max number of pixels a user can shift his finger during touch
-for it to be considered a valid tap.
-
-
- touchZoom
- Boolean|String
- *
- Whether the map can be zoomed by touch-dragging with two fingers. If
-passed 'center', it will zoom to the center of the view regardless of
-where the touch events (fingers) were. Enabled for touch-capable web
-browsers except for old Androids.
-
-
- bounceAtZoomLimits
- Boolean
- true
- Set it to false if you don't want the map to zoom beyond min/max zoom
-and then bounce back when pinch-zooming.
-
-
-
-
-
-Map State Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- crs
- CRS
- L.CRS.EPSG3857
- The Coordinate Reference System to use. Don't change this if you're not
-sure what it means.
-
-
- center
- LatLng
- undefined
- Initial geographic center of the map
-
-
- zoom
- Number
- undefined
- Initial map zoom level
-
-
- minZoom
- Number
- *
- Minimum zoom level of the map.
-If not specified and at least one GridLayer or TileLayer is in the map,
-the lowest of their minZoom options will be used instead.
-
-
- maxZoom
- Number
- *
- Maximum zoom level of the map.
-If not specified and at least one GridLayer or TileLayer is in the map,
-the highest of their maxZoom options will be used instead.
-
-
- layers
- Layer[]
- []
- Array of layers that will be added to the map initially
-
-
- maxBounds
- LatLngBounds
- null
- When this option is set, the map restricts the view to the given
-geographical bounds, bouncing the user back if the user tries to pan
-outside the view. To set the restriction dynamically, use
-setMaxBounds method.
-
-
- renderer
- Renderer
- *
- The default method for drawing vector layers on the map. L.SVG
-or L.Canvas by default depending on browser support.
-
-
-
-
-
-Animation Options
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- zoomAnimation
- Boolean
- true
- Whether the map zoom animation is enabled. By default it's enabled
-in all browsers that support CSS3 Transitions except Android.
-
-
- zoomAnimationThreshold
- Number
- 4
- Won't animate zoom if the zoom difference exceeds this value.
-
-
- fadeAnimation
- Boolean
- true
- Whether the tile fade animation is enabled. By default it's enabled
-in all browsers that support CSS3 Transitions except Android.
-
-
- markerZoomAnimation
- Boolean
- true
- Whether markers animate their zoom with the zoom animation, if disabled
-they will disappear for the length of the animation. By default it's
-enabled in all browsers that support CSS3 Transitions except Android.
-
-
- transform3DLimit
- Number
- 2^23
- Defines the maximum size of a CSS translation transform. The default
-value should not be changed unless a web browser positions layers in
-the wrong place after doing a large panBy.
-
-
-
-
-
-
-
-Events
-
-
-
-Layer events
-
-
-
-
- Event
- Data
- Description
-
-
-
- baselayerchange
- LayersControlEvent
- Fired when the base layer is changed through the layer control.
-
-
- overlayadd
- LayersControlEvent
- Fired when an overlay is selected through the layer control.
-
-
- overlayremove
- LayersControlEvent
- Fired when an overlay is deselected through the layer control.
-
-
- layeradd
- LayerEvent
- Fired when a new layer is added to the map.
-
-
- layerremove
- LayerEvent
- Fired when some layer is removed from the map
-
-
-
-
-
-Map state change events
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- zoomlevelschange
- Event
- Fired when the number of zoomlevels on the map is changed due
-to adding or removing a layer.
-
-
- resize
- ResizeEvent
- Fired when the map is resized.
-
-
- unload
- Event
- Fired when the map is destroyed with remove method.
-
-
- viewreset
- Event
- Fired when the map needs to redraw its content (this usually happens
-on map zoom or load). Very useful for creating custom overlays.
-
-
- load
- Event
- Fired when the map is initialized (when its center and zoom are set
-for the first time).
-
-
- zoomstart
- Event
- Fired when the map zoom is about to change (e.g. before zoom animation).
-
-
- movestart
- Event
- Fired when the view of the map starts changing (e.g. user starts dragging the map).
-
-
- zoom
- Event
- Fired repeatedly during any change in zoom level, including zoom
-and fly animations.
-
-
- move
- Event
- Fired repeatedly during any movement of the map, including pan and
-fly animations.
-
-
- zoomend
- Event
- Fired when the map has changed, after any animations.
-
-
- moveend
- Event
- Fired when the center of the map stops changing (e.g. user stopped
-dragging the map).
-
-
-
-
-
-Popup events
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup is opened in the map
-
-
- popupclose
- PopupEvent
- Fired when a popup in the map is closed
-
-
- autopanstart
- Event
- Fired when the map starts autopanning when opening a popup.
-
-
-
-
-
-Tooltip events
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip is opened in the map.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip in the map is closed.
-
-
-
-
-
-Location events
-
-
-
-
- Event
- Data
- Description
-
-
-
- locationerror
- ErrorEvent
- Fired when geolocation (using the locate method) failed.
-
-
- locationfound
- LocationEvent
- Fired when geolocation (using the locate method)
-went successfully.
-
-
-
-
-
-Interaction events
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the map.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the map.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the map.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button on the map.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the map.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the map.
-
-
- mousemove
- MouseEvent
- Fired while the mouse moves over the map.
-
-
- contextmenu
- MouseEvent
- Fired when the user pushes the right mouse button on the map, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
- keypress
- KeyboardEvent
- Fired when the user presses a key from the keyboard while the map is focused.
-
-
- preclick
- MouseEvent
- Fired before mouse click on the map (sometimes useful when you
-want something to happen on click before any existing click
-handlers start running).
-
-
-
-
-
-Other Methods
-
-
-
-
- Event
- Data
- Description
-
-
-
- zoomanim
- ZoomAnimEvent
- Fired on every frame of a zoom animation
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getRenderer(<Path> layer)
- Renderer
- Returns the instance of Renderer that should be used to render the given
-Path. It will ensure that the renderer options of the map and paths
-are respected, and that the renderers do exist on the map.
-
-
-
-
-
-
-Methods for Layers and Controls
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addControl(<Control> control)
- this
- Adds the given control to the map
-
-
-
- removeControl(<Control> control)
- this
- Removes the given control from the map
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the map
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the map.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the map
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the map, optionally specifying context of the iterator function.
-map.eachLayer(function(layer){
- layer.bindPopup('Hello');
-});
-
-
-
- openPopup(<Popup> popup)
- this
- Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
-
-
-
- openPopup(<String|HTMLElement> content, <LatLng> latlng, <Popup options> options?)
- this
- Creates a popup with the specified content and options and opens it in the given point on a map.
-
-
-
- closePopup(<Popup> popup?)
- this
- Closes the popup previously opened with openPopup (or the given one).
-
-
-
- openTooltip(<Tooltip> tooltip)
- this
- Opens the specified tooltip.
-
-
-
- openTooltip(<String|HTMLElement> content, <LatLng> latlng, <Tooltip options> options?)
- this
- Creates a tooltip with the specified content and options and open it.
-
-
-
- closeTooltip(<Tooltip> tooltip?)
- this
- Closes the tooltip given as parameter.
-
-
-
-
-
-
-Methods for modifying map state
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setView(<LatLng> center, <Number> zoom, <Zoom/pan options> options?)
- this
- Sets the view of the map (geographical center and zoom) with the given
-animation options.
-
-
-
- setZoom(<Number> zoom, <Zoom/pan options> options?)
- this
- Sets the zoom of the map.
-
-
-
- zoomIn(<Number> delta?, <Zoom options> options?)
- this
- Increases the zoom of the map by delta (zoomDelta by default).
-
-
-
- zoomOut(<Number> delta?, <Zoom options> options?)
- this
- Decreases the zoom of the map by delta (zoomDelta by default).
-
-
-
- setZoomAround(<LatLng> latlng, <Number> zoom, <Zoom options> options)
- this
- Zooms the map while keeping a specified geographical point on the map
-stationary (e.g. used internally for scroll zoom and double-click zoom).
-
-
-
- setZoomAround(<Point> offset, <Number> zoom, <Zoom options> options)
- this
- Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
-
-
-
- fitBounds(<LatLngBounds> bounds, <fitBounds options> options?)
- this
- Sets a map view that contains the given geographical bounds with the
-maximum zoom level possible.
-
-
-
- fitWorld(<fitBounds options> options?)
- this
- Sets a map view that mostly contains the whole world with the maximum
-zoom level possible.
-
-
-
- panTo(<LatLng> latlng, <Pan options> options?)
- this
- Pans the map to a given center.
-
-
-
- panBy(<Point> offset, <Pan options> options?)
- this
- Pans the map by a given number of pixels (animated).
-
-
-
- flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?)
- this
- Sets the view of the map (geographical center and zoom) performing a smooth
-pan-zoom animation.
-
-
-
- flyToBounds(<LatLngBounds> bounds, <fitBounds options> options?)
- this
- Sets the view of the map with a smooth animation like flyTo,
-but takes a bounds parameter like fitBounds.
-
-
-
- setMaxBounds(<Bounds> bounds)
- this
- Restricts the map view to the given bounds (see the maxBounds option).
-
-
-
- setMinZoom(<Number> zoom)
- this
- Sets the lower limit for the available zoom levels (see the minZoom option).
-
-
-
- setMaxZoom(<Number> zoom)
- this
- Sets the upper limit for the available zoom levels (see the maxZoom option).
-
-
-
- panInsideBounds(<LatLngBounds> bounds, <Pan options> options?)
- this
- Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
-
-
-
- invalidateSize(<Zoom/pan options> options)
- this
- Checks if the map container size changed and updates the map if so —
-call it after you've changed the map size dynamically, also animating
-pan by default. If options.pan is false, panning will not occur.
-If options.debounceMoveend is true, it will delay moveend event so
-that it doesn't happen often even if the method is called many
-times in a row.
-
-
-
- invalidateSize(<Boolean> animate)
- this
- Checks if the map container size changed and updates the map if so —
-call it after you've changed the map size dynamically, also animating
-pan by default.
-
-
-
- stop()
- this
- Stops the currently running panTo or flyTo animation, if any.
-
-
-
-
-
-
-Geolocation methods
-
-
-
-
- Method
- Returns
- Description
-
-
-
- locate(<Locate options> options?)
- this
- Tries to locate the user using the Geolocation API, firing a locationfound
-event with location data on success or a locationerror event on failure,
-and optionally sets the map view to the user's location with respect to
-detection accuracy (or to the world view if geolocation failed).
-Note that, if your page doesn't use HTTPS, this method will fail in
-modern browsers (Chrome 50 and newer)
-See Locate options for more details.
-
-
-
- stopLocate()
- this
- Stops watching location previously initiated by map.locate({watch: true})
-and aborts resetting the map view if map.locate was called with
-{setView: true}.
-
-
-
-
-
-
-Other Methods
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addHandler(<String> name, <Function> HandlerClass)
- this
- Adds a new Handler to the map, given its name and constructor function.
-
-
-
- remove()
- this
- Destroys the map and clears all related event listeners.
-
-
-
- createPane(<String> name, <HTMLElement> container?)
- HTMLElement
- Creates a new map pane with the given name if it doesn't exist already,
-then returns it. The pane is created as a child of container, or
-as a child of the main map pane if not set.
-
-
-
- getPane(<String|HTMLElement> pane)
- HTMLElement
- Returns a map pane, given its name or its HTML element (its identity).
-
-
-
- getPanes()
- Object
- Returns a plain object containing the names of all panes as keys and
-the panes as values.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the map.
-
-
-
- whenReady(<Function> fn, <Object> context?)
- this
- Runs the given function fn when the map gets initialized with
-a view (center and zoom) and at least one layer, or immediately
-if it's already initialized, optionally passing a function context.
-
-
-
-
-
-
-Methods for Getting Map State
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getCenter()
- LatLng
- Returns the geographical center of the map view
-
-
-
- getZoom()
- Number
- Returns the current zoom level of the map view
-
-
-
- getBounds()
- LatLngBounds
- Returns the geographical bounds visible in the current map view
-
-
-
- getMinZoom()
- Number
- Returns the minimum zoom level of the map (if set in the minZoom option of the map or of any layers), or 0 by default.
-
-
-
- getMaxZoom()
- Number
- Returns the maximum zoom level of the map (if set in the maxZoom option of the map or of any layers).
-
-
-
- getBoundsZoom(<LatLngBounds> bounds, <Boolean> inside?, <Point> padding?)
- Number
- Returns the maximum zoom level on which the given bounds fit to the map
-view in its entirety. If inside (optional) is set to true, the method
-instead returns the minimum zoom level on which the map view fits into
-the given bounds in its entirety.
-
-
-
- getSize()
- Point
- Returns the current size of the map container (in pixels).
-
-
-
- getPixelBounds()
- Bounds
- Returns the bounds of the current map view in projected pixel
-coordinates (sometimes useful in layer and overlay implementations).
-
-
-
- getPixelOrigin()
- Point
- Returns the projected pixel coordinates of the top left point of
-the map layer (useful in custom layer and overlay implementations).
-
-
-
- getPixelWorldBounds(<Number> zoom?)
- Bounds
- Returns the world's bounds in pixel coordinates for zoom level zoom.
-If zoom is omitted, the map's current zoom level is used.
-
-
-
-
-
-
-Conversion Methods
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getZoomScale(<Number> toZoom, <Number> fromZoom)
- Number
- Returns the scale factor to be applied to a map transition from zoom level
-fromZoom to toZoom. Used internally to help with zoom animations.
-
-
-
- getScaleZoom(<Number> scale, <Number> fromZoom)
- Number
- Returns the zoom level that the map would end up at, if it is at fromZoom
-level and everything is scaled by a factor of scale. Inverse of
-getZoomScale.
-
-
-
- project(<LatLng> latlng, <Number> zoom)
- Point
- Projects a geographical coordinate LatLng according to the projection
-of the map's CRS, then scales it according to zoom and the CRS's
-Transformation. The result is pixel coordinate relative to
-the CRS origin.
-
-
-
- unproject(<Point> point, <Number> zoom)
- LatLng
- Inverse of project.
-
-
-
- layerPointToLatLng(<Point> point)
- LatLng
- Given a pixel coordinate relative to the origin pixel,
-returns the corresponding geographical coordinate (for the current zoom level).
-
-
-
- latLngToLayerPoint(<LatLng> latlng)
- Point
- Given a geographical coordinate, returns the corresponding pixel coordinate
-relative to the origin pixel.
-
-
-
- wrapLatLng(<LatLng> latlng)
- LatLng
- Returns a LatLng where lat and lng has been wrapped according to the
-map's CRS's wrapLat and wrapLng properties, if they are outside the
-CRS's bounds.
-By default this means longitude is wrapped around the dateline so its
-value is between -180 and +180 degrees.
-
-
-
- wrapLatLngBounds(<LatLngBounds> bounds)
- LatLngBounds
- Returns a LatLngBounds with the same size as the given one, ensuring that
-its center is within the CRS's bounds.
-By default this means the center longitude is wrapped around the dateline so its
-value is between -180 and +180 degrees, and the majority of the bounds
-overlaps the CRS's bounds.
-
-
-
- distance(<LatLng> latlng1, <LatLng> latlng2)
- Number
- Returns the distance between two geographical coordinates according to
-the map's CRS. By default this measures distance in meters.
-
-
-
- containerPointToLayerPoint(<Point> point)
- Point
- Given a pixel coordinate relative to the map container, returns the corresponding
-pixel coordinate relative to the origin pixel.
-
-
-
- layerPointToContainerPoint(<Point> point)
- Point
- Given a pixel coordinate relative to the origin pixel,
-returns the corresponding pixel coordinate relative to the map container.
-
-
-
- containerPointToLatLng(<Point> point)
- LatLng
- Given a pixel coordinate relative to the map container, returns
-the corresponding geographical coordinate (for the current zoom level).
-
-
-
- latLngToContainerPoint(<LatLng> latlng)
- Point
- Given a geographical coordinate, returns the corresponding pixel coordinate
-relative to the map container.
-
-
-
- mouseEventToContainerPoint(<MouseEvent> ev)
- Point
- Given a MouseEvent object, returns the pixel coordinate relative to the
-map container where the event took place.
-
-
-
- mouseEventToLayerPoint(<MouseEvent> ev)
- Point
- Given a MouseEvent object, returns the pixel coordinate relative to
-the origin pixel where the event took place.
-
-
-
- mouseEventToLatLng(<MouseEvent> ev)
- LatLng
- Given a MouseEvent object, returns geographical coordinate where the
-event took place.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Properties
-
-
-
-Handlers
-
-
-
-
- Property
- Type
- Description
-
-
-
- boxZoom
- Handler
- Box (shift-drag with mouse) zoom handler.
-
-
- doubleClickZoom
- Handler
- Double click zoom handler.
-
-
- dragging
- Handler
- Map dragging handler (by both mouse and touch).
-
-
- keyboard
- Handler
- Keyboard navigation handler.
-
-
- scrollWheelZoom
- Handler
- Scroll wheel zoom handler.
-
-
- tap
- Handler
- Mobile touch hacks (quick tap and touch hold) handler.
-
-
- touchZoom
- Handler
- Touch zoom handler.
-
-
-
-
-
-
-
-Map panes
-
-
-
-
-
-Panes are DOM elements used to control the ordering of layers on the map. You
-can access panes with map.getPane or
-map.getPanes methods. New panes can be created with the
-map.createPane method.
-Every map has the following default panes that differ only in zIndex.
-
-
-
- Pane
- Type
- Z-index
- Description
-
-
-
- mapPane
- HTMLElement
- 'auto'
- Pane that contains all other map panes
-
-
- tilePane
- HTMLElement
- 200
- Pane for GridLayers and TileLayers
-
-
- overlayPane
- HTMLElement
- 400
- Pane for vectors (Paths, like Polylines and Polygons), ImageOverlays and VideoOverlays
-
-
- shadowPane
- HTMLElement
- 500
- Pane for overlay shadows (e.g. Marker shadows)
-
-
- markerPane
- HTMLElement
- 600
- Pane for Icons of Markers
-
-
- tooltipPane
- HTMLElement
- 650
- Pane for Tooltips.
-
-
- popupPane
- HTMLElement
- 700
- Pane for Popups.
-
-
-
-
-
-
-
-
-
-Locate options
-
-
-
-
-
-Some of the geolocation methods for Map take in an options parameter. This
-is a plain javascript object with the following optional components:
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- watch
- Boolean
- false
- If true, starts continuous watching of location changes (instead of detecting it
-once) using W3C watchPosition method. You can later stop watching using
-map.stopLocate() method.
-
-
- setView
- Boolean
- false
- If true, automatically sets the map view to the user location with respect to
-detection accuracy, or to world view if geolocation failed.
-
-
- maxZoom
- Number
- Infinity
- The maximum zoom for automatic view setting when using setView option.
-
-
- timeout
- Number
- 10000
- Number of milliseconds to wait for a response from geolocation before firing a
-locationerror event.
-
-
- maximumAge
- Number
- 0
- Maximum age of detected location. If less than this amount of milliseconds
-passed since last geolocation response, locate will return a cached location.
-
-
- enableHighAccuracy
- Boolean
- false
- Enables high accuracy, see description in the W3C spec.
-
-
-
-
-
-
-
-
-
-Zoom options
-
-
-
-
-
-Some of the Map methods which modify the zoom level take in an options
-parameter. This is a plain javascript object with the following optional
-components:
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If not specified, zoom animation will happen if the zoom origin is inside the
-current view. If true, the map will attempt animating zoom disregarding where
-zoom origin is. Setting false will make it always reset the view completely
-without animation.
-
-
-
-
-
-
-
-
-
-Pan options
-
-
-
-
-
-Some of the Map methods which modify the center of the map take in an options
-parameter. This is a plain javascript object with the following optional
-components:
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If true, panning will always be animated if possible. If false, it will
-not animate panning, either resetting the map view if panning more than a
-screen away, or just setting a new offset for the map pane (except for panBy
-which always does the latter).
-
-
- duration
- Number
- 0.25
- Duration of animated panning, in seconds.
-
-
- easeLinearity
- Number
- 0.25
- The curvature factor of panning animation easing (third parameter of the
-Cubic Bezier curve). 1.0 means linear animation,
-and the smaller this number, the more bowed the curve.
-
-
- noMoveStart
- Boolean
- false
- If true, panning won't fire movestart event on start (used internally for
-panning inertia).
-
-
-
-
-
-
-
-
-
-Zoom/pan options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If not specified, zoom animation will happen if the zoom origin is inside the
-current view. If true, the map will attempt animating zoom disregarding where
-zoom origin is. Setting false will make it always reset the view completely
-without animation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- duration
- Number
- 0.25
- Duration of animated panning, in seconds.
-
-
- easeLinearity
- Number
- 0.25
- The curvature factor of panning animation easing (third parameter of the
-Cubic Bezier curve). 1.0 means linear animation,
-and the smaller this number, the more bowed the curve.
-
-
- noMoveStart
- Boolean
- false
- If true, panning won't fire movestart event on start (used internally for
-panning inertia).
-
-
-
-
-
-
-
-
-
-
-FitBounds options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- paddingTopLeft
- Point
- [0, 0]
- Sets the amount of padding in the top left corner of a map container that
-shouldn't be accounted for when setting the view to fit bounds. Useful if you
-have some control overlays on the map like a sidebar and you don't want them
-to obscure objects you're zooming to.
-
-
- paddingBottomRight
- Point
- [0, 0]
- The same for the bottom right corner of the map.
-
-
- padding
- Point
- [0, 0]
- Equivalent of setting both top left and bottom right padding to the same value.
-
-
- maxZoom
- Number
- null
- The maximum possible zoom to use.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- animate
- Boolean
-
- If not specified, zoom animation will happen if the zoom origin is inside the
-current view. If true, the map will attempt animating zoom disregarding where
-zoom origin is. Setting false will make it always reset the view completely
-without animation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- duration
- Number
- 0.25
- Duration of animated panning, in seconds.
-
-
- easeLinearity
- Number
- 0.25
- The curvature factor of panning animation easing (third parameter of the
-Cubic Bezier curve). 1.0 means linear animation,
-and the smaller this number, the more bowed the curve.
-
-
- noMoveStart
- Boolean
- false
- If true, panning won't fire movestart event on start (used internally for
-panning inertia).
-
-
-
-
-
-
-
- Marker
L.Marker is used to display clickable/draggable icons on the map. Extends Layer.
-
-
-Usage example
-
-
-
-
-
-
-
-L.marker([50.5, 30.5]).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.marker(<LatLng> latlng, <Marker options> options?)
- Instantiates a Marker object given a geographical point and optionally an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- icon
- Icon
- *
- Icon instance to use for rendering the marker.
-See Icon documentation for details on how to customize the marker icon.
-If not specified, a common instance of L.Icon.Default is used.
-
-
- draggable
- Boolean
- false
- Whether the marker is draggable with mouse/touch or not.
-
-
- autoPan
- Boolean
- false
- Set it to true if you want the map to do panning animation when marker hits the edges.
-
-
- autoPanPadding
- Point
- Point(50, 50)
- Equivalent of setting both top left and bottom right autopan padding to the same value.
-
-
- autoPanSpeed
- Number
- 10
- Number of pixels the map should move by.
-
-
- keyboard
- Boolean
- true
- Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
-
-
- title
- String
- ''
- Text for the browser tooltip that appear on marker hover (no tooltip by default).
-
-
- alt
- String
- ''
- Text for the alt attribute of the icon image (useful for accessibility).
-
-
- zIndexOffset
- Number
- 0
- By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
-
-
- opacity
- Number
- 1.0
- The opacity of the marker.
-
-
- riseOnHover
- Boolean
- false
- If true, the marker will get on top of others when you hover the mouse over it.
-
-
- riseOffset
- Number
- 250
- The z-index offset used for the riseOnHover feature.
-
-
- pane
- String
- 'markerPane'
- Map pane where the markers icon will be added.
-
-
- bubblingMouseEvents
- Boolean
- false
- When true, a mouse event on this marker will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-In addition to shared layer methods like addTo() and remove() and popup methods like bindPopup() you can also use the following methods:
-
-
-
- Event
- Data
- Description
-
-
-
- move
- Event
- Fired when the marker is moved via setLatLng or by dragging. Old and new coordinates are included in event arguments as oldLatLng, latlng.
-
-
-
-
-
-Dragging events
-
-
-
-
- Event
- Data
- Description
-
-
-
- dragstart
- Event
- Fired when the user starts dragging the marker.
-
-
- movestart
- Event
- Fired when the marker starts moving (because of dragging).
-
-
- drag
- Event
- Fired repeatedly while the user drags the marker.
-
-
- dragend
- DragEndEvent
- Fired when the user stops dragging the marker.
-
-
- moveend
- Event
- Fired when the marker stops moving (because of dragging).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the marker (as a GeoJSON Point Feature).
-
-
-
- getLatLng()
- LatLng
- Returns the current geographical position of the marker.
-
-
-
- setLatLng(<LatLng> latlng)
- this
- Changes the marker position to the given point.
-
-
-
- setZIndexOffset(<Number> offset)
- this
- Changes the zIndex offset of the marker.
-
-
-
- setIcon(<Icon> icon)
- this
- Changes the marker icon.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the marker.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Properties
-
-
-
-Interaction handlers
-
-Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see Handler methods). Example:
-marker.dragging.disable();
-
-
-
-
- Property
- Type
- Description
-
-
-
- dragging
- Handler
- Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set marker.options.draggable).
-
-
-
-
-
-
- Popup
Used to open popups in certain places of the map. Use Map.openPopup to
-open popups while making sure that only one popup is open at one time
-(recommended for usability), or use Map.addLayer to open as many as you want.
-
-
-Usage example
-
-
-
-
-
-
-
-If you want to just bind a popup to marker click and then open it, it's really easy:
-marker.bindPopup(popupContent).openPopup();
-
-Path overlays like polylines also have a bindPopup method.
-Here's a more complicated way to open a popup on a map:
-var popup = L.popup()
- .setLatLng(latlng)
- .setContent('<p>Hello world!<br />This is a nice popup.</p>')
- .openOn(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.popup(<Popup options> options?, <Layer> source?)
- Instantiates a Popup object given an optional options object that describes its appearance and location and an optional source object that is used to tag the popup with a reference to the Layer to which it refers.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- maxWidth
- Number
- 300
- Max width of the popup, in pixels.
-
-
- minWidth
- Number
- 50
- Min width of the popup, in pixels.
-
-
- maxHeight
- Number
- null
- If set, creates a scrollable container of the given height
-inside a popup if its content exceeds it.
-
-
- autoPan
- Boolean
- true
- Set it to false if you don't want the map to do panning animation
-to fit the opened popup.
-
-
- autoPanPaddingTopLeft
- Point
- null
- The margin between the popup and the top left corner of the map
-view after autopanning was performed.
-
-
- autoPanPaddingBottomRight
- Point
- null
- The margin between the popup and the bottom right corner of the map
-view after autopanning was performed.
-
-
- autoPanPadding
- Point
- Point(5, 5)
- Equivalent of setting both top left and bottom right autopan padding to the same value.
-
-
- keepInView
- Boolean
- false
- Set it to true if you want to prevent users from panning the popup
-off of the screen while it is open.
-
-
- closeButton
- Boolean
- true
- Controls the presence of a close button in the popup.
-
-
- autoClose
- Boolean
- true
- Set it to false if you want to override the default behavior of
-the popup closing when another popup is opened.
-
-
- closeOnEscapeKey
- Boolean
- true
- Set it to false if you want to override the default behavior of
-the ESC key for closing of the popup.
-
-
- closeOnClick
- Boolean
- *
- Set it if you want to override the default behavior of the popup closing when user clicks
-on the map. Defaults to the map's closePopupOnClick option.
-
-
- className
- String
- ''
- A custom CSS class name to assign to the popup.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- offset
- Point
- Point(0, 7)
- The offset of the popup position. Useful to control the anchor
-of the popup when opening it on some overlays.
-
-
- pane
- String
- 'popupPane'
- Map pane where the popup will be added.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getLatLng()
- LatLng
- Returns the geographical point of popup.
-
-
-
- setLatLng(<LatLng> latlng)
- this
- Sets the geographical point where the popup will open.
-
-
-
- getContent()
- String|HTMLElement
- Returns the content of the popup.
-
-
-
- setContent(<String|HTMLElement|Function> htmlContent)
- this
- Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a String or HTMLElement to be used in the popup.
-
-
-
- getElement()
- String|HTMLElement
- Alias for getContent()
-
-
-
- update()
- null
- Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
-
-
-
- isOpen()
- Boolean
- Returns true when the popup is visible on the map.
-
-
-
- bringToFront()
- this
- Brings this popup in front of other popups (in the same map pane).
-
-
-
- bringToBack()
- this
- Brings this popup to the back of other popups (in the same map pane).
-
-
-
- openOn(<Map> map)
- this
- Adds the popup to the map and closes the previous one. The same as map.openPopup(popup).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Tooltip
Used to display small texts on top of map layers.
-
-
-Usage example
-
-
-
-
-
-
-
-marker.bindTooltip("my tooltip text").openTooltip();
-
-Note about tooltip offset. Leaflet takes two options in consideration
-for computing tooltip offsetting:
-
-- the
offset Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
-Add a positive x offset to move the tooltip to the right, and a positive y offset to
-move it to the bottom. Negatives will move to the left and top.
-- the
tooltipAnchor Icon option: this will only be considered for Marker. You
-should adapt this value if you use a custom icon.
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.tooltip(<Tooltip options> options?, <Layer> source?)
- Instantiates a Tooltip object given an optional options object that describes its appearance and location and an optional source object that is used to tag the tooltip with a reference to the Layer to which it refers.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'tooltipPane'
- Map pane where the tooltip will be added.
-
-
- offset
- Point
- Point(0, 0)
- Optional offset of the tooltip position.
-
-
- direction
- String
- 'auto'
- Direction where to open the tooltip. Possible values are: right, left,
-top, bottom, center, auto.
-auto will dynamically switch between right and left according to the tooltip
-position on the map.
-
-
- permanent
- Boolean
- false
- Whether to open the tooltip permanently or only on mouseover.
-
-
- sticky
- Boolean
- false
- If true, the tooltip will follow the mouse instead of being fixed at the feature center.
-
-
- interactive
- Boolean
- false
- If true, the tooltip will listen to the feature events.
-
-
- opacity
- Number
- 0.9
- Tooltip container opacity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- className
- String
- ''
- A custom CSS class name to assign to the popup.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- TileLayer
Used to load and display tile layers on the map. Extends GridLayer.
-
-
-Usage example
-
-
-
-
-
-
-
-L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar'}).addTo(map);
-
-
-
-
-
-
-URL template
-
-
-
-A string of the following form:
-'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'
-
{s} means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; a, b or c by default, can be omitted), {z} — zoom level, {x} and {y} — tile coordinates. {r} can be used to add "@2x" to the URL to load retina tiles.
-You can use custom keys in the template, which will be evaluated from TileLayer options, like this:
-L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});
-
-
-
-
-
-
-
-Creation
-
-
-
-Extension methods
-
-
-
-
- Factory
- Description
-
-
-
- L.tilelayer(<String> urlTemplate, <TileLayer options> options?)
- Instantiates a tile layer object given a URL template and optionally an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- minZoom
- Number
- 0
- The minimum zoom level down to which this layer will be displayed (inclusive).
-
-
- maxZoom
- Number
- 18
- The maximum zoom level up to which this layer will be displayed (inclusive).
-
-
- subdomains
- String|String[]
- 'abc'
- Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
-
-
- errorTileUrl
- String
- ''
- URL to the tile image to show in place of the tile that failed to load.
-
-
- zoomOffset
- Number
- 0
- The zoom number used in tile URLs will be offset with this value.
-
-
- tms
- Boolean
- false
- If true, inverses Y axis numbering for tiles (turn this on for TMS services).
-
-
- zoomReverse
- Boolean
- false
- If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
-
-
- detectRetina
- Boolean
- false
- If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
-
-
- crossOrigin
- Boolean|String
- false
- Whether the crossOrigin attribute will be added to the tiles.
-If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
-Refer to CORS Settings for valid String values.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tileSize
- Number|Point
- 256
- Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
-
-
- opacity
- Number
- 1.0
- Opacity of the tiles. Can be used in the createTile() function.
-
-
- updateWhenIdle
- Boolean
- (depends)
- Load new tiles only when panning ends.
-true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-false otherwise in order to display new tiles during panning, since it is easy to pan outside the
-keepBuffer option in desktop browsers.
-
-
- updateWhenZooming
- Boolean
- true
- By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
-
-
- updateInterval
- Number
- 200
- Tiles will not update more than once every updateInterval milliseconds when panning.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- bounds
- LatLngBounds
- undefined
- If set, tiles will only be loaded inside the set LatLngBounds.
-
-
- maxNativeZoom
- Number
- undefined
- Maximum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels higher than maxNativeZoom will be loaded
-from maxNativeZoom level and auto-scaled.
-
-
- minNativeZoom
- Number
- undefined
- Minimum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels lower than minNativeZoom will be loaded
-from minNativeZoom level and auto-scaled.
-
-
- noWrap
- Boolean
- false
- Whether the layer is wrapped around the antimeridian. If true, the
-GridLayer will only be displayed once at low zoom levels. Has no
-effect when the map CRS doesn't wrap around. Can be used
-in combination with bounds to prevent requesting
-tiles outside the CRS limits.
-
-
- pane
- String
- 'tilePane'
- Map pane where the grid layer will be added.
-
-
- className
- String
- ''
- A custom class name to assign to the tile layer. Empty by default.
-
-
- keepBuffer
- Number
- 2
- When panning the map, keep this many rows and columns of tiles before unloading them.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- loading
- Event
- Fired when the grid layer starts loading tiles.
-
-
- tileunload
- TileEvent
- Fired when a tile is removed (e.g. when a tile goes off the screen).
-
-
- tileloadstart
- TileEvent
- Fired when a tile is requested and starts loading.
-
-
- tileerror
- TileErrorEvent
- Fired when there is an error loading a tile.
-
-
- tileload
- TileEvent
- Fired when a tile loads.
-
-
- load
- Event
- Fired when the grid layer loaded all visible tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setUrl(<String> url, <Boolean> noRedraw?)
- this
- Updates the layer's URL template and redraws it (unless noRedraw is set to true).
-
-
-
- createTile(<Object> coords, <Function> done?)
- HTMLElement
- Called only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropriate image URL given coords. The done
-callback is called when the tile has been loaded.
-
-
-
-
-
-
-Extension methods
-
-Layers extending TileLayer might reimplement the following method.
-
-
-
- Method
- Returns
- Description
-
-
-
- getTileUrl(<Object> coords)
- String
- Called only internally, returns the URL for a tile given its coordinates.
-Classes extending TileLayer can override this function to provide custom tile URL naming schemes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the tile layer to the top of all tile layers.
-
-
-
- bringToBack()
- this
- Brings the tile layer to the bottom of all tile layers.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the tiles for this layer.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the grid layer.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Changes the zIndex of the grid layer.
-
-
-
- isLoading()
- Boolean
- Returns true if any tile in the grid layer has not finished loading.
-
-
-
- redraw()
- this
- Causes the layer to clear all the tiles and request them again.
-
-
-
- getTileSize()
- Point
- Normalizes the tileSize option into a point. Used by the createTile() method.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- TileLayer.WMS
Used to display WMS services as tile layers on the map. Extends TileLayer.
-
-
-Usage example
-
-
-
-
-
-
-
-var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", {
- layers: 'nexrad-n0r-900913',
- format: 'image/png',
- transparent: true,
- attribution: "Weather data © 2012 IEM Nexrad"
-});
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.tileLayer.wms(<String> baseUrl, <TileLayer.WMS options> options)
- Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-If any custom options not documented here are used, they will be sent to the
-WMS server as extra parameters in each request URL. This can be useful for
-non-standard vendor WMS parameters.
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- layers
- String
- ''
- (required) Comma-separated list of WMS layers to show.
-
-
- styles
- String
- ''
- Comma-separated list of WMS styles.
-
-
- format
- String
- 'image/jpeg'
- WMS image format (use 'image/png' for layers with transparency).
-
-
- transparent
- Boolean
- false
- If true, the WMS service will return images with transparency.
-
-
- version
- String
- '1.1.1'
- Version of the WMS service to use
-
-
- crs
- CRS
- null
- Coordinate Reference System to use for the WMS requests, defaults to
-map CRS. Don't change this if you're not sure what it means.
-
-
- uppercase
- Boolean
- false
- If true, WMS request parameter keys will be uppercase.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- minZoom
- Number
- 0
- The minimum zoom level down to which this layer will be displayed (inclusive).
-
-
- maxZoom
- Number
- 18
- The maximum zoom level up to which this layer will be displayed (inclusive).
-
-
- subdomains
- String|String[]
- 'abc'
- Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
-
-
- errorTileUrl
- String
- ''
- URL to the tile image to show in place of the tile that failed to load.
-
-
- zoomOffset
- Number
- 0
- The zoom number used in tile URLs will be offset with this value.
-
-
- tms
- Boolean
- false
- If true, inverses Y axis numbering for tiles (turn this on for TMS services).
-
-
- zoomReverse
- Boolean
- false
- If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
-
-
- detectRetina
- Boolean
- false
- If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
-
-
- crossOrigin
- Boolean|String
- false
- Whether the crossOrigin attribute will be added to the tiles.
-If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
-Refer to CORS Settings for valid String values.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tileSize
- Number|Point
- 256
- Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
-
-
- opacity
- Number
- 1.0
- Opacity of the tiles. Can be used in the createTile() function.
-
-
- updateWhenIdle
- Boolean
- (depends)
- Load new tiles only when panning ends.
-true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-false otherwise in order to display new tiles during panning, since it is easy to pan outside the
-keepBuffer option in desktop browsers.
-
-
- updateWhenZooming
- Boolean
- true
- By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
-
-
- updateInterval
- Number
- 200
- Tiles will not update more than once every updateInterval milliseconds when panning.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- bounds
- LatLngBounds
- undefined
- If set, tiles will only be loaded inside the set LatLngBounds.
-
-
- maxNativeZoom
- Number
- undefined
- Maximum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels higher than maxNativeZoom will be loaded
-from maxNativeZoom level and auto-scaled.
-
-
- minNativeZoom
- Number
- undefined
- Minimum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels lower than minNativeZoom will be loaded
-from minNativeZoom level and auto-scaled.
-
-
- noWrap
- Boolean
- false
- Whether the layer is wrapped around the antimeridian. If true, the
-GridLayer will only be displayed once at low zoom levels. Has no
-effect when the map CRS doesn't wrap around. Can be used
-in combination with bounds to prevent requesting
-tiles outside the CRS limits.
-
-
- pane
- String
- 'tilePane'
- Map pane where the grid layer will be added.
-
-
- className
- String
- ''
- A custom class name to assign to the tile layer. Empty by default.
-
-
- keepBuffer
- Number
- 2
- When panning the map, keep this many rows and columns of tiles before unloading them.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- loading
- Event
- Fired when the grid layer starts loading tiles.
-
-
- tileunload
- TileEvent
- Fired when a tile is removed (e.g. when a tile goes off the screen).
-
-
- tileloadstart
- TileEvent
- Fired when a tile is requested and starts loading.
-
-
- tileerror
- TileErrorEvent
- Fired when there is an error loading a tile.
-
-
- tileload
- TileEvent
- Fired when a tile loads.
-
-
- load
- Event
- Fired when the grid layer loaded all visible tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setParams(<Object> params, <Boolean> noRedraw?)
- this
- Merges an object with the new parameters and re-requests tiles on the current screen (unless noRedraw was set to true).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setUrl(<String> url, <Boolean> noRedraw?)
- this
- Updates the layer's URL template and redraws it (unless noRedraw is set to true).
-
-
-
- createTile(<Object> coords, <Function> done?)
- HTMLElement
- Called only internally, overrides GridLayer's createTile()
-to return an <img> HTML element with the appropriate image URL given coords. The done
-callback is called when the tile has been loaded.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the tile layer to the top of all tile layers.
-
-
-
- bringToBack()
- this
- Brings the tile layer to the bottom of all tile layers.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the tiles for this layer.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the grid layer.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Changes the zIndex of the grid layer.
-
-
-
- isLoading()
- Boolean
- Returns true if any tile in the grid layer has not finished loading.
-
-
-
- redraw()
- this
- Causes the layer to clear all the tiles and request them again.
-
-
-
- getTileSize()
- Point
- Normalizes the tileSize option into a point. Used by the createTile() method.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- ImageOverlay
Used to load and display a single image over specific bounds of the map. Extends Layer.
-
-
-Usage example
-
-
-
-
-
-
-
-var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
- imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
-L.imageOverlay(imageUrl, imageBounds).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.imageOverlay(<String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options?)
- Instantiates an image overlay object given the URL of the image and the
-geographical bounds it is tied to.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- opacity
- Number
- 1.0
- The opacity of the image overlay.
-
-
- alt
- String
- ''
- Text for the alt attribute of the image (useful for accessibility).
-
-
- interactive
- Boolean
- false
- If true, the image overlay will emit mouse events when clicked or hovered.
-
-
- crossOrigin
- Boolean|String
- false
- Whether the crossOrigin attribute will be added to the image.
-If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
-Refer to CORS Settings for valid String values.
-
-
- errorOverlayUrl
- String
- ''
- URL to the overlay image to show in place of the overlay that failed to load.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- className
- String
- ''
- A custom class name to assign to the image. Empty by default.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this layer will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- load
- Event
- Fired when the ImageOverlay layer has loaded its image
-
-
- error
- Event
- Fired when the ImageOverlay layer has loaded its image
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setOpacity(<Number> opacity)
- this
- Sets the opacity of the overlay.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all overlays.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all overlays.
-
-
-
- setUrl(<String> url)
- this
- Changes the URL of the image.
-
-
-
- setBounds(<LatLngBounds> bounds)
- this
- Update the bounds that this ImageOverlay covers
-Changes the zIndex of the image overlay.
-
-
-
- getBounds()
- LatLngBounds
- Get the bounds that this ImageOverlay covers
-
-
-
- getElement()
- HTMLElement
- Returns the instance of HTMLImageElement
-used by this overlay.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- VideoOverlay
Used to load and display a video player over specific bounds of the map. Extends ImageOverlay.
-A video overlay uses the <video>
-HTML5 element.
-
-
-Usage example
-
-
-
-
-
-
-
-var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
- videoBounds = [[ 32, -130], [ 13, -100]];
-L.videoOverlay(videoUrl, videoBounds ).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.videoOverlay(<String|Array|HTMLVideoElement> video, <LatLngBounds> bounds, <VideoOverlay options> options?)
- Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
-geographical bounds it is tied to.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- autoplay
- Boolean
- true
- Whether the video starts playing automatically when loaded.
-
-
- loop
- Boolean
- true
- Whether the video will loop back to the beginning when played.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- opacity
- Number
- 1.0
- The opacity of the image overlay.
-
-
- alt
- String
- ''
- Text for the alt attribute of the image (useful for accessibility).
-
-
- interactive
- Boolean
- false
- If true, the image overlay will emit mouse events when clicked or hovered.
-
-
- crossOrigin
- Boolean|String
- false
- Whether the crossOrigin attribute will be added to the image.
-If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
-Refer to CORS Settings for valid String values.
-
-
- errorOverlayUrl
- String
- ''
- URL to the overlay image to show in place of the overlay that failed to load.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- className
- String
- ''
- A custom class name to assign to the image. Empty by default.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this layer will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- load
- Event
- Fired when the video has finished loading the first frame
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- error
- Event
- Fired when the ImageOverlay layer has loaded its image
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getElement()
- HTMLVideoElement
- Returns the instance of HTMLVideoElement
-used by this overlay.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setOpacity(<Number> opacity)
- this
- Sets the opacity of the overlay.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all overlays.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all overlays.
-
-
-
- setUrl(<String> url)
- this
- Changes the URL of the image.
-
-
-
- setBounds(<LatLngBounds> bounds)
- this
- Update the bounds that this ImageOverlay covers
-Changes the zIndex of the image overlay.
-
-
-
- getBounds()
- LatLngBounds
- Get the bounds that this ImageOverlay covers
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Path
An abstract class that contains options and constants shared between vector
-overlays (Polygon, Polyline, Circle). Do not use it directly. Extends Layer.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Polyline
A class for drawing polyline overlays on a map. Extends Path.
-
-
-Usage example
-
-
-
-
-
-
-
-// create a red polyline from an array of LatLng points
-var latlngs = [
- [45.51, -122.68],
- [37.77, -122.43],
- [34.04, -118.2]
-];
-var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
-// zoom the map to the polyline
-map.fitBounds(polyline.getBounds());
-
-You can also pass a multi-dimensional array to represent a MultiPolyline shape:
-// create a red polyline from an array of arrays of LatLng points
-var latlngs = [
- [[45.51, -122.68],
- [37.77, -122.43],
- [34.04, -118.2]],
- [[40.78, -73.91],
- [41.83, -87.62],
- [32.76, -96.72]]
-];
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.polyline(<LatLng[]> latlngs, <Polyline options> options?)
- Instantiates a polyline object given an array of geographical points and
-optionally an options object. You can create a Polyline object with
-multiple separate lines (MultiPolyline) by passing an array of arrays
-of geographic points.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- smoothFactor
- Number
- 1.0
- How much to simplify the polyline on each zoom level. More means
-better performance and smoother look, and less means more accurate representation.
-
-
- noClip
- Boolean
- false
- Disable polyline clipping.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the polyline (as a GeoJSON LineString or MultiLineString Feature).
-
-
-
- getLatLngs()
- LatLng[]
- Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-
-
-
- setLatLngs(<LatLng[]> latlngs)
- this
- Replaces all the points in the polyline with the given array of geographical points.
-
-
-
- isEmpty()
- Boolean
- Returns true if the Polyline has no LatLngs.
-
-
-
- closestLayerPoint(<Point> p)
- Point
- Returns the point closest to p on the Polyline.
-
-
-
- getCenter()
- LatLng
- Returns the center (centroid) of the polyline.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
- addLatLng(<LatLng> latlng)
- this
- Adds a given point to the polyline. By default, adds to the first ring of
-the polyline in case of a multi-polyline, but can be overridden by passing
-a specific ring as a LatLng array (that you can earlier access with getLatLngs).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Polygon
A class for drawing polygon overlays on a map. Extends Polyline.
-Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
-
-
-Usage example
-
-
-
-
-
-
-
-// create a red polygon from an array of LatLng points
-var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
-var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
-// zoom the map to the polygon
-map.fitBounds(polygon.getBounds());
-
-You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
-var latlngs = [
- [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
- [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
-];
-
-Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
-var latlngs = [
- [ // first polygon
- [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
- [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
- ],
- [ // second polygon
- [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
- ]
-];
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.polygon(<LatLng[]> latlngs, <Polyline options> options?)
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- smoothFactor
- Number
- 1.0
- How much to simplify the polyline on each zoom level. More means
-better performance and smoother look, and less means more accurate representation.
-
-
- noClip
- Boolean
- false
- Disable polyline clipping.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the polygon (as a GeoJSON Polygon or MultiPolygon Feature).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getLatLngs()
- LatLng[]
- Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-
-
-
- setLatLngs(<LatLng[]> latlngs)
- this
- Replaces all the points in the polyline with the given array of geographical points.
-
-
-
- isEmpty()
- Boolean
- Returns true if the Polyline has no LatLngs.
-
-
-
- closestLayerPoint(<Point> p)
- Point
- Returns the point closest to p on the Polyline.
-
-
-
- getCenter()
- LatLng
- Returns the center (centroid) of the polyline.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
- addLatLng(<LatLng> latlng)
- this
- Adds a given point to the polyline. By default, adds to the first ring of
-the polyline in case of a multi-polyline, but can be overridden by passing
-a specific ring as a LatLng array (that you can earlier access with getLatLngs).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Rectangle
A class for drawing rectangle overlays on a map. Extends Polygon.
-
-
-Usage example
-
-
-
-
-
-
-
-// define rectangle geographical bounds
-var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
-// create an orange rectangle
-L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
-// zoom the map to the rectangle bounds
-map.fitBounds(bounds);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.rectangle(<LatLngBounds> latLngBounds, <Polyline options> options?)
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- smoothFactor
- Number
- 1.0
- How much to simplify the polyline on each zoom level. More means
-better performance and smoother look, and less means more accurate representation.
-
-
- noClip
- Boolean
- false
- Disable polyline clipping.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setBounds(<LatLngBounds> latLngBounds)
- this
- Redraws the rectangle with the passed bounds.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getLatLngs()
- LatLng[]
- Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-
-
-
- setLatLngs(<LatLng[]> latlngs)
- this
- Replaces all the points in the polyline with the given array of geographical points.
-
-
-
- isEmpty()
- Boolean
- Returns true if the Polyline has no LatLngs.
-
-
-
- closestLayerPoint(<Point> p)
- Point
- Returns the point closest to p on the Polyline.
-
-
-
- getCenter()
- LatLng
- Returns the center (centroid) of the polyline.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
- addLatLng(<LatLng> latlng)
- this
- Adds a given point to the polyline. By default, adds to the first ring of
-the polyline in case of a multi-polyline, but can be overridden by passing
-a specific ring as a LatLng array (that you can earlier access with getLatLngs).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Circle
A class for drawing circle overlays on a map. Extends CircleMarker.
-It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).
-
-
-Usage example
-
-
-
-
-
-
-
-L.circle([50.5, 30.5], {radius: 200}).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.circle(<LatLng> latlng, <Circle options> options?)
- Instantiates a circle object given a geographical point, and an options object
-which contains the circle radius.
-
-
- L.circle(<LatLng> latlng, <Number> radius, <Circle options> options?)
- Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
-Do not use in new applications or plugins.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- radius
- Number
-
- Radius of the circle, in meters.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setRadius(<Number> radius)
- this
- Sets the radius of a circle. Units are in meters.
-
-
-
- getRadius()
- Number
- Returns the current radius of a circle. Units are in meters.
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the path.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
-
-
-
- setLatLng(<LatLng> latLng)
- this
- Sets the position of a circle marker to a new location.
-
-
-
- getLatLng()
- LatLng
- Returns the current geographical position of the circle marker
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- CircleMarker
A circle of a fixed size with radius specified in pixels. Extends Path.
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.circleMarker(<LatLng> latlng, <CircleMarker options> options?)
- Instantiates a circle marker object given a geographical point, and an optional options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- radius
- Number
- 10
- Radius of the circle marker, in pixels
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- stroke
- Boolean
- true
- Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
-
-
- color
- String
- '#3388ff'
- Stroke color
-
-
- weight
- Number
- 3
- Stroke width in pixels
-
-
- opacity
- Number
- 1.0
- Stroke opacity
-
-
- lineCap
- String
- 'round'
- A string that defines shape to be used at the end of the stroke.
-
-
- lineJoin
- String
- 'round'
- A string that defines shape to be used at the corners of the stroke.
-
-
- dashArray
- String
- null
- A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- dashOffset
- String
- null
- A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
-
-
- fill
- Boolean
- depends
- Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
-
-
- fillColor
- String
- *
- Fill color. Defaults to the value of the color option
-
-
- fillOpacity
- Number
- 0.2
- Fill opacity.
-
-
- fillRule
- String
- 'evenodd'
- A string that defines how the inside of a shape is determined.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this path will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
- renderer
- Renderer
-
- Use this specific instance of Renderer for this path. Takes
-precedence over the map's default renderer.
-
-
- className
- String
- null
- Custom class name set on an element. Only for SVG renderer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
-
-
-
- setLatLng(<LatLng> latLng)
- this
- Sets the position of a circle marker to a new location.
-
-
-
- getLatLng()
- LatLng
- Returns the current geographical position of the circle marker
-
-
-
- setRadius(<Number> radius)
- this
- Sets the radius of a circle marker. Units are in pixels.
-
-
-
- getRadius()
- Number
- Returns the current radius of the circle
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- redraw()
- this
- Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-
-
-
- setStyle(<Path options> style)
- this
- Changes the appearance of a Path based on the options in the Path options object.
-
-
-
- bringToFront()
- this
- Brings the layer to the top of all path layers.
-
-
-
- bringToBack()
- this
- Brings the layer to the bottom of all path layers.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- SVG
Allows vector layers to be displayed with SVG.
-Inherits Renderer.
-Due to technical limitations, SVG is not
-available in all web browsers, notably Android 2.x and 3.x.
-Although SVG is not available on IE7 and IE8, these browsers support
-VML
-(a now deprecated technology), and the SVG renderer will fall back to VML in
-this case.
-Although SVG is not available on IE7 and IE8, these browsers support VML, and the SVG renderer will fall back to VML in this case.
-VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
-with old versions of Internet Explorer.
-
-
-Usage example
-
-
-
-
-
-
-
-Use SVG by default for all paths in the map:
-var map = L.map('map', {
- renderer: L.svg()
-});
-
-Use a SVG renderer with extra padding for specific vector geometries:
-var map = L.map('map');
-var myRenderer = L.svg({ padding: 0.5 });
-var line = L.polyline( coordinates, { renderer: myRenderer } );
-var circle = L.circle( center, { renderer: myRenderer } );
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.svg(<Renderer options> options?)
- Creates a SVG renderer with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- padding
- Number
- 0.1
- How much to extend the clip area around the map view (relative to its size)
-e.g. 0.1 would be 10% of map view in each direction
-
-
- tolerance
- Number
- 0
- How much to extend click tolerance round a path/object on the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- update
- Event
- Fired when the renderer updates its bounds, center and zoom, for example when
-its map has moved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-There are several static functions which can be called without instantiating L.SVG:
-
-
-
- Function
- Returns
- Description
-
-
-
- create(<String> name)
- SVGElement
- Returns a instance of SVGElement,
-corresponding to the class name passed. For example, using 'line' will return
-an instance of SVGLineElement.
-
-
- pointsToPath(<Point[]> rings, <Boolean> closed)
- String
- Generates a SVG path string for multiple rings, with each ring turning
-into "M..L..L.." instructions
-
-
-
-
-
-
- Canvas
Allows vector layers to be displayed with <canvas>.
-Inherits Renderer.
-Due to technical limitations, Canvas is not
-available in all web browsers, notably IE8, and overlapping geometries might
-not display properly in some edge cases.
-
-
-Usage example
-
-
-
-
-
-
-
-Use Canvas by default for all paths in the map:
-var map = L.map('map', {
- renderer: L.canvas()
-});
-
-Use a Canvas renderer with extra padding for specific vector geometries:
-var map = L.map('map');
-var myRenderer = L.canvas({ padding: 0.5 });
-var line = L.polyline( coordinates, { renderer: myRenderer } );
-var circle = L.circle( center, { renderer: myRenderer } );
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.canvas(<Renderer options> options?)
- Creates a Canvas renderer with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- padding
- Number
- 0.1
- How much to extend the clip area around the map view (relative to its size)
-e.g. 0.1 would be 10% of map view in each direction
-
-
- tolerance
- Number
- 0
- How much to extend click tolerance round a path/object on the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- update
- Event
- Fired when the renderer updates its bounds, center and zoom, for example when
-its map has moved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- LayerGroup
Used to group several layers and handle them as one. If you add it to the map,
-any layers added or removed from the group will be added/removed on the map as
-well. Extends Layer.
-
-
-Usage example
-
-
-
-
-
-
-
-L.layerGroup([marker1, marker2])
- .addLayer(polyline)
- .addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.layerGroup(<Layer[]> layers?, <Object> options?)
- Create a layer group, optionally given an initial set of layers and an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the group.
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the group.
-
-
-
- removeLayer(<Number> id)
- this
- Removes the layer with the given internal ID from the group.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the group.
-
-
-
- hasLayer(<Number> id)
- Boolean
- Returns true if the given internal ID is currently added to the group.
-
-
-
- clearLayers()
- this
- Removes all the layers from the group.
-
-
-
- invoke(<String> methodName, …)
- this
- Calls methodName on every layer contained in this group, passing any
-additional parameters. Has no effect if the layers contained do not
-implement methodName.
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the group, optionally specifying context of the iterator function.
-group.eachLayer(function (layer) {
- layer.bindPopup('Hello');
-});
-
-
-
-
- getLayer(<Number> id)
- Layer
- Returns the layer with the given internal ID.
-
-
-
- getLayers()
- Layer[]
- Returns an array of all the layers added to the group.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Calls setZIndex on every layer contained in this group, passing the z-index.
-
-
-
- getLayerId(<Layer> layer)
- Number
- Returns the internal ID for a layer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- FeatureGroup
Extended LayerGroup that makes it easier to do the same thing to all its member layers:
-
-bindPopup binds a popup to all of the layers at once (likewise with bindTooltip)
-- Events are propagated to the
FeatureGroup, so if the group has an event
-handler, it will handle events from any of the layers. This includes mouse events
-and custom events.
-- Has
layeradd and layerremove events
-
-
-
-Usage example
-
-
-
-
-
-
-
-L.featureGroup([marker1, marker2, polyline])
- .bindPopup('Hello world!')
- .on('click', function() { alert('Clicked on a member of the group!'); })
- .addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.featureGroup(<Layer[]> layers)
- Create a feature group, optionally given an initial set of layers.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- layeradd
- LayerEvent
- Fired when a layer is added to this FeatureGroup
-
-
- layerremove
- LayerEvent
- Fired when a layer is removed from this FeatureGroup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setStyle(<Path options> style)
- this
- Sets the given path options to each layer of the group that has a setStyle method.
-
-
-
- bringToFront()
- this
- Brings the layer group to the top of all other layers
-
-
-
- bringToBack()
- this
- Brings the layer group to the back of all other layers
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the group.
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the group.
-
-
-
- removeLayer(<Number> id)
- this
- Removes the layer with the given internal ID from the group.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the group.
-
-
-
- hasLayer(<Number> id)
- Boolean
- Returns true if the given internal ID is currently added to the group.
-
-
-
- clearLayers()
- this
- Removes all the layers from the group.
-
-
-
- invoke(<String> methodName, …)
- this
- Calls methodName on every layer contained in this group, passing any
-additional parameters. Has no effect if the layers contained do not
-implement methodName.
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the group, optionally specifying context of the iterator function.
-group.eachLayer(function (layer) {
- layer.bindPopup('Hello');
-});
-
-
-
-
- getLayer(<Number> id)
- Layer
- Returns the layer with the given internal ID.
-
-
-
- getLayers()
- Layer[]
- Returns an array of all the layers added to the group.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Calls setZIndex on every layer contained in this group, passing the z-index.
-
-
-
- getLayerId(<Layer> layer)
- Number
- Returns the internal ID for a layer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- GeoJSON
Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse
-GeoJSON data and display it on the map. Extends FeatureGroup.
-
-
-Usage example
-
-
-
-
-
-
-
-L.geoJSON(data, {
- style: function (feature) {
- return {color: feature.properties.color};
- }
-}).bindPopup(function (layer) {
- return layer.feature.properties.description;
-}).addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.geoJSON(<Object> geojson?, <GeoJSON options> options?)
- Creates a GeoJSON layer. Optionally accepts an object in
-GeoJSON format to display on the map
-(you can alternatively add it later with addData method) and an options object.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pointToLayer
- Function
- *
- A Function defining how GeoJSON points spawn Leaflet layers. It is internally
-called when data is added, passing the GeoJSON point feature and its LatLng.
-The default is to spawn a default Marker:
-function(geoJsonPoint, latlng) {
- return L.marker(latlng);
-}
-
-
-
- style
- Function
- *
- A Function defining the Path options for styling GeoJSON lines and polygons,
-called internally when data is added.
-The default value is to not override any defaults:
-function (geoJsonFeature) {
- return {}
-}
-
-
-
- onEachFeature
- Function
- *
- A Function that will be called once for each created Feature, after it has
-been created and styled. Useful for attaching events and popups to features.
-The default is to do nothing with the newly created layers:
-function (feature, layer) {}
-
-
-
- filter
- Function
- *
- A Function that will be used to decide whether to include a feature or not.
-The default is to include all features:
-function (geoJsonFeature) {
- return true;
-}
-
-Note: dynamically changing the filter option will have effect only on newly
-added data. It will not re-evaluate already included features.
-
-
- coordsToLatLng
- Function
- *
- A Function that will be used for converting GeoJSON coordinates to LatLngs.
-The default is the coordsToLatLng static method.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- layeradd
- LayerEvent
- Fired when a layer is added to this FeatureGroup
-
-
- layerremove
- LayerEvent
- Fired when a layer is removed from this FeatureGroup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addData(data)
- this
- Adds a GeoJSON object to the layer.
-
-
-
- resetStyle(layer)
- this
- Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
-
-
-
- setStyle(style)
- this
- Changes styles of GeoJSON vector layers with the given style function.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the layer group to the top of all other layers
-
-
-
- bringToBack()
- this
- Brings the layer group to the back of all other layers
-
-
-
- getBounds()
- LatLngBounds
- Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- toGeoJSON()
- Object
- Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
-
-
-
- addLayer(<Layer> layer)
- this
- Adds the given layer to the group.
-
-
-
- removeLayer(<Layer> layer)
- this
- Removes the given layer from the group.
-
-
-
- removeLayer(<Number> id)
- this
- Removes the layer with the given internal ID from the group.
-
-
-
- hasLayer(<Layer> layer)
- Boolean
- Returns true if the given layer is currently added to the group.
-
-
-
- hasLayer(<Number> id)
- Boolean
- Returns true if the given internal ID is currently added to the group.
-
-
-
- clearLayers()
- this
- Removes all the layers from the group.
-
-
-
- invoke(<String> methodName, …)
- this
- Calls methodName on every layer contained in this group, passing any
-additional parameters. Has no effect if the layers contained do not
-implement methodName.
-
-
-
- eachLayer(<Function> fn, <Object> context?)
- this
- Iterates over the layers of the group, optionally specifying context of the iterator function.
-group.eachLayer(function (layer) {
- layer.bindPopup('Hello');
-});
-
-
-
-
- getLayer(<Number> id)
- Layer
- Returns the layer with the given internal ID.
-
-
-
- getLayers()
- Layer[]
- Returns an array of all the layers added to the group.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Calls setZIndex on every layer contained in this group, passing the z-index.
-
-
-
- getLayerId(<Layer> layer)
- Number
- Returns the internal ID for a layer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-There are several static functions which can be called without instantiating L.GeoJSON:
-
-
-
- Function
- Returns
- Description
-
-
-
- geometryToLayer(<Object> featureData, <GeoJSON options> options?)
- Layer
- Creates a Layer from a given GeoJSON feature. Can use a custom
-pointToLayer and/or coordsToLatLng
-functions if provided as options.
-
-
- coordsToLatLng(<Array> coords)
- LatLng
- Creates a LatLng object from an array of 2 numbers (longitude, latitude)
-or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
-
-
- coordsToLatLngs(<Array> coords, <Number> levelsDeep?, <Function> coordsToLatLng?)
- Array
- Creates a multidimensional array of LatLngs from a GeoJSON coordinates array.
-levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).
-Can use a custom coordsToLatLng function.
-
-
- latLngToCoords(<LatLng> latlng, <Number> precision?)
- Array
- Reverse of coordsToLatLng
-
-
- latLngsToCoords(<Array> latlngs, <Number> levelsDeep?, <Boolean> closed?)
- Array
- Reverse of coordsToLatLngs
-closed determines whether the first point should be appended to the end of the array to close the feature, only used when levelsDeep is 0. False by default.
-
-
- asFeature(<Object> geojson)
- Object
- Normalize GeoJSON geometries/features into GeoJSON features.
-
-
-
-
-
-
- GridLayer
Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces TileLayer.Canvas.
-GridLayer can be extended to create a tiled grid of HTML elements like <canvas>, <img> or <div>. GridLayer will handle creating and animating these DOM elements for you.
-
-
-Usage example
-
-
-
-Synchronous usage
-
-
-
-To create a custom layer, extend GridLayer and implement the createTile() method, which will be passed a Point object with the x, y, and z (zoom level) coordinates to draw your tile.
-var CanvasLayer = L.GridLayer.extend({
- createTile: function(coords){
- // create a <canvas> element for drawing
- var tile = L.DomUtil.create('canvas', 'leaflet-tile');
- // setup tile width and height according to the options
- var size = this.getTileSize();
- tile.width = size.x;
- tile.height = size.y;
- // get a canvas context and draw something on it using coords.x, coords.y and coords.z
- var ctx = tile.getContext('2d');
- // return the tile so it can be rendered on screen
- return tile;
- }
-});
-
-
-
-
-
-
-Asynchronous usage
-
-
-
-Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the done() callback.
-var CanvasLayer = L.GridLayer.extend({
- createTile: function(coords, done){
- var error;
- // create a <canvas> element for drawing
- var tile = L.DomUtil.create('canvas', 'leaflet-tile');
- // setup tile width and height according to the options
- var size = this.getTileSize();
- tile.width = size.x;
- tile.height = size.y;
- // draw something asynchronously and pass the tile to the done() callback
- setTimeout(function() {
- done(error, tile);
- }, 1000);
- return tile;
- }
-});
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.gridLayer(<GridLayer options> options?)
- Creates a new instance of GridLayer with the supplied options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- tileSize
- Number|Point
- 256
- Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
-
-
- opacity
- Number
- 1.0
- Opacity of the tiles. Can be used in the createTile() function.
-
-
- updateWhenIdle
- Boolean
- (depends)
- Load new tiles only when panning ends.
-true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-false otherwise in order to display new tiles during panning, since it is easy to pan outside the
-keepBuffer option in desktop browsers.
-
-
- updateWhenZooming
- Boolean
- true
- By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
-
-
- updateInterval
- Number
- 200
- Tiles will not update more than once every updateInterval milliseconds when panning.
-
-
- zIndex
- Number
- 1
- The explicit zIndex of the tile layer.
-
-
- bounds
- LatLngBounds
- undefined
- If set, tiles will only be loaded inside the set LatLngBounds.
-
-
- minZoom
- Number
- 0
- The minimum zoom level down to which this layer will be displayed (inclusive).
-
-
- maxZoom
- Number
- undefined
- The maximum zoom level up to which this layer will be displayed (inclusive).
-
-
- maxNativeZoom
- Number
- undefined
- Maximum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels higher than maxNativeZoom will be loaded
-from maxNativeZoom level and auto-scaled.
-
-
- minNativeZoom
- Number
- undefined
- Minimum zoom number the tile source has available. If it is specified,
-the tiles on all zoom levels lower than minNativeZoom will be loaded
-from minNativeZoom level and auto-scaled.
-
-
- noWrap
- Boolean
- false
- Whether the layer is wrapped around the antimeridian. If true, the
-GridLayer will only be displayed once at low zoom levels. Has no
-effect when the map CRS doesn't wrap around. Can be used
-in combination with bounds to prevent requesting
-tiles outside the CRS limits.
-
-
- pane
- String
- 'tilePane'
- Map pane where the grid layer will be added.
-
-
- className
- String
- ''
- A custom class name to assign to the tile layer. Empty by default.
-
-
- keepBuffer
- Number
- 2
- When panning the map, keep this many rows and columns of tiles before unloading them.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- loading
- Event
- Fired when the grid layer starts loading tiles.
-
-
- tileunload
- TileEvent
- Fired when a tile is removed (e.g. when a tile goes off the screen).
-
-
- tileloadstart
- TileEvent
- Fired when a tile is requested and starts loading.
-
-
- tileerror
- TileErrorEvent
- Fired when there is an error loading a tile.
-
-
- tileload
- TileEvent
- Fired when a tile loads.
-
-
- load
- Event
- Fired when the grid layer loaded all visible tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bringToFront()
- this
- Brings the tile layer to the top of all tile layers.
-
-
-
- bringToBack()
- this
- Brings the tile layer to the bottom of all tile layers.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTML element that contains the tiles for this layer.
-
-
-
- setOpacity(<Number> opacity)
- this
- Changes the opacity of the grid layer.
-
-
-
- setZIndex(<Number> zIndex)
- this
- Changes the zIndex of the grid layer.
-
-
-
- isLoading()
- Boolean
- Returns true if any tile in the grid layer has not finished loading.
-
-
-
- redraw()
- this
- Causes the layer to clear all the tiles and request them again.
-
-
-
- getTileSize()
- Point
- Normalizes the tileSize option into a point. Used by the createTile() method.
-
-
-
-
-
-
-Extension methods
-
-Layers extending GridLayer shall reimplement the following method.
-
-
-
- Method
- Returns
- Description
-
-
-
- createTile(<Object> coords, <Function> done?)
- HTMLElement
- Called only internally, must be overridden by classes extending GridLayer.
-Returns the HTMLElement corresponding to the given coords. If the done callback
-is specified, it must be called when the tile has finished loading and drawing.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- LatLng
Represents a geographical point with a certain latitude and longitude.
-
-
-Usage example
-
-
-
-
-
-
-
-var latlng = L.latLng(50.5, 30.5);
-
All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:
-map.panTo([50, 30]);
-map.panTo({lon: 30, lat: 50});
-map.panTo({lat: 50, lng: 30});
-map.panTo(L.latLng(50, 30));
-
Note that LatLng does not inherit from Leaflet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.latLng(<Number> latitude, <Number> longitude, <Number> altitude?)
- Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).
-
-
- L.latLng(<Array> coords)
- Expects an array of the form [Number, Number] or [Number, Number, Number] instead.
-
-
- L.latLng(<Object> coords)
- Expects an plain object of the form {lat: Number, lng: Number} or {lat: Number, lng: Number, alt: Number} instead.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- equals(<LatLng> otherLatLng, <Number> maxMargin?)
- Boolean
- Returns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overridden by setting maxMargin to a small number.
-
-
-
- toString()
- String
- Returns a string representation of the point (for debugging purposes).
-
-
-
- distanceTo(<LatLng> otherLatLng)
- Number
- Returns the distance (in meters) to the given LatLng calculated using the Spherical Law of Cosines.
-
-
-
- wrap()
- LatLng
- Returns a new LatLng object with the longitude wrapped so it's always between -180 and +180 degrees.
-
-
-
- toBounds(<Number> sizeInMeters)
- LatLngBounds
- Returns a new LatLngBounds object in which each boundary is sizeInMeters/2 meters apart from the LatLng.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- lat
- Number
- Latitude in degrees
-
-
- lng
- Number
- Longitude in degrees
-
-
- alt
- Number
- Altitude in meters (optional)
-
-
-
-
-
-
- LatLngBounds
Represents a rectangular geographical area on a map.
-
-
-Usage example
-
-
-
-
-
-
-
-var corner1 = L.latLng(40.712, -74.227),
-corner2 = L.latLng(40.774, -74.125),
-bounds = L.latLngBounds(corner1, corner2);
-
-All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-map.fitBounds([
- [40.712, -74.227],
- [40.774, -74.125]
-]);
-
-Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners outside the [-180, 180] degrees longitude range.
-Note that LatLngBounds does not inherit from Leafet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.latLngBounds(<LatLng> corner1, <LatLng> corner2)
- Creates a LatLngBounds object by defining two diagonally opposite corners of the rectangle.
-
-
- L.latLngBounds(<LatLng[]> latlngs)
- Creates a LatLngBounds object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with fitBounds.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- extend(<LatLng> latlng)
- this
- Extend the bounds to contain the given point
-
-
-
- extend(<LatLngBounds> otherBounds)
- this
- Extend the bounds to contain the given bounds
-
-
-
- pad(<Number> bufferRatio)
- LatLngBounds
- Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
-For example, a ratio of 0.5 extends the bounds by 50% in each direction.
-Negative values will retract the bounds.
-
-
-
- getCenter()
- LatLng
- Returns the center point of the bounds.
-
-
-
- getSouthWest()
- LatLng
- Returns the south-west point of the bounds.
-
-
-
- getNorthEast()
- LatLng
- Returns the north-east point of the bounds.
-
-
-
- getNorthWest()
- LatLng
- Returns the north-west point of the bounds.
-
-
-
- getSouthEast()
- LatLng
- Returns the south-east point of the bounds.
-
-
-
- getWest()
- Number
- Returns the west longitude of the bounds
-
-
-
- getSouth()
- Number
- Returns the south latitude of the bounds
-
-
-
- getEast()
- Number
- Returns the east longitude of the bounds
-
-
-
- getNorth()
- Number
- Returns the north latitude of the bounds
-
-
-
- contains(<LatLngBounds> otherBounds)
- Boolean
- Returns true if the rectangle contains the given one.
-
-
-
- contains(<LatLng> latlng)
- Boolean
- Returns true if the rectangle contains the given point.
-
-
-
- intersects(<LatLngBounds> otherBounds)
- Boolean
- Returns true if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
-
-
-
- overlaps(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
-
-
-
- toBBoxString()
- String
- Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
-
-
-
- equals(<LatLngBounds> otherBounds, <Number> maxMargin?)
- Boolean
- Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting maxMargin to a small number.
-
-
-
- isValid()
- Boolean
- Returns true if the bounds are properly initialized.
-
-
-
-
-
-
-
- Point
Represents a point with x and y coordinates in pixels.
-
-
-Usage example
-
-
-
-
-
-
-
-var point = L.point(200, 300);
-
-All Leaflet methods and options that accept Point objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:
-map.panBy([200, 300]);
-map.panBy(L.point(200, 300));
-
-Note that Point does not inherit from Leafet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.point(<Number> x, <Number> y, <Boolean> round?)
- Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values.
-
-
- L.point(<Number[]> coords)
- Expects an array of the form [x, y] instead.
-
-
- L.point(<Object> coords)
- Expects a plain object of the form {x: Number, y: Number} instead.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- clone()
- Point
- Returns a copy of the current point.
-
-
-
- add(<Point> otherPoint)
- Point
- Returns the result of addition of the current and the given points.
-
-
-
- subtract(<Point> otherPoint)
- Point
- Returns the result of subtraction of the given point from the current.
-
-
-
- divideBy(<Number> num)
- Point
- Returns the result of division of the current point by the given number.
-
-
-
- multiplyBy(<Number> num)
- Point
- Returns the result of multiplication of the current point by the given number.
-
-
-
- scaleBy(<Point> scale)
- Point
- Multiply each coordinate of the current point by each coordinate of
-scale. In linear algebra terms, multiply the point by the
-scaling matrix
-defined by scale.
-
-
-
- unscaleBy(<Point> scale)
- Point
- Inverse of scaleBy. Divide each coordinate of the current point by
-each coordinate of scale.
-
-
-
- round()
- Point
- Returns a copy of the current point with rounded coordinates.
-
-
-
- floor()
- Point
- Returns a copy of the current point with floored coordinates (rounded down).
-
-
-
- ceil()
- Point
- Returns a copy of the current point with ceiled coordinates (rounded up).
-
-
-
- trunc()
- Point
- Returns a copy of the current point with truncated coordinates (rounded towards zero).
-
-
-
- distanceTo(<Point> otherPoint)
- Number
- Returns the cartesian distance between the current and the given points.
-
-
-
- equals(<Point> otherPoint)
- Boolean
- Returns true if the given point has the same coordinates.
-
-
-
- contains(<Point> otherPoint)
- Boolean
- Returns true if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
-
-
-
- toString()
- String
- Returns a string representation of the point for debugging purposes.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- x
- Number
- The x coordinate of the point
-
-
- y
- Number
- The y coordinate of the point
-
-
-
-
-
-
- Bounds
Represents a rectangular area in pixel coordinates.
-
-
-Usage example
-
-
-
-
-
-
-
-var p1 = L.point(10, 10),
-p2 = L.point(40, 60),
-bounds = L.bounds(p1, p2);
-
-All Leaflet methods that accept Bounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-otherBounds.intersects([[10, 10], [40, 60]]);
-
-Note that Bounds does not inherit from Leafet's Class object,
-which means new classes can't inherit from it, and new methods
-can't be added to it with the include function.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.bounds(<Point> corner1, <Point> corner2)
- Creates a Bounds object from two corners coordinate pairs.
-
-
- L.bounds(<Point[]> points)
- Creates a Bounds object from the given array of points.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- extend(<Point> point)
- this
- Extends the bounds to contain the given point.
-
-
-
- getCenter(<Boolean> round?)
- Point
- Returns the center point of the bounds.
-
-
-
- getBottomLeft()
- Point
- Returns the bottom-left point of the bounds.
-
-
-
- getTopRight()
- Point
- Returns the top-right point of the bounds.
-
-
-
- getTopLeft()
- Point
- Returns the top-left point of the bounds (i.e. this.min).
-
-
-
- getBottomRight()
- Point
- Returns the bottom-right point of the bounds (i.e. this.max).
-
-
-
- getSize()
- Point
- Returns the size of the given bounds
-
-
-
- contains(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle contains the given one.
-
-
-
- contains(<Point> point)
- Boolean
- Returns true if the rectangle contains the given point.
-
-
-
- intersects(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle intersects the given bounds. Two bounds
-intersect if they have at least one point in common.
-
-
-
- overlaps(<Bounds> otherBounds)
- Boolean
- Returns true if the rectangle overlaps the given bounds. Two bounds
-overlap if their intersection is an area.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- min
- Point
- The top left corner of the rectangle.
-
-
- max
- Point
- The bottom right corner of the rectangle.
-
-
-
-
-
-
- Icon
Represents an icon to provide when creating a marker.
-
-
-Usage example
-
-
-
-
-
-
-
-var myIcon = L.icon({
- iconUrl: 'my-icon.png',
- iconSize: [38, 95],
- iconAnchor: [22, 94],
- popupAnchor: [-3, -76],
- shadowUrl: 'my-icon-shadow.png',
- shadowSize: [68, 95],
- shadowAnchor: [22, 94]
-});
-L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-
-L.Icon.Default extends L.Icon and is the blue icon Leaflet uses for markers by default.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.icon(<Icon options> options)
- Creates an icon instance with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- iconUrl
- String
- null
- (required) The URL to the icon image (absolute or relative to your script path).
-
-
- iconRetinaUrl
- String
- null
- The URL to a retina sized version of the icon image (absolute or relative to your
-script path). Used for Retina screen devices.
-
-
- iconSize
- Point
- null
- Size of the icon image in pixels.
-
-
- iconAnchor
- Point
- null
- The coordinates of the "tip" of the icon (relative to its top left corner). The icon
-will be aligned so that this point is at the marker's geographical location. Centered
-by default if size is specified, also can be set in CSS with negative margins.
-
-
- popupAnchor
- Point
- [0, 0]
- The coordinates of the point from which popups will "open", relative to the icon anchor.
-
-
- tooltipAnchor
- Point
- [0, 0]
- The coordinates of the point from which tooltips will "open", relative to the icon anchor.
-
-
- shadowUrl
- String
- null
- The URL to the icon shadow image. If not specified, no shadow image will be created.
-
-
- shadowRetinaUrl
- String
- null
-
-
-
- shadowSize
- Point
- null
- Size of the shadow image in pixels.
-
-
- shadowAnchor
- Point
- null
- The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
-as iconAnchor if not specified).
-
-
- className
- String
- ''
- A custom class name to assign to both icon and shadow images. Empty by default.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- createIcon(<HTMLElement> oldIcon?)
- HTMLElement
- Called internally when the icon has to be shown, returns a <img> HTML element
-styled according to the options.
-
-
-
- createShadow(<HTMLElement> oldIcon?)
- HTMLElement
- As createIcon, but for the shadow beneath it.
-
-
-
-
-
-
-
-
-
-
-Icon.Default
-
-
-
-
-
-A trivial subclass of Icon, represents the icon to use in Markers when
-no icon is specified. Points to the blue marker image distributed with Leaflet
-releases.
-In order to customize the default icon, just change the properties of L.Icon.Default.prototype.options
-(which is a set of Icon options).
-If you want to completely replace the default icon, override the
-L.Marker.prototype.options.icon with your own icon instead.
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- imagePath
- String
-
- Icon.Default will try to auto-detect the location of the
-blue icon images. If you are placing these images in a non-standard
-way, set this option to point to the right path.
-
-
-
-
-
-
- DivIcon
Represents a lightweight icon for markers that uses a simple <div>
-element instead of an image. Inherits from Icon but ignores the iconUrl and shadow options.
-
-
-Usage example
-
-
-
-
-
-
-
-var myIcon = L.divIcon({className: 'my-div-icon'});
-// you can set .my-div-icon styles in CSS
-L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-
-By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.divIcon(<DivIcon options> options)
- Creates a DivIcon instance with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- html
- String
- ''
- Custom HTML code to put inside the div element, empty by default.
-
-
- bgPos
- Point
- [0, 0]
- Optional relative position of the background, in pixels
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- iconUrl
- String
- null
- (required) The URL to the icon image (absolute or relative to your script path).
-
-
- iconRetinaUrl
- String
- null
- The URL to a retina sized version of the icon image (absolute or relative to your
-script path). Used for Retina screen devices.
-
-
- iconSize
- Point
- null
- Size of the icon image in pixels.
-
-
- iconAnchor
- Point
- null
- The coordinates of the "tip" of the icon (relative to its top left corner). The icon
-will be aligned so that this point is at the marker's geographical location. Centered
-by default if size is specified, also can be set in CSS with negative margins.
-
-
- popupAnchor
- Point
- [0, 0]
- The coordinates of the point from which popups will "open", relative to the icon anchor.
-
-
- tooltipAnchor
- Point
- [0, 0]
- The coordinates of the point from which tooltips will "open", relative to the icon anchor.
-
-
- shadowUrl
- String
- null
- The URL to the icon shadow image. If not specified, no shadow image will be created.
-
-
- shadowRetinaUrl
- String
- null
-
-
-
- shadowSize
- Point
- null
- Size of the shadow image in pixels.
-
-
- shadowAnchor
- Point
- null
- The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
-as iconAnchor if not specified).
-
-
- className
- String
- ''
- A custom class name to assign to both icon and shadow images. Empty by default.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- createIcon(<HTMLElement> oldIcon?)
- HTMLElement
- Called internally when the icon has to be shown, returns a <img> HTML element
-styled according to the options.
-
-
-
- createShadow(<HTMLElement> oldIcon?)
- HTMLElement
- As createIcon, but for the shadow beneath it.
-
-
-
-
-
-
-
-
- Control.Zoom
A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its zoomControl option to false. Extends Control.
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.zoom(<Control.Zoom options> options)
- Creates a zoom control
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- zoomInText
- String
- '+'
- The text set on the 'zoom in' button.
-
-
- zoomInTitle
- String
- 'Zoom in'
- The title set on the 'zoom in' button.
-
-
- zoomOutText
- String
- '−
- '
-The text set on the 'zoom out' button.
-
-
- zoomOutTitle
- String
- 'Zoom out'
- The title set on the 'zoom out' button.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Control.Attribution
The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its attributionControl option to false, and it fetches attribution texts from layers with the getAttribution method automatically. Extends Control.
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.attribution(<Control.Attribution options> options)
- Creates an attribution control.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- prefix
- String
- 'Leaflet'
- The HTML text shown before the attributions. Pass false to disable.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- setPrefix(<String> prefix)
- this
- Sets the text before the attributions.
-
-
-
- addAttribution(<String> text)
- this
- Adds an attribution text (e.g. 'Vector data © Mapbox').
-
-
-
- removeAttribution(<String> text)
- this
- Removes an attribution text.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Control.Layers
The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the detailed example). Extends Control.
-
-
-Usage example
-
-
-
-
-
-
-
-var baseLayers = {
- "Mapbox": mapbox,
- "OpenStreetMap": osm
-};
-var overlays = {
- "Marker": marker,
- "Roads": roadsLayer
-};
-L.control.layers(baseLayers, overlays).addTo(map);
-
-The baseLayers and overlays parameters are object literals with layer names as keys and Layer objects as values:
-{
- "<someName1>": layer1,
- "<someName2>": layer2
-}
-
-The layer names can contain HTML, which allows you to add additional styling to the items:
-{"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.layers(<Object> baselayers?, <Object> overlays?, <Control.Layers options> options?)
- Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- collapsed
- Boolean
- true
- If true, the control will be collapsed into an icon and expanded on mouse hover or touch.
-
-
- autoZIndex
- Boolean
- true
- If true, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
-
-
- hideSingleBase
- Boolean
- false
- If true, the base layers in the control will be hidden when there is only one.
-
-
- sortLayers
- Boolean
- false
- Whether to sort the layers. When false, layers will keep the order
-in which they were added to the control.
-
-
- sortFunction
- Function
- *
- A compare function
-that will be used for sorting the layers, when sortLayers is true.
-The function receives both the L.Layer instances and their names, as in
-sortFunction(layerA, layerB, nameA, nameB).
-By default, it sorts layers alphabetically by their name.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addBaseLayer(<Layer> layer, <String> name)
- this
- Adds a base layer (radio button entry) with the given name to the control.
-
-
-
- addOverlay(<Layer> layer, <String> name)
- this
- Adds an overlay (checkbox entry) with the given name to the control.
-
-
-
- removeLayer(<Layer> layer)
- this
- Remove the given layer from the control.
-
-
-
- expand()
- this
- Expand the control container if collapsed.
-
-
-
- collapse()
- this
- Collapse the control container if expanded.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Control.Scale
A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends Control.
-
-
-Usage example
-
-
-
-
-
-
-
-L.control.scale().addTo(map);
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.control.scale(<Control.Scale options> options?)
- Creates an scale control with the given options.
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- maxWidth
- Number
- 100
- Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
-
-
- metric
- Boolean
- True
- Whether to show the metric scale line (m/km).
-
-
- imperial
- Boolean
- True
- Whether to show the imperial scale line (mi/ft).
-
-
- updateWhenIdle
- Boolean
- false
- If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-
-
- Browser
A namespace with static properties for browser/feature detection used by Leaflet internally.
-
-
-Usage example
-
-
-
-
-
-
-
-if (L.Browser.ielt9) {
- alert('Upgrade your browser, dude!');
-}
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- ie
- Boolean
- true for all Internet Explorer versions (not Edge).
-
-
- ielt9
- Boolean
- true for Internet Explorer versions less than 9.
-
-
- edge
- Boolean
- true for the Edge web browser.
-
-
- webkit
- Boolean
- true for webkit-based browsers like Chrome and Safari (including mobile versions).
-
-
- android
- Boolean
- true for any browser running on an Android platform.
-
-
- android23
- Boolean
- true for browsers running on Android 2 or Android 3.
-
-
- androidStock
- Boolean
- true for the Android stock browser (i.e. not Chrome)
-
-
- opera
- Boolean
- true for the Opera browser
-
-
- chrome
- Boolean
- true for the Chrome browser.
-
-
- gecko
- Boolean
- true for gecko-based browsers like Firefox.
-
-
- safari
- Boolean
- true for the Safari browser.
-
-
- opera12
- Boolean
- true for the Opera browser supporting CSS transforms (version 12 or later).
-
-
- win
- Boolean
- true when the browser is running in a Windows platform
-
-
- ie3d
- Boolean
- true for all Internet Explorer versions supporting CSS transforms.
-
-
- webkit3d
- Boolean
- true for webkit-based browsers supporting CSS transforms.
-
-
- gecko3d
- Boolean
- true for gecko-based browsers supporting CSS transforms.
-
-
- any3d
- Boolean
- true for all browsers supporting CSS transforms.
-
-
- mobile
- Boolean
- true for all browsers running in a mobile device.
-
-
- mobileWebkit
- Boolean
- true for all webkit-based browsers in a mobile device.
-
-
- mobileWebkit3d
- Boolean
- true for all webkit-based browsers in a mobile device supporting CSS transforms.
-
-
- msPointer
- Boolean
- true for browsers implementing the Microsoft touch events model (notably IE10).
-
-
- pointer
- Boolean
- true for all browsers supporting pointer events.
-
-
- touch
- Boolean
- true for all browsers supporting touch events.
-This does not necessarily mean that the browser is running in a computer with
-a touchscreen, it only means that the browser is capable of understanding
-touch events.
-
-
- mobileOpera
- Boolean
- true for the Opera browser in a mobile device.
-
-
- mobileGecko
- Boolean
- true for gecko-based browsers running in a mobile device.
-
-
- retina
- Boolean
- true for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
-
-
- canvas
- Boolean
- true when the browser supports <canvas>.
-
-
- svg
- Boolean
- true when the browser supports SVG.
-
-
- vml
- Boolean
- true if the browser supports VML.
-
-
-
-
-
-
- Util
Various utility functions, used by Leaflet internally.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- extend(<Object> dest, <Object> src?)
- Object
- Merges the properties of the src object (or multiple objects) into dest object and returns the latter. Has an L.extend shortcut.
-
-
- create(<Object> proto, <Object> properties?)
- Object
- Compatibility polyfill for Object.create
-
-
- bind(<Function> fn, …)
- Function
- Returns a new function bound to the arguments passed, like Function.prototype.bind.
-Has a L.bind() shortcut.
-
-
- stamp(<Object> obj)
- Number
- Returns the unique ID of an object, assigning it one if it doesn't have it.
-
-
- throttle(<Function> fn, <Number> time, <Object> context)
- Function
- Returns a function which executes function fn with the given scope context
-(so that the this keyword refers to context inside fn's code). The function
-fn will be called no more than one time per given amount of time. The arguments
-received by the bound function will be any arguments passed when binding the
-function, followed by any arguments passed when invoking the bound function.
-Has an L.throttle shortcut.
-
-
- wrapNum(<Number> num, <Number[]> range, <Boolean> includeMax?)
- Number
- Returns the number num modulo range in such a way so it lies within
-range[0] and range[1]. The returned value will be always smaller than
-range[1] unless includeMax is set to true.
-
-
- falseFn()
- Function
- Returns a function which always returns false.
-
-
- formatNum(<Number> num, <Number> digits?)
- Number
- Returns the number num rounded to digits decimals, or to 6 decimals by default.
-
-
- trim(<String> str)
- String
- Compatibility polyfill for String.prototype.trim
-
-
- splitWords(<String> str)
- String[]
- Trims and splits the string on whitespace and returns the array of parts.
-
-
- setOptions(<Object> obj, <Object> options)
- Object
- Merges the given properties to the options of the obj object, returning the resulting options. See Class options. Has an L.setOptions shortcut.
-
-
- getParamString(<Object> obj, <String> existingUrl?, <Boolean> uppercase?)
- String
- Converts an object into a parameter URL string, e.g. {a: "foo", b: "bar"}
-translates to '?a=foo&b=bar'. If existingUrl is set, the parameters will
-be appended at the end. If uppercase is true, the parameter names will
-be uppercased (e.g. '?A=foo&B=bar')
-
-
- template(<String> str, <Object> data)
- String
- Simple templating facility, accepts a template string of the form 'Hello {a}, {b}'
-and a data object like {a: 'foo', b: 'bar'}, returns evaluated string
-('Hello foo, bar'). You can also specify functions instead of strings for
-data values — they will be evaluated passing data as an argument.
-
-
- isArray(obj)
- Boolean
- Compatibility polyfill for Array.isArray
-
-
- indexOf(<Array> array, <Object> el)
- Number
- Compatibility polyfill for Array.prototype.indexOf
-
-
- requestAnimFrame(<Function> fn, <Object> context?, <Boolean> immediate?)
- Number
- Schedules fn to be executed when the browser repaints. fn is bound to
-context if given. When immediate is set, fn is called immediately if
-the browser doesn't have native support for
-window.requestAnimationFrame,
-otherwise it's delayed. Returns a request ID that can be used to cancel the request.
-
-
- cancelAnimFrame(<Number> id)
- undefined
- Cancels a previous requestAnimFrame. See also window.cancelAnimationFrame.
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- lastId
- Number
- Last unique ID used by stamp()
-
-
- emptyImageUrl
- String
- Data URI string containing a base64-encoded empty GIF image.
-Used as a hack to free memory from unused images on WebKit-powered
-mobile devices (by setting image src to this string).
-
-
-
-
-
-
- Transformation
Represents an affine transformation: a set of coefficients a, b, c, d
-for transforming a point of a form (x, y) into (a*x + b, c*y + d) and doing
-the reverse. Used by Leaflet in its projections code.
-
-
-Usage example
-
-
-
-
-
-
-
-var transformation = L.transformation(2, 5, -1, 10),
- p = L.point(1, 2),
- p2 = transformation.transform(p), // L.point(7, 8)
- p3 = transformation.untransform(p2); // L.point(1, 2)
-
-
-
-
-
-
-
-
-Creation
-
-
-
-
-
-
-
-
- Factory
- Description
-
-
-
- L.transformation(<Number> a, <Number> b, <Number> c, <Number> d)
- Instantiates a Transformation object with the given coefficients.
-
-
- L.transformation(<Array> coefficients)
- Expects an coefficients array of the form
-[a: Number, b: Number, c: Number, d: Number].
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- transform(<Point> point, <Number> scale?)
- Point
- Returns a transformed point, optionally multiplied by the given scale.
-Only accepts actual L.Point instances, not arrays.
-
-
-
- untransform(<Point> point, <Number> scale?)
- Point
- Returns the reverse transformation of the given point, optionally divided
-by the given scale. Only accepts actual L.Point instances, not arrays.
-
-
-
-
-
-
-
- LineUtil
Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- simplify(<Point[]> points, <Number> tolerance)
- Point[]
- Dramatically reduces the number of points in a polyline while retaining
-its shape and returns a new array of simplified points, using the
-Douglas-Peucker algorithm.
-Used for a huge performance boost when processing/displaying Leaflet polylines for
-each zoom level and also reducing visual noise. tolerance affects the amount of
-simplification (lesser value means higher quality but slower and with more points).
-Also released as a separated micro-library Simplify.js.
-
-
- pointToSegmentDistance(<Point> p, <Point> p1, <Point> p2)
- Number
- Returns the distance between point p and segment p1 to p2.
-
-
- closestPointOnSegment(<Point> p, <Point> p1, <Point> p2)
- Number
- Returns the closest point from a point p on a segment p1 to p2.
-
-
- clipSegment(<Point> a, <Point> b, <Bounds> bounds, <Boolean> useLastCode?, <Boolean> round?)
- Point[]|Boolean
- Clips the segment a to b by rectangular bounds with the
-Cohen-Sutherland algorithm
-(modifying the segment points directly!). Used by Leaflet to only show polyline
-points that are on the screen or near, increasing performance.
-
-
- isFlat(<LatLng[]> latlngs)
- Boolean
- Returns true if latlngs is a flat array, false is nested.
-
-
-
-
-
-
- PolyUtil
Various utility functions for polygon geometries.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- clipPolygon(<Point[]> points, <Bounds> bounds, <Boolean> round?)
- Point[]
- Clips the polygon geometry defined by the given points by the given bounds (using the Sutherland-Hodgman algorithm).
-Used by Leaflet to only show polygon points that are on the screen or near, increasing
-performance. Note that polygon points needs different algorithm for clipping
-than polyline, so there's a separate method for it.
-
-
-
-
-
-
- DomEvent
Utility functions to work with the DOM events, used by Leaflet internally.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- on(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular DOM event type of the
-element el. You can optionally specify the context of the listener
-(object the this keyword will point to). You can also pass several
-space-separated types (e.g. 'click dblclick').
-
-
- on(<HTMLElement> el, <Object> eventMap, <Object> context?)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
- off(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
- this
- Removes a previously added listener function.
-Note that if you passed a custom context to on, you must pass the same
-context to off in order to remove the listener.
-
-
- off(<HTMLElement> el, <Object> eventMap, <Object> context?)
- this
- Removes a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
- stopPropagation(<DOMEvent> ev)
- this
- Stop the given event from propagation to parent elements. Used inside the listener functions:
-L.DomEvent.on(div, 'click', function (ev) {
- L.DomEvent.stopPropagation(ev);
-});
-
-
-
- disableScrollPropagation(<HTMLElement> el)
- this
- Adds stopPropagation to the element's 'mousewheel' events (plus browser variants).
-
-
- disableClickPropagation(<HTMLElement> el)
- this
- Adds stopPropagation to the element's 'click', 'doubleclick',
-'mousedown' and 'touchstart' events (plus browser variants).
-
-
- preventDefault(<DOMEvent> ev)
- this
- Prevents the default action of the DOM Event ev from happening (such as
-following a link in the href of the a element, or doing a POST request
-with page reload when a <form> is submitted).
-Use it inside listener functions.
-
-
- stop(<DOMEvent> ev)
- this
- Does stopPropagation and preventDefault at the same time.
-
-
- getMousePosition(<DOMEvent> ev, <HTMLElement> container?)
- Point
- Gets normalized mouse position from a DOM event relative to the
-container (border excluded) or to the whole page if not specified.
-
-
- getWheelDelta(<DOMEvent> ev)
- Number
- Gets normalized wheel delta from a mousewheel DOM event, in vertical
-pixels scrolled (negative if scrolling down).
-Events from pointing devices without precise scrolling are mapped to
-a best guess of 60 pixels.
-
-
- addListener(…)
- this
- Alias to L.DomEvent.on
-
-
- removeListener(…)
- this
- Alias to L.DomEvent.off
-
-
-
-
-
-
- DomUtil
Utility functions to work with the DOM
-tree, used by Leaflet internally.
-Most functions expecting or returning a HTMLElement also work for
-SVG elements. The only difference is that classes refer to CSS classes
-in HTML and SVG classes in SVG.
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- get(<String|HTMLElement> id)
- HTMLElement
- Returns an element given its DOM id, or returns the element itself
-if it was passed directly.
-
-
- getStyle(<HTMLElement> el, <String> styleAttrib)
- String
- Returns the value for a certain style attribute on an element,
-including computed values or values set through CSS.
-
-
- create(<String> tagName, <String> className?, <HTMLElement> container?)
- HTMLElement
- Creates an HTML element with tagName, sets its class to className, and optionally appends it to container element.
-
-
- remove(<HTMLElement> el)
-
- Removes el from its parent element
-
-
- empty(<HTMLElement> el)
-
- Removes all of el's children elements from el
-
-
- toFront(<HTMLElement> el)
-
- Makes el the last child of its parent, so it renders in front of the other children.
-
-
- toBack(<HTMLElement> el)
-
- Makes el the first child of its parent, so it renders behind the other children.
-
-
- hasClass(<HTMLElement> el, <String> name)
- Boolean
- Returns true if the element's class attribute contains name.
-
-
- addClass(<HTMLElement> el, <String> name)
-
- Adds name to the element's class attribute.
-
-
- removeClass(<HTMLElement> el, <String> name)
-
- Removes name from the element's class attribute.
-
-
- setClass(<HTMLElement> el, <String> name)
-
- Sets the element's class.
-
-
- getClass(<HTMLElement> el)
- String
- Returns the element's class.
-
-
- setOpacity(<HTMLElement> el, <Number> opacity)
-
- Set the opacity of an element (including old IE support).
-opacity must be a number from 0 to 1.
-
-
- testProp(<String[]> props)
- String|false
- Goes through the array of style names and returns the first name
-that is a valid style name for an element. If no such name is found,
-it returns false. Useful for vendor-prefixed styles like transform.
-
-
- setTransform(<HTMLElement> el, <Point> offset, <Number> scale?)
-
- Resets the 3D CSS transform of el so it is translated by offset pixels
-and optionally scaled by scale. Does not have an effect if the
-browser doesn't support 3D CSS transforms.
-
-
- setPosition(<HTMLElement> el, <Point> position)
-
- Sets the position of el to coordinates specified by position,
-using CSS translate or top/left positioning depending on the browser
-(used by Leaflet internally to position its layers).
-
-
- getPosition(<HTMLElement> el)
- Point
- Returns the coordinates of an element previously positioned with setPosition.
-
-
- disableTextSelection()
-
- Prevents the user from generating selectstart DOM events, usually generated
-when the user drags the mouse through a page with text. Used internally
-by Leaflet to override the behaviour of any click-and-drag interaction on
-the map. Affects drag interactions on the whole document.
-
-
- enableTextSelection()
-
- Cancels the effects of a previous L.DomUtil.disableTextSelection.
-
-
- disableImageDrag()
-
- As L.DomUtil.disableTextSelection, but
-for dragstart DOM events, usually generated when the user drags an image.
-
-
- enableImageDrag()
-
- Cancels the effects of a previous L.DomUtil.disableImageDrag.
-
-
- preventOutline(<HTMLElement> el)
-
- Makes the outline
-of the element el invisible. Used internally by Leaflet to prevent
-focusable elements from displaying an outline when the user performs a
-drag interaction on them.
-
-
- restoreOutline()
-
- Cancels the effects of a previous L.DomUtil.preventOutline.
-
-
- getSizedParentNode(<HTMLElement> el)
- HTMLElement
- Finds the closest parent node which size (width and height) is not null.
-
-
- getScale(<HTMLElement> el)
- Object
- Computes the CSS scale currently applied on the element.
-Returns an object with x and y members as horizontal and vertical scales respectively,
-and boundingClientRect as the result of getBoundingClientRect().
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- TRANSFORM
- String
- Vendor-prefixed transform style name (e.g. 'webkitTransform' for WebKit).
-
-
- TRANSITION
- String
- Vendor-prefixed transition style name.
-
-
- TRANSITION_END
- String
- Vendor-prefixed transitionend event name.
-
-
-
-
-
-
- PosAnimation
Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.
-
-
-Usage example
-
-
-
-
-
-
-
-var fx = new L.PosAnimation();
-fx.run(el, [300, 500], 0.5);
-
-
-
-
-
-
-
-
-Constructor
-
-
-
-
-
-
-
-
- Constructor
- Description
-
-
-
- L.PosAnimation()
- Creates a PosAnimation object.
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- start
- Event
- Fired when the animation starts
-
-
- step
- Event
- Fired continuously during the animation.
-
-
- end
- Event
- Fired when the animation ends.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- run(<HTMLElement> el, <Point> newPos, <Number> duration?, <Number> easeLinearity?)
-
- Run an animation of a given element to a new position, optionally setting
-duration in seconds (0.25 by default) and easing linearity factor (3rd
-argument of the cubic bezier curve,
-0.5 by default).
-
-
-
- stop()
-
- Stops the animation (if currently running).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Draggable
A class for making DOM elements draggable (including touch support).
-Used internally for map and marker dragging. Only works for elements
-that were positioned with L.DomUtil.setPosition.
-
-
-Usage example
-
-
-
-
-
-
-
-var draggable = new L.Draggable(elementToDrag);
-draggable.enable();
-
-
-
-
-
-
-
-
-Constructor
-
-
-
-
-
-
-
-
- Constructor
- Description
-
-
-
- L.Draggable(<HTMLElement> el, <HTMLElement> dragHandle?, <Boolean> preventOutline?, <Draggable options> options?)
- Creates a Draggable object for moving el when you start dragging the dragHandle element (equals el itself by default).
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- clickTolerance
- Number
- 3
- The max number of pixels a user can shift the mouse pointer during a click
-for it to be considered a valid click (as opposed to a mouse drag).
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- down
- Event
- Fired when a drag is about to start.
-
-
- dragstart
- Event
- Fired when a drag starts
-
-
- predrag
- Event
- Fired continuously during dragging before each corresponding
-update of the element's position.
-
-
- drag
- Event
- Fired continuously during dragging.
-
-
- dragend
- DragEndEvent
- Fired when the drag ends.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- enable()
-
- Enables the dragging ability
-
-
-
- disable()
-
- Disables the dragging ability
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Class
L.Class powers the OOP facilities of Leaflet and is used to create almost all of the Leaflet classes documented here.
-In addition to implementing a simple classical inheritance model, it introduces several special properties for convenient code organization — options, includes and statics.
-
-
-Usage example
-
-
-
-
-
-
-
-var MyClass = L.Class.extend({
-initialize: function (greeter) {
- this.greeter = greeter;
- // class constructor
-},
-greet: function (name) {
- alert(this.greeter + ', ' + name)
- }
-});
-// create instance of MyClass, passing "Hello" to the constructor
-var a = new MyClass("Hello");
-// call greet method, alerting "Hello, World"
-a.greet("World");
-
-
-
-
-
-
-Class Factories
-
-
-
-You may have noticed that Leaflet objects are created without using
-the new keyword. This is achieved by complementing each class with a
-lowercase factory method:
-new L.Map('map'); // becomes:
-L.map('map');
-
-The factories are implemented very easily, and you can do this for your own classes:
-L.map = function (id, options) {
- return new L.Map(id, options);
-};
-
-
-
-
-
-
-Inheritance
-
-
-
-You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it:
-var MyChildClass = MyClass.extend({
- // ... new properties and methods
-});
-
-This will create a class that inherits all methods and properties of the parent class (through a proper prototype chain), adding or overriding the ones you pass to extend. It will also properly react to instanceof:
-var a = new MyChildClass();
-a instanceof MyChildClass; // true
-a instanceof MyClass; // true
-
-You can call parent methods (including constructor) from corresponding child ones (as you do with super calls in other languages) by accessing parent class prototype and using JavaScript's call or apply:
-var MyChildClass = MyClass.extend({
- initialize: function () {
- MyClass.prototype.initialize.call(this, "Yo");
- },
- greet: function (name) {
- MyClass.prototype.greet.call(this, 'bro ' + name + '!');
- }
-});
-var a = new MyChildClass();
-a.greet('Jason'); // alerts "Yo, bro Jason!"
-
-
-
-
-
-Options
-
-
-
-options is a special property that unlike other objects that you pass
-to extend will be merged with the parent one instead of overriding it
-completely, which makes managing configuration of objects and default
-values convenient:
-var MyClass = L.Class.extend({
- options: {
- myOption1: 'foo',
- myOption2: 'bar'
- }
-});
-var MyChildClass = MyClass.extend({
- options: {
- myOption1: 'baz',
- myOption3: 5
- }
-});
-var a = new MyChildClass();
-a.options.myOption1; // 'baz'
-a.options.myOption2; // 'bar'
-a.options.myOption3; // 5
-
-There's also L.Util.setOptions, a method for
-conveniently merging options passed to constructor with the defaults
-defines in the class:
-var MyClass = L.Class.extend({
- options: {
- foo: 'bar',
- bla: 5
- },
- initialize: function (options) {
- L.Util.setOptions(this, options);
- ...
- }
-});
-var a = new MyClass({bla: 10});
-a.options; // {foo: 'bar', bla: 10}
-
-Note that the options object allows any keys, not just
-the options defined by the class and its base classes.
-This means you can use the options object to store
-application specific information, as long as you avoid
-keys that are already used by the class in question.
-
-
-
-
-
-Includes
-
-
-
-includes is a special class property that merges all specified objects into the class (such objects are called mixins).
- var MyMixin = {
- foo: function () { ... },
- bar: 5
-};
-var MyClass = L.Class.extend({
- includes: MyMixin
-});
-var a = new MyClass();
-a.foo();
-
-You can also do such includes in runtime with the include method:
-MyClass.include(MyMixin);
-
-statics is just a convenience property that injects specified object properties as the static properties of the class, useful for defining constants:
-var MyClass = L.Class.extend({
- statics: {
- FOO: 'bar',
- BLA: 5
- }
-});
-MyClass.FOO; // 'bar'
-
-
-
-
-
-
-Constructor hooks
-
-
-
-If you're a plugin developer, you often need to add additional initialization code to existing classes (e.g. editing hooks for L.Polyline). Leaflet comes with a way to do it easily using the addInitHook method:
-MyClass.addInitHook(function () {
- // ... do something in constructor additionally
- // e.g. add event listeners, set custom properties etc.
-});
-
-You can also use the following shortcut when you just need to make one additional method call:
-MyClass.addInitHook('methodName', arg1, arg2, …);
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-
-
-
- Function
- Returns
- Description
-
-
-
- extend(<Object> props)
- Function
- Extends the current class given the properties to be included.
-Returns a Javascript function that is a class constructor (to be called with new).
-
-
- include(<Object> properties)
- this
- Includes a mixin into the current class.
-
-
- mergeOptions(<Object> options)
- this
- Merges options into the defaults of the class.
-
-
- addInitHook(<Function> fn)
- this
- Adds a constructor hook to the class.
-
-
-
-
-
-
- Evented
A set of methods shared between event-powered classes (like Map and Marker). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire 'click' event).
-
-
-Usage example
-
-
-
-
-
-
-
-map.on('click', function(e) {
- alert(e.latlng);
-} );
-
-Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
-function onClick(e) { ... }
-map.on('click', onClick);
-map.off('click', onClick);
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
- Layer
A set of methods from the Layer base class that all Leaflet layers use.
-Inherits all methods, options and events from L.Evented.
-
-
-Usage example
-
-
-
-
-
-
-
-var layer = L.Marker(latlng).addTo(map);
-layer.addTo(map);
-layer.remove();
-
-
-
-
-
-
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- add
- Event
- Fired after the layer is added to a map
-
-
- remove
- Event
- Fired after the layer is removed from a map
-
-
-
-
-
-Popup events
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-Tooltip events
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-Classes extending L.Layer will inherit the following methods:
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-Extension methods
-
-Every layer should extend from L.Layer and (re-)implement the following methods.
-
-
-
- Method
- Returns
- Description
-
-
-
- onAdd(<Map> map)
- this
- Should contain code that creates DOM elements for the layer, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).
-
-
-
- onRemove(<Map> map)
- this
- Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
-
-
-
- getEvents()
- Object
- This optional method should return an object like { viewreset: this._reset } for addEventListener. The event handlers in this object will be automatically added and removed from the map with your layer.
-
-
-
- getAttribution()
- String
- This optional method should return a string containing HTML to be shown on the Attribution control whenever the layer is visible.
-
-
-
- beforeAdd(<Map> map)
- this
- Optional method. Called on map.addLayer(layer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
-
-
-
-
-
-
-Popup methods
-
-All layers share a set of methods convenient for binding popups to it.
-var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);
-layer.openPopup();
-layer.closePopup();
-
-Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-Tooltip methods
-
-All layers share a set of methods convenient for binding tooltips to it.
-var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
-layer.openTooltip();
-layer.closeTooltip();
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Interactive layer
Some Layers can be made interactive - when the user interacts
-with such a layer, mouse events like click and mouseover can be handled.
-Use the event handling methods to handle these events.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- interactive
- Boolean
- true
- If false, the layer will not emit mouse events and will act as a part of the underlying map.
-
-
- bubblingMouseEvents
- Boolean
- true
- When true, a mouse event on this layer will trigger the same event on the map
-(unless L.DomEvent.stopPropagation is used).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-Mouse events
-
-
-
-
- Event
- Data
- Description
-
-
-
- click
- MouseEvent
- Fired when the user clicks (or taps) the layer.
-
-
- dblclick
- MouseEvent
- Fired when the user double-clicks (or double-taps) the layer.
-
-
- mousedown
- MouseEvent
- Fired when the user pushes the mouse button on the layer.
-
-
- mouseup
- MouseEvent
- Fired when the user releases the mouse button pushed on the layer.
-
-
- mouseover
- MouseEvent
- Fired when the mouse enters the layer.
-
-
- mouseout
- MouseEvent
- Fired when the mouse leaves the layer.
-
-
- contextmenu
- MouseEvent
- Fired when the user right-clicks on the layer, prevents
-default browser context menu from showing if there are listeners on
-this event. Also fired on mobile when the user holds a single touch
-for a second (also called long press).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Control
L.Control is a base class for implementing map controls. Handles positioning.
-All other controls extend from this class.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- position
- String
- 'topright'
- The position of the control (one of the map corners). Possible values are 'topleft',
-'topright', 'bottomleft' or 'bottomright'
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-Classes extending L.Control will inherit the following methods:
-
-
-
- Method
- Returns
- Description
-
-
-
- getPosition()
- string
- Returns the position of the control.
-
-
-
- setPosition(<string> position)
- this
- Sets the position of the control.
-
-
-
- getContainer()
- HTMLElement
- Returns the HTMLElement that contains the control.
-
-
-
- addTo(<Map> map)
- this
- Adds the control to the given map.
-
-
-
- remove()
- this
- Removes the control from the map it is currently active on.
-
-
-
-
-
-
-Extension methods
-
-Every control should extend from L.Control and (re-)implement the following methods.
-
-
-
- Method
- Returns
- Description
-
-
-
- onAdd(<Map> map)
- HTMLElement
- Should return the container DOM element for the control and add listeners on relevant map events. Called on control.addTo(map).
-
-
-
- onRemove(<Map> map)
-
- Optional method. Should contain all clean up code that removes the listeners previously added in onAdd. Called on control.remove().
-
-
-
-
-
-
-
- Handler
Abstract class for map interaction handlers
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- enable()
- this
- Enables the handler
-
-
-
- disable()
- this
- Disables the handler
-
-
-
- enabled()
- Boolean
- Returns true if the handler is enabled
-
-
-
-
-
-
-Extension methods
-
-Classes inheriting from Handler must implement the two following methods:
-
-
-
- Method
- Returns
- Description
-
-
-
- addHooks()
-
- Called when the handler is enabled, should add event hooks.
-
-
-
- removeHooks()
-
- Called when the handler is disabled, should remove the event hooks added previously.
-
-
-
-
-
-
-
-
-Functions
-
-
-
-There is static function which can be called without instantiating L.Handler:
-
-
-
-
- Function
- Returns
- Description
-
-
-
- addTo(<Map> map, <String> name)
- this
- Adds a new Handler to the given map with the given name.
-
-
-
-
-
-
- Projection
An object with methods for projecting geographical coordinates of the world onto
-a flat surface (and back). See Map projection.
-
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- project(<LatLng> latlng)
- Point
- Projects geographical coordinates into a 2D point.
-Only accepts actual L.LatLng instances, not arrays.
-
-
-
- unproject(<Point> point)
- LatLng
- The inverse of project. Projects a 2D point into a geographical location.
-Only accepts actual L.Point instances, not arrays.
-Note that the projection instances do not inherit from Leafet's Class object,
-and can't be instantiated. Also, new classes can't inherit from them,
-and methods can't be added to them with the include function.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- bounds
- Bounds
- The bounds (specified in CRS units) where the projection is valid
-
-
-
-
-
-
-
-Defined projections
-
-
-
-
-
-Leaflet comes with a set of already defined Projections out of the box:
-
-
-
- Projection
- Description
-
-
-
- L.Projection.LonLat
- Equirectangular, or Plate Carree projection — the most simple projection,
-mostly used by GIS enthusiasts. Directly maps x as longitude, and y as
-latitude. Also suitable for flat worlds, e.g. game maps. Used by the
-EPSG:4326 and Simple CRS.
-
-
- L.Projection.Mercator
- Elliptical Mercator projection — more complex than Spherical Mercator. Takes into account that Earth is a geoid, not a perfect sphere. Used by the EPSG:3395 CRS.
-
-
- L.Projection.SphericalMercator
- Spherical Mercator projection — the most common projection for online maps,
-used by almost all free and commercial tile providers. Assumes that Earth is
-a sphere. Used by the EPSG:3857 CRS.
-
-
-
-
-
-
- CRS
-
-Methods
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- latLngToPoint(<LatLng> latlng, <Number> zoom)
- Point
- Projects geographical coordinates into pixel coordinates for a given zoom.
-
-
-
- pointToLatLng(<Point> point, <Number> zoom)
- LatLng
- The inverse of latLngToPoint. Projects pixel coordinates on a given
-zoom into geographical coordinates.
-
-
-
- project(<LatLng> latlng)
- Point
- Projects geographical coordinates into coordinates in units accepted for
-this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
-
-
-
- unproject(<Point> point)
- LatLng
- Given a projected coordinate returns the corresponding LatLng.
-The inverse of project.
-
-
-
- scale(<Number> zoom)
- Number
- Returns the scale used when transforming projected coordinates into
-pixel coordinates for a particular zoom. For example, it returns
-256 * 2^zoom for Mercator-based CRS.
-
-
-
- zoom(<Number> scale)
- Number
- Inverse of scale(), returns the zoom level corresponding to a scale
-factor of scale.
-
-
-
- getProjectedBounds(<Number> zoom)
- Bounds
- Returns the projection's bounds scaled and transformed for the provided zoom.
-
-
-
- distance(<LatLng> latlng1, <LatLng> latlng2)
- Number
- Returns the distance between two geographical coordinates.
-
-
-
- wrapLatLng(<LatLng> latlng)
- LatLng
- Returns a LatLng where lat and lng has been wrapped according to the
-CRS's wrapLat and wrapLng properties, if they are outside the CRS's bounds.
-
-
-
- wrapLatLngBounds(<LatLngBounds> bounds)
- LatLngBounds
- Returns a LatLngBounds with the same size as the given one, ensuring
-that its center is within the CRS's bounds.
-Only accepts actual L.LatLngBounds instances, not arrays.
-
-
-
-
-
-
-
-
-Properties
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- code
- String
- Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857')
-
-
- wrapLng
- Number[]
- An array of two numbers defining whether the longitude (horizontal) coordinate
-axis wraps around a given range and how. Defaults to [-180, 180] in most
-geographical CRSs. If undefined, the longitude axis does not wrap around.
-
-
- wrapLat
- Number[]
- Like wrapLng, but for the latitude (vertical) axis.
-
-
- infinite
- Boolean
- If true, the coordinate space will be unbounded (infinite in both axes)
-
-
-
-
-
-
-
-Defined CRSs
-
-
-
-
-
-
-
-
- CRS
- Description
-
-
-
- L.CRS.Earth
- Serves as the base for CRS that are global such that they cover the earth.
-Can only be used as the base for other CRS and cannot be used directly,
-since it does not have a code, projection or transformation. distance() returns
-meters.
-
-
- L.CRS.EPSG3395
- Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
-
-
- L.CRS.EPSG3857
- The most common CRS for online maps, used by almost all free and commercial
-tile providers. Uses Spherical Mercator projection. Set in by default in
-Map's crs option.
-
-
- L.CRS.EPSG4326
- A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
-Leaflet 1.0.x complies with the TMS coordinate scheme for EPSG:4326,
-which is a breaking change from 0.7.x behaviour. If you are using a TileLayer
-with this CRS, ensure that there are two 256x256 pixel tiles covering the
-whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),
-or (-180,-90) for TileLayers with the tms option set.
-
-
- L.CRS.Base
- Object that defines coordinate reference systems for projecting
-geographical points into pixel (screen) coordinates and back (and to
-coordinates in other units for WMS services). See
-spatial reference system.
-Leaflet defines the most usual CRSs by default. If you want to use a
-CRS not defined by default, take a look at the
-Proj4Leaflet plugin.
-Note that the CRS instances do not inherit from Leafet's Class object,
-and can't be instantiated. Also, new classes can't inherit from them,
-and methods can't be added to them with the include function.
-
-
- L.CRS.Simple
- A simple CRS that maps longitude and latitude into x and y directly.
-May be used for maps of flat surfaces (e.g. game maps). Note that the y
-axis should still be inverted (going from bottom to top). distance() returns
-simple euclidean distance.
-
-
-
-
-
-
- Renderer
Base class for vector renderer implementations (SVG, Canvas). Handles the
-DOM container of the renderer, its bounds, and its zoom animation.
-A Renderer works as an implicit layer group for all Paths - the renderer
-itself can be added or removed to the map. All paths use a renderer, which can
-be implicit (the map will decide the type of renderer and use it automatically)
-or explicit (using the renderer option of the path).
-Do not use this class directly, use SVG and Canvas instead.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- padding
- Number
- 0.1
- How much to extend the clip area around the map view (relative to its size)
-e.g. 0.1 would be 10% of map view in each direction
-
-
- tolerance
- Number
- 0
- How much to extend click tolerance round a path/object on the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- pane
- String
- 'overlayPane'
- By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- update
- Event
- Fired when the renderer updates its bounds, center and zoom, for example when
-its map has moved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Event objects
Whenever a class inheriting from Evented fires an event, a listener function
-will be called with an event argument, which is a plain object containing
-information about the event. For example:
-map.on('click', function(ev) {
- alert(ev.latlng); // ev is an event object (MouseEvent in this case)
-});
-
-The information available depends on the event type:
-
-
-
-
-Event
-
-
-
-
-
-The base event object. All other event objects contain these properties too.
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-KeyboardEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- originalEvent
- DOMEvent
- The original DOM KeyboardEvent that triggered this Leaflet event.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-MouseEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- latlng
- LatLng
- The geographical point where the mouse event occured.
-
-
- layerPoint
- Point
- Pixel coordinates of the point where the mouse event occured relative to the map layer.
-
-
- containerPoint
- Point
- Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
-
-
- originalEvent
- DOMEvent
- The original DOM MouseEvent or DOM TouchEvent that triggered this Leaflet event.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-LocationEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- latlng
- LatLng
- Detected geographical location of the user.
-
-
- bounds
- LatLngBounds
- Geographical bounds of the area user is located in (with respect to the accuracy of location).
-
-
- accuracy
- Number
- Accuracy of location in meters.
-
-
- altitude
- Number
- Height of the position above the WGS84 ellipsoid in meters.
-
-
- altitudeAccuracy
- Number
- Accuracy of altitude in meters.
-
-
- heading
- Number
- The direction of travel in degrees counting clockwise from true North.
-
-
- speed
- Number
- Current velocity in meters per second.
-
-
- timestamp
- Number
- The time when the position was acquired.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-ErrorEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- message
- String
- Error message.
-
-
- code
- Number
- Error code (if applicable).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-LayerEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- layer
- Layer
- The layer that was added or removed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
-
-
-
-
-
-
-
-
-LayersControlEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- layer
- Layer
- The layer that was added or removed.
-
-
- name
- String
- The name of the layer that was added or removed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
-
-
-
-
-
-
-
-
-TileEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- tile
- HTMLElement
- The tile element (image).
-
-
- coords
- Point
- Point object with the tile's x, y, and z (zoom level) coordinates.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-TileErrorEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- tile
- HTMLElement
- The tile element (image).
-
-
- coords
- Point
- Point object with the tile's x, y, and z (zoom level) coordinates.
-
-
- error
- *
- Error passed to the tile's done() callback.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-ResizeEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- oldSize
- Point
- The old size before resize event.
-
-
- newSize
- Point
- The new size after the resize event.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-GeoJSONEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- layer
- Layer
- The layer for the GeoJSON feature that is being added to the map.
-
-
- properties
- Object
- GeoJSON properties of the feature.
-
-
- geometryType
- String
- GeoJSON geometry type of the feature.
-
-
- id
- String
- GeoJSON ID of the feature (if present).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
-
-
-
-
-
-
-
-
-PopupEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- popup
- Popup
- The popup that was opened or closed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-TooltipEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- tooltip
- Tooltip
- The tooltip that was opened or closed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-DragEndEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- distance
- Number
- The distance in pixels the draggable element was moved by.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
-
-
-
-ZoomAnimEvent
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- center
- LatLng
- The current center of the map
-
-
- zoom
- Number
- The current zoom level of the map
-
-
- noUpdate
- Boolean
- Whether layers should update their contents due to this event
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
- Type
- Description
-
-
-
- type
- String
- The event type (e.g. 'click').
-
-
- target
- Object
- The object that fired the event. For propagated events, the last object in
-the propagation chain that fired the event.
-
-
- sourceTarget
- Object
- The object that originally fired the event. For non-propagated events, this will
-be the same as the target.
-
-
- propagatedFrom
- Object
- For propagated events, the last object that propagated the event to its
-event parent.
-
-
- layer
- Object
- Deprecated. The same as propagatedFrom.
-
-
-
-
-
-
-
- DivOverlay
Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.
-
-
-Options
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- offset
- Point
- Point(0, 7)
- The offset of the popup position. Useful to control the anchor
-of the popup when opening it on some overlays.
-
-
- className
- String
- ''
- A custom CSS class name to assign to the popup.
-
-
- pane
- String
- 'popupPane'
- Map pane where the popup will be added.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Option
- Type
- Default
- Description
-
-
-
- attribution
- String
- null
- String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
-
-
-
-
-
-
-
-
-Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- popupopen
- PopupEvent
- Fired when a popup bound to this layer is opened
-
-
- popupclose
- PopupEvent
- Fired when a popup bound to this layer is closed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Event
- Data
- Description
-
-
-
- tooltipopen
- TooltipEvent
- Fired when a tooltip bound to this layer is opened.
-
-
- tooltipclose
- TooltipEvent
- Fired when a tooltip bound to this layer is closed.
-
-
-
-
-
-
-
-
-Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- addTo(<Map|LayerGroup> map)
- this
- Adds the layer to the given map or layer group.
-
-
-
- remove()
- this
- Removes the layer from the map it is currently active on.
-
-
-
- removeFrom(<Map> map)
- this
- Removes the layer from the given map
-
-
-
- getPane(<String> name?)
- HTMLElement
- Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
-
-
-
- getAttribution()
- String
- Used by the attribution control, returns the attribution option.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
- this
- Binds a popup to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindPopup()
- this
- Removes the popup previously bound with bindPopup.
-
-
-
- openPopup(<LatLng> latlng?)
- this
- Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
-
-
-
- closePopup()
- this
- Closes the popup bound to this layer if it is open.
-
-
-
- togglePopup()
- this
- Opens or closes the popup bound to this layer depending on its current state.
-
-
-
- isPopupOpen()
- boolean
- Returns true if the popup bound to this layer is currently open.
-
-
-
- setPopupContent(<String|HTMLElement|Popup> content)
- this
- Sets the content of the popup bound to this layer.
-
-
-
- getPopup()
- Popup
- Returns the popup bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
- this
- Binds a tooltip to the layer with the passed content and sets up the
-necessary event listeners. If a Function is passed it will receive
-the layer as the first argument and should return a String or HTMLElement.
-
-
-
- unbindTooltip()
- this
- Removes the tooltip previously bound with bindTooltip.
-
-
-
- openTooltip(<LatLng> latlng?)
- this
- Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
-
-
-
- closeTooltip()
- this
- Closes the tooltip bound to this layer if it is open.
-
-
-
- toggleTooltip()
- this
- Opens or closes the tooltip bound to this layer depending on its current state.
-
-
-
- isTooltipOpen()
- boolean
- Returns true if the tooltip bound to this layer is currently open.
-
-
-
- setTooltipContent(<String|HTMLElement|Tooltip> content)
- this
- Sets the content of the tooltip bound to this layer.
-
-
-
- getTooltip()
- Tooltip
- Returns the tooltip bound to this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
- Returns
- Description
-
-
-
- on(<String> type, <Function> fn, <Object> context?)
- this
- Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
-
-
-
- on(<Object> eventMap)
- this
- Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
-
-
-
- off(<String> type, <Function> fn?, <Object> context?)
- this
- Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
-
-
-
- off(<Object> eventMap)
- this
- Removes a set of type/listener pairs.
-
-
-
- off()
- this
- Removes all listeners to all events on the object.
-
-
-
- fire(<String> type, <Object> data?, <Boolean> propagate?)
- this
- Fires an event of the specified type. You can optionally provide an data
-object — the first argument of the listener function will contain its
-properties. The event can optionally be propagated to event parents.
-
-
-
- listens(<String> type)
- Boolean
- Returns true if a particular event type has any listeners attached to it.
-
-
-
- once(…)
- this
- Behaves as on(…), except the listener will only get fired once and then removed.
-
-
-
- addEventParent(<Evented> obj)
- this
- Adds an event parent - an Evented that will receive propagated events
-
-
-
- removeEventParent(<Evented> obj)
- this
- Removes an event parent, so it will stop receiving propagated events
-
-
-
- addEventListener(…)
- this
- Alias to on(…)
-
-
-
- removeEventListener(…)
- this
- Alias to off(…)
-
-
-
- clearAllEventListeners(…)
- this
- Alias to off()
-
-
-
- addOneTimeEventListener(…)
- this
- Alias to once(…)
-
-
-
- fireEvent(…)
- this
- Alias to fire(…)
-
-
-
- hasEventListeners(…)
- Boolean
- Alias to listens(…)
-
-
-
-
-
-
-
-
- Global Switches
Global switches are created for rare cases and generally make
-Leaflet to not detect a particular browser feature even if it's
-there. You need to set the switch as a global variable to true
-before including Leaflet on the page, like this:
-<script>L_NO_TOUCH = true;</script>
-<script src="leaflet.js"></script>
-
-
-
-
-Switch
-Description
-
-
-
-
-L_NO_TOUCH
-Forces Leaflet to not use touch events even if it detects them.
-
-
-L_DISABLE_3D
-Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning (which may cause glitches in some rare environments) even if they're supported.
-
-
-
-
-noConflict
This method restores the L global variable to the original value
-it had before Leaflet inclusion, and returns the real Leaflet
-namespace so you can put it elsewhere, like this:
-<script src='libs/l.js'>
-<!-- L points to some other library -->
-<script src='leaflet.js'>
-<!-- you include Leaflet, it replaces the L variable to Leaflet namespace -->
-<script>
-var Leaflet = L.noConflict();
-// now L points to that other library again, and you can use Leaflet.Map etc.
-</script>
-
-
-version
A constant that represents the Leaflet version in use.
-L.version; // contains "1.0.0" (or whatever version is currently in use)
-
diff --git a/docs/reference-1.3.3.html b/docs/reference-1.3.3.html
deleted file mode 100644
index 7b7c70d47a2..00000000000
--- a/docs/reference-1.3.3.html
+++ /dev/null
@@ -1,4 +0,0 @@
----
-layout: redirected
-redirect_to: reference-1.3.2.html
----
\ No newline at end of file
diff --git a/docs/reference-1.3.4.html b/docs/reference-1.3.4.html
index bc1586a1349..7d08ea80e26 100644
--- a/docs/reference-1.3.4.html
+++ b/docs/reference-1.3.4.html
@@ -16771,7 +16771,7 @@ Usage example
]);
Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners outside the [-180, 180] degrees longitude range.
-Note that LatLngBounds does not inherit from Leafet's Class object,
+Note that LatLngBounds does not inherit from Leaflet's Class object,
which means new classes can't inherit from it, and new methods
can't be added to it with the include function.
@@ -16960,7 +16960,7 @@ Usage example
map.panBy([200, 300]);
map.panBy(L.point(200, 300));
-Note that Point does not inherit from Leafet's Class object,
+
Note that Point does not inherit from Leaflet's Class object,
which means new classes can't inherit from it, and new methods
can't be added to it with the include function.
@@ -17162,7 +17162,7 @@ Usage example
All Leaflet methods that accept Bounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
otherBounds.intersects([[10, 10], [40, 60]]);
-Note that Bounds does not inherit from Leafet's Class object,
+
Note that Bounds does not inherit from Leaflet's Class object,
which means new classes can't inherit from it, and new methods
can't be added to it with the include function.
@@ -20120,9 +20120,9 @@ Methods
- listens(<String> type)
+ listens(<String> type, <Boolean> propagate?)
Boolean
- Returns true if a particular event type has any listeners attached to it.
+ Returns true if a particular event type has any listeners attached to it. The verification can optionally be propagated, it will return true if parents have the listener attached to it.
@@ -21443,7 +21443,7 @@ Methods
LatLng
The inverse of project. Projects a 2D point into a geographical location.
Only accepts actual L.Point instances, not arrays.
-Note that the projection instances do not inherit from Leafet's Class object,
+Note that the projection instances do not inherit from Leaflet's Class object,
and can't be instantiated. Also, new classes can't inherit from them,
and methods can't be added to them with the include function.
@@ -21696,7 +21696,7 @@ Defined CRSs
Leaflet defines the most usual CRSs by default. If you want to use a
CRS not defined by default, take a look at the
Proj4Leaflet plugin.
-Note that the CRS instances do not inherit from Leafet's Class object,
+Note that the CRS instances do not inherit from Leaflet's Class object,
and can't be instantiated. Also, new classes can't inherit from them,
and methods can't be added to them with the include function.
@@ -22381,17 +22381,17 @@ MouseEvent
latlng
LatLng
- The geographical point where the mouse event occured.
+ The geographical point where the mouse event occurred.
layerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map layer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map layer.
containerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map сontainer.
originalEvent
diff --git a/docs/reference-1.4.0.html b/docs/reference-1.4.0.html
index 38e6703c7c6..38a69092a02 100644
--- a/docs/reference-1.4.0.html
+++ b/docs/reference-1.4.0.html
@@ -4237,7 +4237,7 @@ Usage example
-L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map);
+L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
@@ -16784,7 +16784,7 @@ Usage example
]);
Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners outside the [-180, 180] degrees longitude range.
-Note that LatLngBounds does not inherit from Leafet's Class object,
+Note that LatLngBounds does not inherit from Leaflet's Class object,
which means new classes can't inherit from it, and new methods
can't be added to it with the include function.
@@ -16973,7 +16973,7 @@ Usage example
map.panBy([200, 300]);
map.panBy(L.point(200, 300));
-Note that Point does not inherit from Leafet's Class object,
+
Note that Point does not inherit from Leaflet's Class object,
which means new classes can't inherit from it, and new methods
can't be added to it with the include function.
@@ -17175,7 +17175,7 @@ Usage example
All Leaflet methods that accept Bounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
otherBounds.intersects([[10, 10], [40, 60]]);
-Note that Bounds does not inherit from Leafet's Class object,
+
Note that Bounds does not inherit from Leaflet's Class object,
which means new classes can't inherit from it, and new methods
can't be added to it with the include function.
@@ -20133,9 +20133,9 @@ Methods
- listens(<String> type)
+ listens(<String> type, <Boolean> propagate?)
Boolean
- Returns true if a particular event type has any listeners attached to it.
+ Returns true if a particular event type has any listeners attached to it. The verification can optionally be propagated, it will return true if parents have the listener attached to it.
@@ -21456,7 +21456,7 @@ Methods
LatLng
The inverse of project. Projects a 2D point into a geographical location.
Only accepts actual L.Point instances, not arrays.
-Note that the projection instances do not inherit from Leafet's Class object,
+Note that the projection instances do not inherit from Leaflet's Class object,
and can't be instantiated. Also, new classes can't inherit from them,
and methods can't be added to them with the include function.
@@ -21709,7 +21709,7 @@ Defined CRSs
Leaflet defines the most usual CRSs by default. If you want to use a
CRS not defined by default, take a look at the
Proj4Leaflet plugin.
-Note that the CRS instances do not inherit from Leafet's Class object,
+Note that the CRS instances do not inherit from Leaflet's Class object,
and can't be instantiated. Also, new classes can't inherit from them,
and methods can't be added to them with the include function.
@@ -22394,17 +22394,17 @@ MouseEvent
latlng
LatLng
- The geographical point where the mouse event occured.
+ The geographical point where the mouse event occurred.
layerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map layer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map layer.
containerPoint
Point
- Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
+ Pixel coordinates of the point where the mouse event occurred relative to the map сontainer.
originalEvent
diff --git a/docs/reference-1.5.1.html b/docs/reference-1.5.1.html
index e04f2807c03..24e90f2d9c7 100644
--- a/docs/reference-1.5.1.html
+++ b/docs/reference-1.5.1.html
@@ -1,4 +1,24804 @@
---
-layout: redirected
-redirect_to: reference-1.5.0.html
----
\ No newline at end of file
+layout: v2
+title: Documentation
+bodyclass: api-page
+---
+
+Leaflet API reference
+
+This reference reflects Leaflet 1.5.0 and Leaflet 1.5.1. Check this list if you are using a different version of Leaflet.
+
+
+
+ Map
+
+ - Usage example
+ - Creation
+ - Options
+ - Events
+
+ Map Methods
+
+ - Modifying map state
+ - Getting map state
+ - Layers and controls
+ - Conversion methods
+ - Other methods
+
+ Map Misc
+
+ - Properties
+ - Panes
+
+
+
+ UI Layers
+
+ Raster Layers
+
+ - TileLayer
+ - TileLayer.WMS
+ - ImageOverlay
+ - VideoOverlay
+
+ Vector Layers
+
+ - Path
+ - Polyline
+ - Polygon
+ - Rectangle
+ - Circle
+ - CircleMarker
+ - SVGOverlay
+ - SVG
+ - Canvas
+
+
+
+ Other Layers
+
+ - LayerGroup
+ - FeatureGroup
+ - GeoJSON
+ - GridLayer
+
+ Basic Types
+
+ Controls
+
+ - Zoom
+ - Attribution
+ - Layers
+ - Scale
+
+
+
+
+
+
+
+
+
+ Utility
+
+ - Browser
+ - Util
+ - Transformation
+ - LineUtil
+ - PolyUtil
+
+ DOM Utility
+
+ - DomEvent
+ - DomUtil
+ - PosAnimation
+ - Draggable
+
+
+
+ Base Classes
+
+ - Class
+ - Evented
+ - Layer
+ - Interactive layer
+ - Control
+ - Handler
+
+ - Projection
+ - CRS
+ - Renderer
+
+
+ Misc
+
+ - Event objects
+ - global switches
+ - noConflict
+ - version
+
+
+
+
+ Map
The central class of the API — it is used to create a map on a page and manipulate it.
+
+
+Usage example
+
+
+
+
+
+
+
+// initialize the map on the "map" div with a given center and zoom
+var map = L.map('map', {
+ center: [51.505, -0.09],
+ zoom: 13
+});
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.map(<String> id, <Map options> options?)
+ Instantiates a map object given the DOM ID of a <div> element
+and optionally an object literal with Map options.
+
+
+ L.map(<HTMLElement> el, <Map options> options?)
+ Instantiates a map object given an instance of a <div> HTML element
+and optionally an object literal with Map options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ preferCanvas
+ Boolean
+ false
+ Whether Paths should be rendered on a Canvas renderer.
+By default, all Paths are rendered in a SVG renderer.
+
+
+
+
+
+Control options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attributionControl
+ Boolean
+ true
+ Whether a attribution control is added to the map by default.
+
+
+ zoomControl
+ Boolean
+ true
+ Whether a zoom control is added to the map by default.
+
+
+
+
+
+Interaction Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ closePopupOnClick
+ Boolean
+ true
+ Set it to false if you don't want popups to close when user clicks the map.
+
+
+ zoomSnap
+ Number
+ 1
+ Forces the map's zoom level to always be a multiple of this, particularly
+right after a fitBounds() or a pinch-zoom.
+By default, the zoom level snaps to the nearest integer; lower values
+(e.g. 0.5 or 0.1) allow for greater granularity. A value of 0
+means the zoom level will not be snapped after fitBounds or a pinch-zoom.
+
+
+ zoomDelta
+ Number
+ 1
+ Controls how much the map's zoom level will change after a
+zoomIn(), zoomOut(), pressing +
+or - on the keyboard, or using the zoom controls.
+Values smaller than 1 (e.g. 0.5) allow for greater granularity.
+
+
+ trackResize
+ Boolean
+ true
+ Whether the map automatically handles browser window resize to update itself.
+
+
+ boxZoom
+ Boolean
+ true
+ Whether the map can be zoomed to a rectangular area specified by
+dragging the mouse while pressing the shift key.
+
+
+ doubleClickZoom
+ Boolean|String
+ true
+ Whether the map can be zoomed in by double clicking on it and
+zoomed out by double clicking while holding shift. If passed
+'center', double-click zoom will zoom to the center of the
+ view regardless of where the mouse was.
+
+
+ dragging
+ Boolean
+ true
+ Whether the map be draggable with mouse/touch or not.
+
+
+
+
+
+Map State Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ crs
+ CRS
+ L.CRS.EPSG3857
+ The Coordinate Reference System to use. Don't change this if you're not
+sure what it means.
+
+
+ center
+ LatLng
+ undefined
+ Initial geographic center of the map
+
+
+ zoom
+ Number
+ undefined
+ Initial map zoom level
+
+
+ minZoom
+ Number
+ *
+ Minimum zoom level of the map.
+If not specified and at least one GridLayer or TileLayer is in the map,
+the lowest of their minZoom options will be used instead.
+
+
+ maxZoom
+ Number
+ *
+ Maximum zoom level of the map.
+If not specified and at least one GridLayer or TileLayer is in the map,
+the highest of their maxZoom options will be used instead.
+
+
+ layers
+ Layer[]
+ []
+ Array of layers that will be added to the map initially
+
+
+ maxBounds
+ LatLngBounds
+ null
+ When this option is set, the map restricts the view to the given
+geographical bounds, bouncing the user back if the user tries to pan
+outside the view. To set the restriction dynamically, use
+setMaxBounds method.
+
+
+ renderer
+ Renderer
+ *
+ The default method for drawing vector layers on the map. L.SVG
+or L.Canvas by default depending on browser support.
+
+
+
+
+
+Animation Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ zoomAnimation
+ Boolean
+ true
+ Whether the map zoom animation is enabled. By default it's enabled
+in all browsers that support CSS3 Transitions except Android.
+
+
+ zoomAnimationThreshold
+ Number
+ 4
+ Won't animate zoom if the zoom difference exceeds this value.
+
+
+ fadeAnimation
+ Boolean
+ true
+ Whether the tile fade animation is enabled. By default it's enabled
+in all browsers that support CSS3 Transitions except Android.
+
+
+ markerZoomAnimation
+ Boolean
+ true
+ Whether markers animate their zoom with the zoom animation, if disabled
+they will disappear for the length of the animation. By default it's
+enabled in all browsers that support CSS3 Transitions except Android.
+
+
+ transform3DLimit
+ Number
+ 2^23
+ Defines the maximum size of a CSS translation transform. The default
+value should not be changed unless a web browser positions layers in
+the wrong place after doing a large panBy.
+
+
+
+
+
+Panning Inertia Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ inertia
+ Boolean
+ *
+ If enabled, panning of the map will have an inertia effect where
+the map builds momentum while dragging and continues moving in
+the same direction for some time. Feels especially nice on touch
+devices. Enabled by default unless running on old Android devices.
+
+
+ inertiaDeceleration
+ Number
+ 3000
+ The rate with which the inertial movement slows down, in pixels/second².
+
+
+ inertiaMaxSpeed
+ Number
+ Infinity
+ Max speed of the inertial movement, in pixels/second.
+
+
+ easeLinearity
+ Number
+ 0.2
+
+
+
+ worldCopyJump
+ Boolean
+ false
+ With this option enabled, the map tracks when you pan to another "copy"
+of the world and seamlessly jumps to the original one so that all overlays
+like markers and vector layers are still visible.
+
+
+ maxBoundsViscosity
+ Number
+ 0.0
+ If maxBounds is set, this option will control how solid the bounds
+are when dragging the map around. The default value of 0.0 allows the
+user to drag outside the bounds at normal speed, higher values will
+slow down map dragging outside bounds, and 1.0 makes the bounds fully
+solid, preventing the user from dragging outside the bounds.
+
+
+
+
+
+Keyboard Navigation Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ keyboard
+ Boolean
+ true
+ Makes the map focusable and allows users to navigate the map with keyboard
+arrows and +/- keys.
+
+
+ keyboardPanDelta
+ Number
+ 80
+ Amount of pixels to pan when pressing an arrow key.
+
+
+
+
+
+Mousewheel options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ scrollWheelZoom
+ Boolean|String
+ true
+ Whether the map can be zoomed by using the mouse wheel. If passed 'center',
+it will zoom to the center of the view regardless of where the mouse was.
+
+
+ wheelDebounceTime
+ Number
+ 40
+ Limits the rate at which a wheel can fire (in milliseconds). By default
+user can't zoom via wheel more often than once per 40 ms.
+
+
+ wheelPxPerZoomLevel
+ Number
+ 60
+ How many scroll pixels (as reported by L.DomEvent.getWheelDelta)
+mean a change of one full zoom level. Smaller values will make wheel-zooming
+faster (and vice versa).
+
+
+
+
+
+Touch interaction options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tap
+ Boolean
+ true
+ Enables mobile hacks for supporting instant taps (fixing 200ms click
+delay on iOS/Android) and touch holds (fired as contextmenu events).
+
+
+ tapTolerance
+ Number
+ 15
+ The max number of pixels a user can shift his finger during touch
+for it to be considered a valid tap.
+
+
+ touchZoom
+ Boolean|String
+ *
+ Whether the map can be zoomed by touch-dragging with two fingers. If
+passed 'center', it will zoom to the center of the view regardless of
+where the touch events (fingers) were. Enabled for touch-capable web
+browsers except for old Androids.
+
+
+ bounceAtZoomLimits
+ Boolean
+ true
+ Set it to false if you don't want the map to zoom beyond min/max zoom
+and then bounce back when pinch-zooming.
+
+
+
+
+
+
+
+Events
+
+
+
+Layer events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ baselayerchange
+ LayersControlEvent
+ Fired when the base layer is changed through the layer control.
+
+
+ overlayadd
+ LayersControlEvent
+ Fired when an overlay is selected through the layer control.
+
+
+ overlayremove
+ LayersControlEvent
+ Fired when an overlay is deselected through the layer control.
+
+
+ layeradd
+ LayerEvent
+ Fired when a new layer is added to the map.
+
+
+ layerremove
+ LayerEvent
+ Fired when some layer is removed from the map
+
+
+
+
+
+Map state change events
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ zoomlevelschange
+ Event
+ Fired when the number of zoomlevels on the map is changed due
+to adding or removing a layer.
+
+
+ resize
+ ResizeEvent
+ Fired when the map is resized.
+
+
+ unload
+ Event
+ Fired when the map is destroyed with remove method.
+
+
+ viewreset
+ Event
+ Fired when the map needs to redraw its content (this usually happens
+on map zoom or load). Very useful for creating custom overlays.
+
+
+ load
+ Event
+ Fired when the map is initialized (when its center and zoom are set
+for the first time).
+
+
+ zoomstart
+ Event
+ Fired when the map zoom is about to change (e.g. before zoom animation).
+
+
+ movestart
+ Event
+ Fired when the view of the map starts changing (e.g. user starts dragging the map).
+
+
+ zoom
+ Event
+ Fired repeatedly during any change in zoom level, including zoom
+and fly animations.
+
+
+ move
+ Event
+ Fired repeatedly during any movement of the map, including pan and
+fly animations.
+
+
+ zoomend
+ Event
+ Fired when the map has changed, after any animations.
+
+
+ moveend
+ Event
+ Fired when the center of the map stops changing (e.g. user stopped
+dragging the map).
+
+
+
+
+
+Popup events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup is opened in the map
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup in the map is closed
+
+
+ autopanstart
+ Event
+ Fired when the map starts autopanning when opening a popup.
+
+
+
+
+
+Tooltip events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip is opened in the map.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip in the map is closed.
+
+
+
+
+
+Location events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ locationerror
+ ErrorEvent
+ Fired when geolocation (using the locate method) failed.
+
+
+ locationfound
+ LocationEvent
+ Fired when geolocation (using the locate method)
+went successfully.
+
+
+
+
+
+Interaction events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the map.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the map.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the map.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button on the map.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the map.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the map.
+
+
+ mousemove
+ MouseEvent
+ Fired while the mouse moves over the map.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user pushes the right mouse button on the map, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+ keypress
+ KeyboardEvent
+ Fired when the user presses a key from the keyboard that produces a character value while the map is focused.
+
+
+ keydown
+ KeyboardEvent
+ Fired when the user presses a key from the keyboard while the map is focused. Unlike the keypress event,
+the keydown event is fired for keys that produce a character value and for keys
+that do not produce a character value.
+
+
+ keyup
+ KeyboardEvent
+ Fired when the user releases a key from the keyboard while the map is focused.
+
+
+ preclick
+ MouseEvent
+ Fired before mouse click on the map (sometimes useful when you
+want something to happen on click before any existing click
+handlers start running).
+
+
+
+
+
+Other Methods
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ zoomanim
+ ZoomAnimEvent
+ Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getRenderer(<Path> layer)
+ Renderer
+ Returns the instance of Renderer that should be used to render the given
+Path. It will ensure that the renderer options of the map and paths
+are respected, and that the renderers do exist on the map.
+
+
+
+
+
+
+Methods for Layers and Controls
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addControl(<Control> control)
+ this
+ Adds the given control to the map
+
+
+
+ removeControl(<Control> control)
+ this
+ Removes the given control from the map
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the map
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the map.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the map
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the map, optionally specifying context of the iterator function.
+map.eachLayer(function(layer){
+ layer.bindPopup('Hello');
+});
+
+
+
+ openPopup(<Popup> popup)
+ this
+ Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
+
+
+
+ openPopup(<String|HTMLElement> content, <LatLng> latlng, <Popup options> options?)
+ this
+ Creates a popup with the specified content and options and opens it in the given point on a map.
+
+
+
+ closePopup(<Popup> popup?)
+ this
+ Closes the popup previously opened with openPopup (or the given one).
+
+
+
+ openTooltip(<Tooltip> tooltip)
+ this
+ Opens the specified tooltip.
+
+
+
+ openTooltip(<String|HTMLElement> content, <LatLng> latlng, <Tooltip options> options?)
+ this
+ Creates a tooltip with the specified content and options and open it.
+
+
+
+ closeTooltip(<Tooltip> tooltip?)
+ this
+ Closes the tooltip given as parameter.
+
+
+
+
+
+
+Methods for modifying map state
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setView(<LatLng> center, <Number> zoom, <Zoom/pan options> options?)
+ this
+ Sets the view of the map (geographical center and zoom) with the given
+animation options.
+
+
+
+ setZoom(<Number> zoom, <Zoom/pan options> options?)
+ this
+ Sets the zoom of the map.
+
+
+
+ zoomIn(<Number> delta?, <Zoom options> options?)
+ this
+ Increases the zoom of the map by delta (zoomDelta by default).
+
+
+
+ zoomOut(<Number> delta?, <Zoom options> options?)
+ this
+ Decreases the zoom of the map by delta (zoomDelta by default).
+
+
+
+ setZoomAround(<LatLng> latlng, <Number> zoom, <Zoom options> options)
+ this
+ Zooms the map while keeping a specified geographical point on the map
+stationary (e.g. used internally for scroll zoom and double-click zoom).
+
+
+
+ setZoomAround(<Point> offset, <Number> zoom, <Zoom options> options)
+ this
+ Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
+
+
+
+ fitBounds(<LatLngBounds> bounds, <fitBounds options> options?)
+ this
+ Sets a map view that contains the given geographical bounds with the
+maximum zoom level possible.
+
+
+
+ fitWorld(<fitBounds options> options?)
+ this
+ Sets a map view that mostly contains the whole world with the maximum
+zoom level possible.
+
+
+
+ panTo(<LatLng> latlng, <Pan options> options?)
+ this
+ Pans the map to a given center.
+
+
+
+ panBy(<Point> offset, <Pan options> options?)
+ this
+ Pans the map by a given number of pixels (animated).
+
+
+
+ flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?)
+ this
+ Sets the view of the map (geographical center and zoom) performing a smooth
+pan-zoom animation.
+
+
+
+ flyToBounds(<LatLngBounds> bounds, <fitBounds options> options?)
+ this
+ Sets the view of the map with a smooth animation like flyTo,
+but takes a bounds parameter like fitBounds.
+
+
+
+ setMaxBounds(<Bounds> bounds)
+ this
+ Restricts the map view to the given bounds (see the maxBounds option).
+
+
+
+ setMinZoom(<Number> zoom)
+ this
+ Sets the lower limit for the available zoom levels (see the minZoom option).
+
+
+
+ setMaxZoom(<Number> zoom)
+ this
+ Sets the upper limit for the available zoom levels (see the maxZoom option).
+
+
+
+ panInsideBounds(<LatLngBounds> bounds, <Pan options> options?)
+ this
+ Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
+
+
+
+ panInside(<LatLng> latlng, <options> options?)
+ this
+ Pans the map the minimum amount to make the latlng visible. Use
+padding, paddingTopLeft and paddingTopRight options to fit
+the display to more restricted bounds, like fitBounds.
+If latlng is already within the (optionally padded) display bounds,
+the map will not be panned.
+
+
+
+ invalidateSize(<Zoom/pan options> options)
+ this
+ Checks if the map container size changed and updates the map if so —
+call it after you've changed the map size dynamically, also animating
+pan by default. If options.pan is false, panning will not occur.
+If options.debounceMoveend is true, it will delay moveend event so
+that it doesn't happen often even if the method is called many
+times in a row.
+
+
+
+ invalidateSize(<Boolean> animate)
+ this
+ Checks if the map container size changed and updates the map if so —
+call it after you've changed the map size dynamically, also animating
+pan by default.
+
+
+
+ stop()
+ this
+ Stops the currently running panTo or flyTo animation, if any.
+
+
+
+
+
+
+Geolocation methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ locate(<Locate options> options?)
+ this
+ Tries to locate the user using the Geolocation API, firing a locationfound
+event with location data on success or a locationerror event on failure,
+and optionally sets the map view to the user's location with respect to
+detection accuracy (or to the world view if geolocation failed).
+Note that, if your page doesn't use HTTPS, this method will fail in
+modern browsers (Chrome 50 and newer)
+See Locate options for more details.
+
+
+
+ stopLocate()
+ this
+ Stops watching location previously initiated by map.locate({watch: true})
+and aborts resetting the map view if map.locate was called with
+{setView: true}.
+
+
+
+
+
+
+Other Methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addHandler(<String> name, <Function> HandlerClass)
+ this
+ Adds a new Handler to the map, given its name and constructor function.
+
+
+
+ remove()
+ this
+ Destroys the map and clears all related event listeners.
+
+
+
+ createPane(<String> name, <HTMLElement> container?)
+ HTMLElement
+ Creates a new map pane with the given name if it doesn't exist already,
+then returns it. The pane is created as a child of container, or
+as a child of the main map pane if not set.
+
+
+
+ getPane(<String|HTMLElement> pane)
+ HTMLElement
+ Returns a map pane, given its name or its HTML element (its identity).
+
+
+
+ getPanes()
+ Object
+ Returns a plain object containing the names of all panes as keys and
+the panes as values.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the map.
+
+
+
+ whenReady(<Function> fn, <Object> context?)
+ this
+ Runs the given function fn when the map gets initialized with
+a view (center and zoom) and at least one layer, or immediately
+if it's already initialized, optionally passing a function context.
+
+
+
+
+
+
+Methods for Getting Map State
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getCenter()
+ LatLng
+ Returns the geographical center of the map view
+
+
+
+ getZoom()
+ Number
+ Returns the current zoom level of the map view
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the geographical bounds visible in the current map view
+
+
+
+ getMinZoom()
+ Number
+ Returns the minimum zoom level of the map (if set in the minZoom option of the map or of any layers), or 0 by default.
+
+
+
+ getMaxZoom()
+ Number
+ Returns the maximum zoom level of the map (if set in the maxZoom option of the map or of any layers).
+
+
+
+ getBoundsZoom(<LatLngBounds> bounds, <Boolean> inside?, <Point> padding?)
+ Number
+ Returns the maximum zoom level on which the given bounds fit to the map
+view in its entirety. If inside (optional) is set to true, the method
+instead returns the minimum zoom level on which the map view fits into
+the given bounds in its entirety.
+
+
+
+ getSize()
+ Point
+ Returns the current size of the map container (in pixels).
+
+
+
+ getPixelBounds()
+ Bounds
+ Returns the bounds of the current map view in projected pixel
+coordinates (sometimes useful in layer and overlay implementations).
+
+
+
+ getPixelOrigin()
+ Point
+ Returns the projected pixel coordinates of the top left point of
+the map layer (useful in custom layer and overlay implementations).
+
+
+
+ getPixelWorldBounds(<Number> zoom?)
+ Bounds
+ Returns the world's bounds in pixel coordinates for zoom level zoom.
+If zoom is omitted, the map's current zoom level is used.
+
+
+
+
+
+
+Conversion Methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getZoomScale(<Number> toZoom, <Number> fromZoom)
+ Number
+ Returns the scale factor to be applied to a map transition from zoom level
+fromZoom to toZoom. Used internally to help with zoom animations.
+
+
+
+ getScaleZoom(<Number> scale, <Number> fromZoom)
+ Number
+ Returns the zoom level that the map would end up at, if it is at fromZoom
+level and everything is scaled by a factor of scale. Inverse of
+getZoomScale.
+
+
+
+ project(<LatLng> latlng, <Number> zoom)
+ Point
+ Projects a geographical coordinate LatLng according to the projection
+of the map's CRS, then scales it according to zoom and the CRS's
+Transformation. The result is pixel coordinate relative to
+the CRS origin.
+
+
+
+ unproject(<Point> point, <Number> zoom)
+ LatLng
+ Inverse of project.
+
+
+
+ layerPointToLatLng(<Point> point)
+ LatLng
+ Given a pixel coordinate relative to the origin pixel,
+returns the corresponding geographical coordinate (for the current zoom level).
+
+
+
+ latLngToLayerPoint(<LatLng> latlng)
+ Point
+ Given a geographical coordinate, returns the corresponding pixel coordinate
+relative to the origin pixel.
+
+
+
+ wrapLatLng(<LatLng> latlng)
+ LatLng
+ Returns a LatLng where lat and lng has been wrapped according to the
+map's CRS's wrapLat and wrapLng properties, if they are outside the
+CRS's bounds.
+By default this means longitude is wrapped around the dateline so its
+value is between -180 and +180 degrees.
+
+
+
+ wrapLatLngBounds(<LatLngBounds> bounds)
+ LatLngBounds
+ Returns a LatLngBounds with the same size as the given one, ensuring that
+its center is within the CRS's bounds.
+By default this means the center longitude is wrapped around the dateline so its
+value is between -180 and +180 degrees, and the majority of the bounds
+overlaps the CRS's bounds.
+
+
+
+ distance(<LatLng> latlng1, <LatLng> latlng2)
+ Number
+ Returns the distance between two geographical coordinates according to
+the map's CRS. By default this measures distance in meters.
+
+
+
+ containerPointToLayerPoint(<Point> point)
+ Point
+ Given a pixel coordinate relative to the map container, returns the corresponding
+pixel coordinate relative to the origin pixel.
+
+
+
+ layerPointToContainerPoint(<Point> point)
+ Point
+ Given a pixel coordinate relative to the origin pixel,
+returns the corresponding pixel coordinate relative to the map container.
+
+
+
+ containerPointToLatLng(<Point> point)
+ LatLng
+ Given a pixel coordinate relative to the map container, returns
+the corresponding geographical coordinate (for the current zoom level).
+
+
+
+ latLngToContainerPoint(<LatLng> latlng)
+ Point
+ Given a geographical coordinate, returns the corresponding pixel coordinate
+relative to the map container.
+
+
+
+ mouseEventToContainerPoint(<MouseEvent> ev)
+ Point
+ Given a MouseEvent object, returns the pixel coordinate relative to the
+map container where the event took place.
+
+
+
+ mouseEventToLayerPoint(<MouseEvent> ev)
+ Point
+ Given a MouseEvent object, returns the pixel coordinate relative to
+the origin pixel where the event took place.
+
+
+
+ mouseEventToLatLng(<MouseEvent> ev)
+ LatLng
+ Given a MouseEvent object, returns geographical coordinate where the
+event took place.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Properties
+
+
+
+Controls
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ zoomControl
+ Control.Zoom
+ The default zoom control (only available if the
+zoomControl option was true when creating the map).
+
+
+
+
+
+Handlers
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ boxZoom
+ Handler
+ Box (shift-drag with mouse) zoom handler.
+
+
+ doubleClickZoom
+ Handler
+ Double click zoom handler.
+
+
+ dragging
+ Handler
+ Map dragging handler (by both mouse and touch).
+
+
+ keyboard
+ Handler
+ Keyboard navigation handler.
+
+
+ scrollWheelZoom
+ Handler
+ Scroll wheel zoom handler.
+
+
+ tap
+ Handler
+ Mobile touch hacks (quick tap and touch hold) handler.
+
+
+ touchZoom
+ Handler
+ Touch zoom handler.
+
+
+
+
+
+
+
+Map panes
+
+
+
+
+
+Panes are DOM elements used to control the ordering of layers on the map. You
+can access panes with map.getPane or
+map.getPanes methods. New panes can be created with the
+map.createPane method.
+Every map has the following default panes that differ only in zIndex.
+
+
+
+ Pane
+ Type
+ Z-index
+ Description
+
+
+
+ mapPane
+ HTMLElement
+ 'auto'
+ Pane that contains all other map panes
+
+
+ tilePane
+ HTMLElement
+ 200
+ Pane for GridLayers and TileLayers
+
+
+ overlayPane
+ HTMLElement
+ 400
+ Pane for vectors (Paths, like Polylines and Polygons), ImageOverlays and VideoOverlays
+
+
+ shadowPane
+ HTMLElement
+ 500
+ Pane for overlay shadows (e.g. Marker shadows)
+
+
+ markerPane
+ HTMLElement
+ 600
+ Pane for Icons of Markers
+
+
+ tooltipPane
+ HTMLElement
+ 650
+ Pane for Tooltips.
+
+
+ popupPane
+ HTMLElement
+ 700
+ Pane for Popups.
+
+
+
+
+
+
+
+
+
+Locate options
+
+
+
+
+
+Some of the geolocation methods for Map take in an options parameter. This
+is a plain javascript object with the following optional components:
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ watch
+ Boolean
+ false
+ If true, starts continuous watching of location changes (instead of detecting it
+once) using W3C watchPosition method. You can later stop watching using
+map.stopLocate() method.
+
+
+ setView
+ Boolean
+ false
+ If true, automatically sets the map view to the user location with respect to
+detection accuracy, or to world view if geolocation failed.
+
+
+ maxZoom
+ Number
+ Infinity
+ The maximum zoom for automatic view setting when using setView option.
+
+
+ timeout
+ Number
+ 10000
+ Number of milliseconds to wait for a response from geolocation before firing a
+locationerror event.
+
+
+ maximumAge
+ Number
+ 0
+ Maximum age of detected location. If less than this amount of milliseconds
+passed since last geolocation response, locate will return a cached location.
+
+
+ enableHighAccuracy
+ Boolean
+ false
+ Enables high accuracy, see description in the W3C spec.
+
+
+
+
+
+
+
+
+
+Zoom options
+
+
+
+
+
+Some of the Map methods which modify the zoom level take in an options
+parameter. This is a plain javascript object with the following optional
+components:
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If not specified, zoom animation will happen if the zoom origin is inside the
+current view. If true, the map will attempt animating zoom disregarding where
+zoom origin is. Setting false will make it always reset the view completely
+without animation.
+
+
+
+
+
+
+
+
+
+Pan options
+
+
+
+
+
+Some of the Map methods which modify the center of the map take in an options
+parameter. This is a plain javascript object with the following optional
+components:
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If true, panning will always be animated if possible. If false, it will
+not animate panning, either resetting the map view if panning more than a
+screen away, or just setting a new offset for the map pane (except for panBy
+which always does the latter).
+
+
+ duration
+ Number
+ 0.25
+ Duration of animated panning, in seconds.
+
+
+ easeLinearity
+ Number
+ 0.25
+ The curvature factor of panning animation easing (third parameter of the
+Cubic Bezier curve). 1.0 means linear animation,
+and the smaller this number, the more bowed the curve.
+
+
+ noMoveStart
+ Boolean
+ false
+ If true, panning won't fire movestart event on start (used internally for
+panning inertia).
+
+
+
+
+
+
+
+
+
+Zoom/pan options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If not specified, zoom animation will happen if the zoom origin is inside the
+current view. If true, the map will attempt animating zoom disregarding where
+zoom origin is. Setting false will make it always reset the view completely
+without animation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ duration
+ Number
+ 0.25
+ Duration of animated panning, in seconds.
+
+
+ easeLinearity
+ Number
+ 0.25
+ The curvature factor of panning animation easing (third parameter of the
+Cubic Bezier curve). 1.0 means linear animation,
+and the smaller this number, the more bowed the curve.
+
+
+ noMoveStart
+ Boolean
+ false
+ If true, panning won't fire movestart event on start (used internally for
+panning inertia).
+
+
+
+
+
+
+
+
+
+
+FitBounds options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ paddingTopLeft
+ Point
+ [0, 0]
+ Sets the amount of padding in the top left corner of a map container that
+shouldn't be accounted for when setting the view to fit bounds. Useful if you
+have some control overlays on the map like a sidebar and you don't want them
+to obscure objects you're zooming to.
+
+
+ paddingBottomRight
+ Point
+ [0, 0]
+ The same for the bottom right corner of the map.
+
+
+ padding
+ Point
+ [0, 0]
+ Equivalent of setting both top left and bottom right padding to the same value.
+
+
+ maxZoom
+ Number
+ null
+ The maximum possible zoom to use.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If not specified, zoom animation will happen if the zoom origin is inside the
+current view. If true, the map will attempt animating zoom disregarding where
+zoom origin is. Setting false will make it always reset the view completely
+without animation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ duration
+ Number
+ 0.25
+ Duration of animated panning, in seconds.
+
+
+ easeLinearity
+ Number
+ 0.25
+ The curvature factor of panning animation easing (third parameter of the
+Cubic Bezier curve). 1.0 means linear animation,
+and the smaller this number, the more bowed the curve.
+
+
+ noMoveStart
+ Boolean
+ false
+ If true, panning won't fire movestart event on start (used internally for
+panning inertia).
+
+
+
+
+
+
+
+ Marker
L.Marker is used to display clickable/draggable icons on the map. Extends Layer.
+
+
+Usage example
+
+
+
+
+
+
+
+L.marker([50.5, 30.5]).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.marker(<LatLng> latlng, <Marker options> options?)
+ Instantiates a Marker object given a geographical point and optionally an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ icon
+ Icon
+ *
+ Icon instance to use for rendering the marker.
+See Icon documentation for details on how to customize the marker icon.
+If not specified, a common instance of L.Icon.Default is used.
+
+
+ keyboard
+ Boolean
+ true
+ Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
+
+
+ title
+ String
+ ''
+ Text for the browser tooltip that appear on marker hover (no tooltip by default).
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the icon image (useful for accessibility).
+
+
+ zIndexOffset
+ Number
+ 0
+ By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the marker.
+
+
+ riseOnHover
+ Boolean
+ false
+ If true, the marker will get on top of others when you hover the mouse over it.
+
+
+ riseOffset
+ Number
+ 250
+ The z-index offset used for the riseOnHover feature.
+
+
+ pane
+ String
+ 'markerPane'
+ Map pane where the markers icon will be added.
+Map pane where the markers shadow will be added.
+
+
+ bubblingMouseEvents
+ Boolean
+ false
+ When true, a mouse event on this marker will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+Draggable marker options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ draggable
+ Boolean
+ false
+ Whether the marker is draggable with mouse/touch or not.
+
+
+ autoPan
+ Boolean
+ false
+ Whether to pan the map when dragging this marker near its edge or not.
+
+
+ autoPanPadding
+ Point
+ Point(50, 50)
+ Distance (in pixels to the left/right and to the top/bottom) of the
+map edge to start panning the map.
+
+
+ autoPanSpeed
+ Number
+ 10
+ Number of pixels the map should pan by.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+In addition to shared layer methods like addTo() and remove() and popup methods like bindPopup() you can also use the following methods:
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ move
+ Event
+ Fired when the marker is moved via setLatLng or by dragging. Old and new coordinates are included in event arguments as oldLatLng, latlng.
+
+
+
+
+
+Dragging events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ dragstart
+ Event
+ Fired when the user starts dragging the marker.
+
+
+ movestart
+ Event
+ Fired when the marker starts moving (because of dragging).
+
+
+ drag
+ Event
+ Fired repeatedly while the user drags the marker.
+
+
+ dragend
+ DragEndEvent
+ Fired when the user stops dragging the marker.
+
+
+ moveend
+ Event
+ Fired when the marker stops moving (because of dragging).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the marker (as a GeoJSON Point Feature).
+
+
+
+ getLatLng()
+ LatLng
+ Returns the current geographical position of the marker.
+
+
+
+ setLatLng(<LatLng> latlng)
+ this
+ Changes the marker position to the given point.
+
+
+
+ setZIndexOffset(<Number> offset)
+ this
+ Changes the zIndex offset of the marker.
+
+
+
+ getIcon()
+ Icon
+ Returns the current icon used by the marker
+
+
+
+ setIcon(<Icon> icon)
+ this
+ Changes the marker icon.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the marker.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Properties
+
+
+
+Interaction handlers
+
+Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see Handler methods). Example:
+marker.dragging.disable();
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ dragging
+ Handler
+ Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set marker.options.draggable).
+
+
+
+
+
+
+ Popup
Used to open popups in certain places of the map. Use Map.openPopup to
+open popups while making sure that only one popup is open at one time
+(recommended for usability), or use Map.addLayer to open as many as you want.
+
+
+Usage example
+
+
+
+
+
+
+
+If you want to just bind a popup to marker click and then open it, it's really easy:
+marker.bindPopup(popupContent).openPopup();
+
+Path overlays like polylines also have a bindPopup method.
+Here's a more complicated way to open a popup on a map:
+var popup = L.popup()
+ .setLatLng(latlng)
+ .setContent('<p>Hello world!<br />This is a nice popup.</p>')
+ .openOn(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.popup(<Popup options> options?, <Layer> source?)
+ Instantiates a Popup object given an optional options object that describes its appearance and location and an optional source object that is used to tag the popup with a reference to the Layer to which it refers.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ maxWidth
+ Number
+ 300
+ Max width of the popup, in pixels.
+
+
+ minWidth
+ Number
+ 50
+ Min width of the popup, in pixels.
+
+
+ maxHeight
+ Number
+ null
+ If set, creates a scrollable container of the given height
+inside a popup if its content exceeds it.
+
+
+ autoPan
+ Boolean
+ true
+ Set it to false if you don't want the map to do panning animation
+to fit the opened popup.
+
+
+ autoPanPaddingTopLeft
+ Point
+ null
+ The margin between the popup and the top left corner of the map
+view after autopanning was performed.
+
+
+ autoPanPaddingBottomRight
+ Point
+ null
+ The margin between the popup and the bottom right corner of the map
+view after autopanning was performed.
+
+
+ autoPanPadding
+ Point
+ Point(5, 5)
+ Equivalent of setting both top left and bottom right autopan padding to the same value.
+
+
+ keepInView
+ Boolean
+ false
+ Set it to true if you want to prevent users from panning the popup
+off of the screen while it is open.
+
+
+ closeButton
+ Boolean
+ true
+ Controls the presence of a close button in the popup.
+
+
+ autoClose
+ Boolean
+ true
+ Set it to false if you want to override the default behavior of
+the popup closing when another popup is opened.
+
+
+ closeOnEscapeKey
+ Boolean
+ true
+ Set it to false if you want to override the default behavior of
+the ESC key for closing of the popup.
+
+
+ closeOnClick
+ Boolean
+ *
+ Set it if you want to override the default behavior of the popup closing when user clicks
+on the map. Defaults to the map's closePopupOnClick option.
+
+
+ className
+ String
+ ''
+ A custom CSS class name to assign to the popup.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ offset
+ Point
+ Point(0, 7)
+ The offset of the popup position. Useful to control the anchor
+of the popup when opening it on some overlays.
+
+
+ pane
+ String
+ 'popupPane'
+ Map pane where the popup will be added.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getLatLng()
+ LatLng
+ Returns the geographical point of popup.
+
+
+
+ setLatLng(<LatLng> latlng)
+ this
+ Sets the geographical point where the popup will open.
+
+
+
+ getContent()
+ String|HTMLElement
+ Returns the content of the popup.
+
+
+
+ setContent(<String|HTMLElement|Function> htmlContent)
+ this
+ Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a String or HTMLElement to be used in the popup.
+
+
+
+ getElement()
+ String|HTMLElement
+ Alias for getContent()
+
+
+
+ update()
+ null
+ Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
+
+
+
+ isOpen()
+ Boolean
+ Returns true when the popup is visible on the map.
+
+
+
+ bringToFront()
+ this
+ Brings this popup in front of other popups (in the same map pane).
+
+
+
+ bringToBack()
+ this
+ Brings this popup to the back of other popups (in the same map pane).
+
+
+
+ openOn(<Map> map)
+ this
+ Adds the popup to the map and closes the previous one. The same as map.openPopup(popup).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Tooltip
Used to display small texts on top of map layers.
+
+
+Usage example
+
+
+
+
+
+
+
+marker.bindTooltip("my tooltip text").openTooltip();
+
+Note about tooltip offset. Leaflet takes two options in consideration
+for computing tooltip offsetting:
+
+- the
offset Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
+Add a positive x offset to move the tooltip to the right, and a positive y offset to
+move it to the bottom. Negatives will move to the left and top.
+- the
tooltipAnchor Icon option: this will only be considered for Marker. You
+should adapt this value if you use a custom icon.
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.tooltip(<Tooltip options> options?, <Layer> source?)
+ Instantiates a Tooltip object given an optional options object that describes its appearance and location and an optional source object that is used to tag the tooltip with a reference to the Layer to which it refers.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'tooltipPane'
+ Map pane where the tooltip will be added.
+
+
+ offset
+ Point
+ Point(0, 0)
+ Optional offset of the tooltip position.
+
+
+ direction
+ String
+ 'auto'
+ Direction where to open the tooltip. Possible values are: right, left,
+top, bottom, center, auto.
+auto will dynamically switch between right and left according to the tooltip
+position on the map.
+
+
+ permanent
+ Boolean
+ false
+ Whether to open the tooltip permanently or only on mouseover.
+
+
+ sticky
+ Boolean
+ false
+ If true, the tooltip will follow the mouse instead of being fixed at the feature center.
+
+
+ interactive
+ Boolean
+ false
+ If true, the tooltip will listen to the feature events.
+
+
+ opacity
+ Number
+ 0.9
+ Tooltip container opacity.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ className
+ String
+ ''
+ A custom CSS class name to assign to the popup.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ TileLayer
Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under Layer. Extends GridLayer.
+
+
+Usage example
+
+
+
+
+
+
+
+L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
+
+
+
+
+
+
+URL template
+
+
+
+A string of the following form:
+'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'
+
{s} means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; a, b or c by default, can be omitted), {z} — zoom level, {x} and {y} — tile coordinates. {r} can be used to add "@2x" to the URL to load retina tiles.
+You can use custom keys in the template, which will be evaluated from TileLayer options, like this:
+L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});
+
+
+
+
+
+
+
+Creation
+
+
+
+Extension methods
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.tilelayer(<String> urlTemplate, <TileLayer options> options?)
+ Instantiates a tile layer object given a URL template and optionally an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ minZoom
+ Number
+ 0
+ The minimum zoom level down to which this layer will be displayed (inclusive).
+
+
+ maxZoom
+ Number
+ 18
+ The maximum zoom level up to which this layer will be displayed (inclusive).
+
+
+ subdomains
+ String|String[]
+ 'abc'
+ Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
+
+
+ errorTileUrl
+ String
+ ''
+ URL to the tile image to show in place of the tile that failed to load.
+
+
+ zoomOffset
+ Number
+ 0
+ The zoom number used in tile URLs will be offset with this value.
+
+
+ tms
+ Boolean
+ false
+ If true, inverses Y axis numbering for tiles (turn this on for TMS services).
+
+
+ zoomReverse
+ Boolean
+ false
+ If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
+
+
+ detectRetina
+ Boolean
+ false
+ If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the tiles.
+If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
+Refer to CORS Settings for valid String values.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tileSize
+ Number|Point
+ 256
+ Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
+
+
+ opacity
+ Number
+ 1.0
+ Opacity of the tiles. Can be used in the createTile() function.
+
+
+ updateWhenIdle
+ Boolean
+ (depends)
+ Load new tiles only when panning ends.
+true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
+false otherwise in order to display new tiles during panning, since it is easy to pan outside the
+keepBuffer option in desktop browsers.
+
+
+ updateWhenZooming
+ Boolean
+ true
+ By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
+
+
+ updateInterval
+ Number
+ 200
+ Tiles will not update more than once every updateInterval milliseconds when panning.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the tile layer.
+
+
+ bounds
+ LatLngBounds
+ undefined
+ If set, tiles will only be loaded inside the set LatLngBounds.
+
+
+ maxNativeZoom
+ Number
+ undefined
+ Maximum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels higher than maxNativeZoom will be loaded
+from maxNativeZoom level and auto-scaled.
+
+
+ minNativeZoom
+ Number
+ undefined
+ Minimum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels lower than minNativeZoom will be loaded
+from minNativeZoom level and auto-scaled.
+
+
+ noWrap
+ Boolean
+ false
+ Whether the layer is wrapped around the antimeridian. If true, the
+GridLayer will only be displayed once at low zoom levels. Has no
+effect when the map CRS doesn't wrap around. Can be used
+in combination with bounds to prevent requesting
+tiles outside the CRS limits.
+
+
+ pane
+ String
+ 'tilePane'
+ Map pane where the grid layer will be added.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the tile layer. Empty by default.
+
+
+ keepBuffer
+ Number
+ 2
+ When panning the map, keep this many rows and columns of tiles before unloading them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ loading
+ Event
+ Fired when the grid layer starts loading tiles.
+
+
+ tileunload
+ TileEvent
+ Fired when a tile is removed (e.g. when a tile goes off the screen).
+
+
+ tileloadstart
+ TileEvent
+ Fired when a tile is requested and starts loading.
+
+
+ tileerror
+ TileErrorEvent
+ Fired when there is an error loading a tile.
+
+
+ tileload
+ TileEvent
+ Fired when a tile loads.
+
+
+ load
+ Event
+ Fired when the grid layer loaded all visible tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setUrl(<String> url, <Boolean> noRedraw?)
+ this
+ Updates the layer's URL template and redraws it (unless noRedraw is set to true).
+If the URL does not change, the layer will not be redrawn unless
+the noRedraw parameter is set to false.
+
+
+
+ createTile(<Object> coords, <Function> done?)
+ HTMLElement
+ Called only internally, overrides GridLayer's createTile()
+to return an <img> HTML element with the appropriate image URL given coords. The done
+callback is called when the tile has been loaded.
+
+
+
+
+
+
+Extension methods
+
+Layers extending TileLayer might reimplement the following method.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getTileUrl(<Object> coords)
+ String
+ Called only internally, returns the URL for a tile given its coordinates.
+Classes extending TileLayer can override this function to provide custom tile URL naming schemes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the tile layer to the top of all tile layers.
+
+
+
+ bringToBack()
+ this
+ Brings the tile layer to the bottom of all tile layers.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the tiles for this layer.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the grid layer.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Changes the zIndex of the grid layer.
+
+
+
+ isLoading()
+ Boolean
+ Returns true if any tile in the grid layer has not finished loading.
+
+
+
+ redraw()
+ this
+ Causes the layer to clear all the tiles and request them again.
+
+
+
+ getTileSize()
+ Point
+ Normalizes the tileSize option into a point. Used by the createTile() method.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ TileLayer.WMS
Used to display WMS services as tile layers on the map. Extends TileLayer.
+
+
+Usage example
+
+
+
+
+
+
+
+var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", {
+ layers: 'nexrad-n0r-900913',
+ format: 'image/png',
+ transparent: true,
+ attribution: "Weather data © 2012 IEM Nexrad"
+});
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.tileLayer.wms(<String> baseUrl, <TileLayer.WMS options> options)
+ Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+If any custom options not documented here are used, they will be sent to the
+WMS server as extra parameters in each request URL. This can be useful for
+non-standard vendor WMS parameters.
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ layers
+ String
+ ''
+ (required) Comma-separated list of WMS layers to show.
+
+
+ styles
+ String
+ ''
+ Comma-separated list of WMS styles.
+
+
+ format
+ String
+ 'image/jpeg'
+ WMS image format (use 'image/png' for layers with transparency).
+
+
+ transparent
+ Boolean
+ false
+ If true, the WMS service will return images with transparency.
+
+
+ version
+ String
+ '1.1.1'
+ Version of the WMS service to use
+
+
+ crs
+ CRS
+ null
+ Coordinate Reference System to use for the WMS requests, defaults to
+map CRS. Don't change this if you're not sure what it means.
+
+
+ uppercase
+ Boolean
+ false
+ If true, WMS request parameter keys will be uppercase.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ minZoom
+ Number
+ 0
+ The minimum zoom level down to which this layer will be displayed (inclusive).
+
+
+ maxZoom
+ Number
+ 18
+ The maximum zoom level up to which this layer will be displayed (inclusive).
+
+
+ subdomains
+ String|String[]
+ 'abc'
+ Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
+
+
+ errorTileUrl
+ String
+ ''
+ URL to the tile image to show in place of the tile that failed to load.
+
+
+ zoomOffset
+ Number
+ 0
+ The zoom number used in tile URLs will be offset with this value.
+
+
+ tms
+ Boolean
+ false
+ If true, inverses Y axis numbering for tiles (turn this on for TMS services).
+
+
+ zoomReverse
+ Boolean
+ false
+ If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
+
+
+ detectRetina
+ Boolean
+ false
+ If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the tiles.
+If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
+Refer to CORS Settings for valid String values.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tileSize
+ Number|Point
+ 256
+ Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
+
+
+ opacity
+ Number
+ 1.0
+ Opacity of the tiles. Can be used in the createTile() function.
+
+
+ updateWhenIdle
+ Boolean
+ (depends)
+ Load new tiles only when panning ends.
+true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
+false otherwise in order to display new tiles during panning, since it is easy to pan outside the
+keepBuffer option in desktop browsers.
+
+
+ updateWhenZooming
+ Boolean
+ true
+ By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
+
+
+ updateInterval
+ Number
+ 200
+ Tiles will not update more than once every updateInterval milliseconds when panning.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the tile layer.
+
+
+ bounds
+ LatLngBounds
+ undefined
+ If set, tiles will only be loaded inside the set LatLngBounds.
+
+
+ maxNativeZoom
+ Number
+ undefined
+ Maximum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels higher than maxNativeZoom will be loaded
+from maxNativeZoom level and auto-scaled.
+
+
+ minNativeZoom
+ Number
+ undefined
+ Minimum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels lower than minNativeZoom will be loaded
+from minNativeZoom level and auto-scaled.
+
+
+ noWrap
+ Boolean
+ false
+ Whether the layer is wrapped around the antimeridian. If true, the
+GridLayer will only be displayed once at low zoom levels. Has no
+effect when the map CRS doesn't wrap around. Can be used
+in combination with bounds to prevent requesting
+tiles outside the CRS limits.
+
+
+ pane
+ String
+ 'tilePane'
+ Map pane where the grid layer will be added.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the tile layer. Empty by default.
+
+
+ keepBuffer
+ Number
+ 2
+ When panning the map, keep this many rows and columns of tiles before unloading them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ loading
+ Event
+ Fired when the grid layer starts loading tiles.
+
+
+ tileunload
+ TileEvent
+ Fired when a tile is removed (e.g. when a tile goes off the screen).
+
+
+ tileloadstart
+ TileEvent
+ Fired when a tile is requested and starts loading.
+
+
+ tileerror
+ TileErrorEvent
+ Fired when there is an error loading a tile.
+
+
+ tileload
+ TileEvent
+ Fired when a tile loads.
+
+
+ load
+ Event
+ Fired when the grid layer loaded all visible tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setParams(<Object> params, <Boolean> noRedraw?)
+ this
+ Merges an object with the new parameters and re-requests tiles on the current screen (unless noRedraw was set to true).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setUrl(<String> url, <Boolean> noRedraw?)
+ this
+ Updates the layer's URL template and redraws it (unless noRedraw is set to true).
+If the URL does not change, the layer will not be redrawn unless
+the noRedraw parameter is set to false.
+
+
+
+ createTile(<Object> coords, <Function> done?)
+ HTMLElement
+ Called only internally, overrides GridLayer's createTile()
+to return an <img> HTML element with the appropriate image URL given coords. The done
+callback is called when the tile has been loaded.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the tile layer to the top of all tile layers.
+
+
+
+ bringToBack()
+ this
+ Brings the tile layer to the bottom of all tile layers.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the tiles for this layer.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the grid layer.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Changes the zIndex of the grid layer.
+
+
+
+ isLoading()
+ Boolean
+ Returns true if any tile in the grid layer has not finished loading.
+
+
+
+ redraw()
+ this
+ Causes the layer to clear all the tiles and request them again.
+
+
+
+ getTileSize()
+ Point
+ Normalizes the tileSize option into a point. Used by the createTile() method.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ ImageOverlay
Used to load and display a single image over specific bounds of the map. Extends Layer.
+
+
+Usage example
+
+
+
+
+
+
+
+var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
+ imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
+L.imageOverlay(imageUrl, imageBounds).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.imageOverlay(<String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options?)
+ Instantiates an image overlay object given the URL of the image and the
+geographical bounds it is tied to.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the image overlay.
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the image (useful for accessibility).
+
+
+ interactive
+ Boolean
+ false
+ If true, the image overlay will emit mouse events when clicked or hovered.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the image.
+If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
+Refer to CORS Settings for valid String values.
+
+
+ errorOverlayUrl
+ String
+ ''
+ URL to the overlay image to show in place of the overlay that failed to load.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the overlay layer.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the image. Empty by default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ load
+ Event
+ Fired when the ImageOverlay layer has loaded its image
+
+
+ error
+ Event
+ Fired when the ImageOverlay layer fails to load its image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Sets the opacity of the overlay.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all overlays.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all overlays.
+
+
+
+ setUrl(<String> url)
+ this
+ Changes the URL of the image.
+
+
+
+ setBounds(<LatLngBounds> bounds)
+ this
+ Update the bounds that this ImageOverlay covers
+
+
+
+ setZIndex(<Number> value)
+ this
+ Changes the zIndex of the image overlay.
+
+
+
+ getBounds()
+ LatLngBounds
+ Get the bounds that this ImageOverlay covers
+
+
+
+ getElement()
+ HTMLElement
+ Returns the instance of HTMLImageElement
+used by this overlay.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ VideoOverlay
Used to load and display a video player over specific bounds of the map. Extends ImageOverlay.
+A video overlay uses the <video>
+HTML5 element.
+
+
+Usage example
+
+
+
+
+
+
+
+var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
+ videoBounds = [[ 32, -130], [ 13, -100]];
+L.videoOverlay(videoUrl, videoBounds ).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.videoOverlay(<String|Array|HTMLVideoElement> video, <LatLngBounds> bounds, <VideoOverlay options> options?)
+ Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
+geographical bounds it is tied to.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ autoplay
+ Boolean
+ true
+ Whether the video starts playing automatically when loaded.
+
+
+ loop
+ Boolean
+ true
+ Whether the video will loop back to the beginning when played.
+
+
+ keepAspectRatio
+ Boolean
+ true
+ Whether the video will save aspect ratio after the projection.
+Relevant for supported browsers. Browser compatibility- https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the image overlay.
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the image (useful for accessibility).
+
+
+ interactive
+ Boolean
+ false
+ If true, the image overlay will emit mouse events when clicked or hovered.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the image.
+If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
+Refer to CORS Settings for valid String values.
+
+
+ errorOverlayUrl
+ String
+ ''
+ URL to the overlay image to show in place of the overlay that failed to load.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the overlay layer.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the image. Empty by default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ load
+ Event
+ Fired when the video has finished loading the first frame
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ error
+ Event
+ Fired when the ImageOverlay layer fails to load its image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getElement()
+ HTMLVideoElement
+ Returns the instance of HTMLVideoElement
+used by this overlay.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Sets the opacity of the overlay.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all overlays.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all overlays.
+
+
+
+ setUrl(<String> url)
+ this
+ Changes the URL of the image.
+
+
+
+ setBounds(<LatLngBounds> bounds)
+ this
+ Update the bounds that this ImageOverlay covers
+
+
+
+ setZIndex(<Number> value)
+ this
+ Changes the zIndex of the image overlay.
+
+
+
+ getBounds()
+ LatLngBounds
+ Get the bounds that this ImageOverlay covers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ SVGOverlay
Used to load, display and provide DOM access to an SVG file over specific bounds of the map. Extends ImageOverlay.
+An SVG overlay uses the <svg> element.
+
+
+Usage example
+
+
+
+
+
+
+
+var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg");
+svgElement.setAttribute('viewBox', "0 0 200 200");
+svgElement.innerHTML = '<rect width="200" height="200"/><rect x="75" y="23" width="50" height="50" style="fill:red"/><rect x="75" y="123" width="50" height="50" style="fill:#0013ff"/>';
+var svgElementBounds = [ [ 32, -130 ], [ 13, -100 ] ];
+L.svgOverlay(svgElement, svgElementBounds).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.svgOverlay(<String|SVGElement> svg, <LatLngBounds> bounds, <SVGOverlay options> options?)
+ Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to.
+A viewBox attribute is required on the SVG element to zoom in and out properly.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the image overlay.
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the image (useful for accessibility).
+
+
+ interactive
+ Boolean
+ false
+ If true, the image overlay will emit mouse events when clicked or hovered.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the image.
+If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
+Refer to CORS Settings for valid String values.
+
+
+ errorOverlayUrl
+ String
+ ''
+ URL to the overlay image to show in place of the overlay that failed to load.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the overlay layer.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the image. Empty by default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getElement()
+ SVGElement
+ Returns the instance of SVGElement
+used by this overlay.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Sets the opacity of the overlay.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all overlays.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all overlays.
+
+
+
+ setUrl(<String> url)
+ this
+ Changes the URL of the image.
+
+
+
+ setBounds(<LatLngBounds> bounds)
+ this
+ Update the bounds that this ImageOverlay covers
+
+
+
+ setZIndex(<Number> value)
+ this
+ Changes the zIndex of the image overlay.
+
+
+
+ getBounds()
+ LatLngBounds
+ Get the bounds that this ImageOverlay covers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Path
An abstract class that contains options and constants shared between vector
+overlays (Polygon, Polyline, Circle). Do not use it directly. Extends Layer.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Polyline
A class for drawing polyline overlays on a map. Extends Path.
+
+
+Usage example
+
+
+
+
+
+
+
+// create a red polyline from an array of LatLng points
+var latlngs = [
+ [45.51, -122.68],
+ [37.77, -122.43],
+ [34.04, -118.2]
+];
+var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
+// zoom the map to the polyline
+map.fitBounds(polyline.getBounds());
+
+You can also pass a multi-dimensional array to represent a MultiPolyline shape:
+// create a red polyline from an array of arrays of LatLng points
+var latlngs = [
+ [[45.51, -122.68],
+ [37.77, -122.43],
+ [34.04, -118.2]],
+ [[40.78, -73.91],
+ [41.83, -87.62],
+ [32.76, -96.72]]
+];
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.polyline(<LatLng[]> latlngs, <Polyline options> options?)
+ Instantiates a polyline object given an array of geographical points and
+optionally an options object. You can create a Polyline object with
+multiple separate lines (MultiPolyline) by passing an array of arrays
+of geographic points.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ smoothFactor
+ Number
+ 1.0
+ How much to simplify the polyline on each zoom level. More means
+better performance and smoother look, and less means more accurate representation.
+
+
+ noClip
+ Boolean
+ false
+ Disable polyline clipping.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the polyline (as a GeoJSON LineString or MultiLineString Feature).
+
+
+
+ getLatLngs()
+ LatLng[]
+ Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
+
+
+
+ setLatLngs(<LatLng[]> latlngs)
+ this
+ Replaces all the points in the polyline with the given array of geographical points.
+
+
+
+ isEmpty()
+ Boolean
+ Returns true if the Polyline has no LatLngs.
+
+
+
+ closestLayerPoint(<Point> p)
+ Point
+ Returns the point closest to p on the Polyline.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center (centroid) of the polyline.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+ addLatLng(<LatLng> latlng)
+ this
+ Adds a given point to the polyline. By default, adds to the first ring of
+the polyline in case of a multi-polyline, but can be overridden by passing
+a specific ring as a LatLng array (that you can earlier access with getLatLngs).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Polygon
A class for drawing polygon overlays on a map. Extends Polyline.
+Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
+
+
+Usage example
+
+
+
+
+
+
+
+// create a red polygon from an array of LatLng points
+var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
+var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
+// zoom the map to the polygon
+map.fitBounds(polygon.getBounds());
+
+You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
+var latlngs = [
+ [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
+ [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
+];
+
+Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
+var latlngs = [
+ [ // first polygon
+ [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
+ [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
+ ],
+ [ // second polygon
+ [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
+ ]
+];
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.polygon(<LatLng[]> latlngs, <Polyline options> options?)
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ smoothFactor
+ Number
+ 1.0
+ How much to simplify the polyline on each zoom level. More means
+better performance and smoother look, and less means more accurate representation.
+
+
+ noClip
+ Boolean
+ false
+ Disable polyline clipping.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the polygon (as a GeoJSON Polygon or MultiPolygon Feature).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getLatLngs()
+ LatLng[]
+ Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
+
+
+
+ setLatLngs(<LatLng[]> latlngs)
+ this
+ Replaces all the points in the polyline with the given array of geographical points.
+
+
+
+ isEmpty()
+ Boolean
+ Returns true if the Polyline has no LatLngs.
+
+
+
+ closestLayerPoint(<Point> p)
+ Point
+ Returns the point closest to p on the Polyline.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center (centroid) of the polyline.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+ addLatLng(<LatLng> latlng)
+ this
+ Adds a given point to the polyline. By default, adds to the first ring of
+the polyline in case of a multi-polyline, but can be overridden by passing
+a specific ring as a LatLng array (that you can earlier access with getLatLngs).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Rectangle
A class for drawing rectangle overlays on a map. Extends Polygon.
+
+
+Usage example
+
+
+
+
+
+
+
+// define rectangle geographical bounds
+var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
+// create an orange rectangle
+L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
+// zoom the map to the rectangle bounds
+map.fitBounds(bounds);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.rectangle(<LatLngBounds> latLngBounds, <Polyline options> options?)
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ smoothFactor
+ Number
+ 1.0
+ How much to simplify the polyline on each zoom level. More means
+better performance and smoother look, and less means more accurate representation.
+
+
+ noClip
+ Boolean
+ false
+ Disable polyline clipping.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setBounds(<LatLngBounds> latLngBounds)
+ this
+ Redraws the rectangle with the passed bounds.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getLatLngs()
+ LatLng[]
+ Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
+
+
+
+ setLatLngs(<LatLng[]> latlngs)
+ this
+ Replaces all the points in the polyline with the given array of geographical points.
+
+
+
+ isEmpty()
+ Boolean
+ Returns true if the Polyline has no LatLngs.
+
+
+
+ closestLayerPoint(<Point> p)
+ Point
+ Returns the point closest to p on the Polyline.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center (centroid) of the polyline.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+ addLatLng(<LatLng> latlng)
+ this
+ Adds a given point to the polyline. By default, adds to the first ring of
+the polyline in case of a multi-polyline, but can be overridden by passing
+a specific ring as a LatLng array (that you can earlier access with getLatLngs).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Circle
A class for drawing circle overlays on a map. Extends CircleMarker.
+It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).
+
+
+Usage example
+
+
+
+
+
+
+
+L.circle([50.5, 30.5], {radius: 200}).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.circle(<LatLng> latlng, <Circle options> options?)
+ Instantiates a circle object given a geographical point, and an options object
+which contains the circle radius.
+
+
+ L.circle(<LatLng> latlng, <Number> radius, <Circle options> options?)
+ Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
+Do not use in new applications or plugins.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ radius
+ Number
+
+ Radius of the circle, in meters.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setRadius(<Number> radius)
+ this
+ Sets the radius of a circle. Units are in meters.
+
+
+
+ getRadius()
+ Number
+ Returns the current radius of a circle. Units are in meters.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
+
+
+
+ setLatLng(<LatLng> latLng)
+ this
+ Sets the position of a circle marker to a new location.
+
+
+
+ getLatLng()
+ LatLng
+ Returns the current geographical position of the circle marker
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ CircleMarker
A circle of a fixed size with radius specified in pixels. Extends Path.
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.circleMarker(<LatLng> latlng, <CircleMarker options> options?)
+ Instantiates a circle marker object given a geographical point, and an optional options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ radius
+ Number
+ 10
+ Radius of the circle marker, in pixels
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
+
+
+
+ setLatLng(<LatLng> latLng)
+ this
+ Sets the position of a circle marker to a new location.
+
+
+
+ getLatLng()
+ LatLng
+ Returns the current geographical position of the circle marker
+
+
+
+ setRadius(<Number> radius)
+ this
+ Sets the radius of a circle marker. Units are in pixels.
+
+
+
+ getRadius()
+ Number
+ Returns the current radius of the circle
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ SVG
VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
+with old versions of Internet Explorer.
+Allows vector layers to be displayed with SVG.
+Inherits Renderer.
+Due to technical limitations, SVG is not
+available in all web browsers, notably Android 2.x and 3.x.
+Although SVG is not available on IE7 and IE8, these browsers support
+VML
+(a now deprecated technology), and the SVG renderer will fall back to VML in
+this case.
+
+
+Usage example
+
+
+
+
+
+
+
+Use SVG by default for all paths in the map:
+var map = L.map('map', {
+ renderer: L.svg()
+});
+
+Use a SVG renderer with extra padding for specific vector geometries:
+var map = L.map('map');
+var myRenderer = L.svg({ padding: 0.5 });
+var line = L.polyline( coordinates, { renderer: myRenderer } );
+var circle = L.circle( center, { renderer: myRenderer } );
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.svg(<Renderer options> options?)
+ Creates a SVG renderer with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ padding
+ Number
+ 0.1
+ How much to extend the clip area around the map view (relative to its size)
+e.g. 0.1 would be 10% of map view in each direction
+
+
+ tolerance
+ Number
+ 0
+ How much to extend click tolerance round a path/object on the map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ update
+ Event
+ Fired when the renderer updates its bounds, center and zoom, for example when
+its map has moved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Functions
+
+
+
+
+
+There are several static functions which can be called without instantiating L.SVG:
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ create(<String> name)
+ SVGElement
+ Returns a instance of SVGElement,
+corresponding to the class name passed. For example, using 'line' will return
+an instance of SVGLineElement.
+
+
+ pointsToPath(<Point[]> rings, <Boolean> closed)
+ String
+ Generates a SVG path string for multiple rings, with each ring turning
+into "M..L..L.." instructions
+
+
+
+
+
+
+ Canvas
Allows vector layers to be displayed with <canvas>.
+Inherits Renderer.
+Due to technical limitations, Canvas is not
+available in all web browsers, notably IE8, and overlapping geometries might
+not display properly in some edge cases.
+
+
+Usage example
+
+
+
+
+
+
+
+Use Canvas by default for all paths in the map:
+var map = L.map('map', {
+ renderer: L.canvas()
+});
+
+Use a Canvas renderer with extra padding for specific vector geometries:
+var map = L.map('map');
+var myRenderer = L.canvas({ padding: 0.5 });
+var line = L.polyline( coordinates, { renderer: myRenderer } );
+var circle = L.circle( center, { renderer: myRenderer } );
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.canvas(<Renderer options> options?)
+ Creates a Canvas renderer with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ padding
+ Number
+ 0.1
+ How much to extend the clip area around the map view (relative to its size)
+e.g. 0.1 would be 10% of map view in each direction
+
+
+ tolerance
+ Number
+ 0
+ How much to extend click tolerance round a path/object on the map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ update
+ Event
+ Fired when the renderer updates its bounds, center and zoom, for example when
+its map has moved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ LayerGroup
Used to group several layers and handle them as one. If you add it to the map,
+any layers added or removed from the group will be added/removed on the map as
+well. Extends Layer.
+
+
+Usage example
+
+
+
+
+
+
+
+L.layerGroup([marker1, marker2])
+ .addLayer(polyline)
+ .addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.layerGroup(<Layer[]> layers?, <Object> options?)
+ Create a layer group, optionally given an initial set of layers and an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the group.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the group.
+
+
+
+ removeLayer(<Number> id)
+ this
+ Removes the layer with the given internal ID from the group.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the group.
+
+
+
+ hasLayer(<Number> id)
+ Boolean
+ Returns true if the given internal ID is currently added to the group.
+
+
+
+ clearLayers()
+ this
+ Removes all the layers from the group.
+
+
+
+ invoke(<String> methodName, …)
+ this
+ Calls methodName on every layer contained in this group, passing any
+additional parameters. Has no effect if the layers contained do not
+implement methodName.
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the group, optionally specifying context of the iterator function.
+group.eachLayer(function (layer) {
+ layer.bindPopup('Hello');
+});
+
+
+
+
+ getLayer(<Number> id)
+ Layer
+ Returns the layer with the given internal ID.
+
+
+
+ getLayers()
+ Layer[]
+ Returns an array of all the layers added to the group.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Calls setZIndex on every layer contained in this group, passing the z-index.
+
+
+
+ getLayerId(<Layer> layer)
+ Number
+ Returns the internal ID for a layer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ FeatureGroup
Extended LayerGroup that makes it easier to do the same thing to all its member layers:
+
+bindPopup binds a popup to all of the layers at once (likewise with bindTooltip)
+- Events are propagated to the
FeatureGroup, so if the group has an event
+handler, it will handle events from any of the layers. This includes mouse events
+and custom events.
+- Has
layeradd and layerremove events
+
+
+
+Usage example
+
+
+
+
+
+
+
+L.featureGroup([marker1, marker2, polyline])
+ .bindPopup('Hello world!')
+ .on('click', function() { alert('Clicked on a member of the group!'); })
+ .addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.featureGroup(<Layer[]> layers)
+ Create a feature group, optionally given an initial set of layers.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ layeradd
+ LayerEvent
+ Fired when a layer is added to this FeatureGroup
+
+
+ layerremove
+ LayerEvent
+ Fired when a layer is removed from this FeatureGroup
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setStyle(<Path options> style)
+ this
+ Sets the given path options to each layer of the group that has a setStyle method.
+
+
+
+ bringToFront()
+ this
+ Brings the layer group to the top of all other layers
+
+
+
+ bringToBack()
+ this
+ Brings the layer group to the back of all other layers
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the group.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the group.
+
+
+
+ removeLayer(<Number> id)
+ this
+ Removes the layer with the given internal ID from the group.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the group.
+
+
+
+ hasLayer(<Number> id)
+ Boolean
+ Returns true if the given internal ID is currently added to the group.
+
+
+
+ clearLayers()
+ this
+ Removes all the layers from the group.
+
+
+
+ invoke(<String> methodName, …)
+ this
+ Calls methodName on every layer contained in this group, passing any
+additional parameters. Has no effect if the layers contained do not
+implement methodName.
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the group, optionally specifying context of the iterator function.
+group.eachLayer(function (layer) {
+ layer.bindPopup('Hello');
+});
+
+
+
+
+ getLayer(<Number> id)
+ Layer
+ Returns the layer with the given internal ID.
+
+
+
+ getLayers()
+ Layer[]
+ Returns an array of all the layers added to the group.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Calls setZIndex on every layer contained in this group, passing the z-index.
+
+
+
+ getLayerId(<Layer> layer)
+ Number
+ Returns the internal ID for a layer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ GeoJSON
Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse
+GeoJSON data and display it on the map. Extends FeatureGroup.
+
+
+Usage example
+
+
+
+
+
+
+
+L.geoJSON(data, {
+ style: function (feature) {
+ return {color: feature.properties.color};
+ }
+}).bindPopup(function (layer) {
+ return layer.feature.properties.description;
+}).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.geoJSON(<Object> geojson?, <GeoJSON options> options?)
+ Creates a GeoJSON layer. Optionally accepts an object in
+GeoJSON format to display on the map
+(you can alternatively add it later with addData method) and an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pointToLayer
+ Function
+ *
+ A Function defining how GeoJSON points spawn Leaflet layers. It is internally
+called when data is added, passing the GeoJSON point feature and its LatLng.
+The default is to spawn a default Marker:
+function(geoJsonPoint, latlng) {
+ return L.marker(latlng);
+}
+
+
+
+ style
+ Function
+ *
+ A Function defining the Path options for styling GeoJSON lines and polygons,
+called internally when data is added.
+The default value is to not override any defaults:
+function (geoJsonFeature) {
+ return {}
+}
+
+
+
+ onEachFeature
+ Function
+ *
+ A Function that will be called once for each created Feature, after it has
+been created and styled. Useful for attaching events and popups to features.
+The default is to do nothing with the newly created layers:
+function (feature, layer) {}
+
+
+
+ filter
+ Function
+ *
+ A Function that will be used to decide whether to include a feature or not.
+The default is to include all features:
+function (geoJsonFeature) {
+ return true;
+}
+
+Note: dynamically changing the filter option will have effect only on newly
+added data. It will not re-evaluate already included features.
+
+
+ coordsToLatLng
+ Function
+ *
+ A Function that will be used for converting GeoJSON coordinates to LatLngs.
+The default is the coordsToLatLng static method.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ layeradd
+ LayerEvent
+ Fired when a layer is added to this FeatureGroup
+
+
+ layerremove
+ LayerEvent
+ Fired when a layer is removed from this FeatureGroup
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addData(data)
+ this
+ Adds a GeoJSON object to the layer.
+
+
+
+ resetStyle(layer)
+ this
+ Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
+
+
+
+ setStyle(style)
+ this
+ Changes styles of GeoJSON vector layers with the given style function.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the layer group to the top of all other layers
+
+
+
+ bringToBack()
+ this
+ Brings the layer group to the back of all other layers
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the group.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the group.
+
+
+
+ removeLayer(<Number> id)
+ this
+ Removes the layer with the given internal ID from the group.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the group.
+
+
+
+ hasLayer(<Number> id)
+ Boolean
+ Returns true if the given internal ID is currently added to the group.
+
+
+
+ clearLayers()
+ this
+ Removes all the layers from the group.
+
+
+
+ invoke(<String> methodName, …)
+ this
+ Calls methodName on every layer contained in this group, passing any
+additional parameters. Has no effect if the layers contained do not
+implement methodName.
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the group, optionally specifying context of the iterator function.
+group.eachLayer(function (layer) {
+ layer.bindPopup('Hello');
+});
+
+
+
+
+ getLayer(<Number> id)
+ Layer
+ Returns the layer with the given internal ID.
+
+
+
+ getLayers()
+ Layer[]
+ Returns an array of all the layers added to the group.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Calls setZIndex on every layer contained in this group, passing the z-index.
+
+
+
+ getLayerId(<Layer> layer)
+ Number
+ Returns the internal ID for a layer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Functions
+
+
+
+
+
+There are several static functions which can be called without instantiating L.GeoJSON:
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ geometryToLayer(<Object> featureData, <GeoJSON options> options?)
+ Layer
+ Creates a Layer from a given GeoJSON feature. Can use a custom
+pointToLayer and/or coordsToLatLng
+functions if provided as options.
+
+
+ coordsToLatLng(<Array> coords)
+ LatLng
+ Creates a LatLng object from an array of 2 numbers (longitude, latitude)
+or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
+
+
+ coordsToLatLngs(<Array> coords, <Number> levelsDeep?, <Function> coordsToLatLng?)
+ Array
+ Creates a multidimensional array of LatLngs from a GeoJSON coordinates array.
+levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).
+Can use a custom coordsToLatLng function.
+
+
+ latLngToCoords(<LatLng> latlng, <Number> precision?)
+ Array
+ Reverse of coordsToLatLng
+
+
+ latLngsToCoords(<Array> latlngs, <Number> levelsDeep?, <Boolean> closed?)
+ Array
+ Reverse of coordsToLatLngs
+closed determines whether the first point should be appended to the end of the array to close the feature, only used when levelsDeep is 0. False by default.
+
+
+ asFeature(<Object> geojson)
+ Object
+ Normalize GeoJSON geometries/features into GeoJSON features.
+
+
+
+
+
+
+ GridLayer
Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces TileLayer.Canvas.
+GridLayer can be extended to create a tiled grid of HTML elements like <canvas>, <img> or <div>. GridLayer will handle creating and animating these DOM elements for you.
+
+
+Usage example
+
+
+
+Synchronous usage
+
+
+
+To create a custom layer, extend GridLayer and implement the createTile() method, which will be passed a Point object with the x, y, and z (zoom level) coordinates to draw your tile.
+var CanvasLayer = L.GridLayer.extend({
+ createTile: function(coords){
+ // create a <canvas> element for drawing
+ var tile = L.DomUtil.create('canvas', 'leaflet-tile');
+ // setup tile width and height according to the options
+ var size = this.getTileSize();
+ tile.width = size.x;
+ tile.height = size.y;
+ // get a canvas context and draw something on it using coords.x, coords.y and coords.z
+ var ctx = tile.getContext('2d');
+ // return the tile so it can be rendered on screen
+ return tile;
+ }
+});
+
+
+
+
+
+
+Asynchronous usage
+
+
+
+Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the done() callback.
+var CanvasLayer = L.GridLayer.extend({
+ createTile: function(coords, done){
+ var error;
+ // create a <canvas> element for drawing
+ var tile = L.DomUtil.create('canvas', 'leaflet-tile');
+ // setup tile width and height according to the options
+ var size = this.getTileSize();
+ tile.width = size.x;
+ tile.height = size.y;
+ // draw something asynchronously and pass the tile to the done() callback
+ setTimeout(function() {
+ done(error, tile);
+ }, 1000);
+ return tile;
+ }
+});
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.gridLayer(<GridLayer options> options?)
+ Creates a new instance of GridLayer with the supplied options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tileSize
+ Number|Point
+ 256
+ Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
+
+
+ opacity
+ Number
+ 1.0
+ Opacity of the tiles. Can be used in the createTile() function.
+
+
+ updateWhenIdle
+ Boolean
+ (depends)
+ Load new tiles only when panning ends.
+true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
+false otherwise in order to display new tiles during panning, since it is easy to pan outside the
+keepBuffer option in desktop browsers.
+
+
+ updateWhenZooming
+ Boolean
+ true
+ By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
+
+
+ updateInterval
+ Number
+ 200
+ Tiles will not update more than once every updateInterval milliseconds when panning.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the tile layer.
+
+
+ bounds
+ LatLngBounds
+ undefined
+ If set, tiles will only be loaded inside the set LatLngBounds.
+
+
+ minZoom
+ Number
+ 0
+ The minimum zoom level down to which this layer will be displayed (inclusive).
+
+
+ maxZoom
+ Number
+ undefined
+ The maximum zoom level up to which this layer will be displayed (inclusive).
+
+
+ maxNativeZoom
+ Number
+ undefined
+ Maximum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels higher than maxNativeZoom will be loaded
+from maxNativeZoom level and auto-scaled.
+
+
+ minNativeZoom
+ Number
+ undefined
+ Minimum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels lower than minNativeZoom will be loaded
+from minNativeZoom level and auto-scaled.
+
+
+ noWrap
+ Boolean
+ false
+ Whether the layer is wrapped around the antimeridian. If true, the
+GridLayer will only be displayed once at low zoom levels. Has no
+effect when the map CRS doesn't wrap around. Can be used
+in combination with bounds to prevent requesting
+tiles outside the CRS limits.
+
+
+ pane
+ String
+ 'tilePane'
+ Map pane where the grid layer will be added.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the tile layer. Empty by default.
+
+
+ keepBuffer
+ Number
+ 2
+ When panning the map, keep this many rows and columns of tiles before unloading them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ loading
+ Event
+ Fired when the grid layer starts loading tiles.
+
+
+ tileunload
+ TileEvent
+ Fired when a tile is removed (e.g. when a tile goes off the screen).
+
+
+ tileloadstart
+ TileEvent
+ Fired when a tile is requested and starts loading.
+
+
+ tileerror
+ TileErrorEvent
+ Fired when there is an error loading a tile.
+
+
+ tileload
+ TileEvent
+ Fired when a tile loads.
+
+
+ load
+ Event
+ Fired when the grid layer loaded all visible tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the tile layer to the top of all tile layers.
+
+
+
+ bringToBack()
+ this
+ Brings the tile layer to the bottom of all tile layers.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the tiles for this layer.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the grid layer.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Changes the zIndex of the grid layer.
+
+
+
+ isLoading()
+ Boolean
+ Returns true if any tile in the grid layer has not finished loading.
+
+
+
+ redraw()
+ this
+ Causes the layer to clear all the tiles and request them again.
+
+
+
+ getTileSize()
+ Point
+ Normalizes the tileSize option into a point. Used by the createTile() method.
+
+
+
+
+
+
+Extension methods
+
+Layers extending GridLayer shall reimplement the following method.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ createTile(<Object> coords, <Function> done?)
+ HTMLElement
+ Called only internally, must be overridden by classes extending GridLayer.
+Returns the HTMLElement corresponding to the given coords. If the done callback
+is specified, it must be called when the tile has finished loading and drawing.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ LatLng
Represents a geographical point with a certain latitude and longitude.
+
+
+Usage example
+
+
+
+
+
+
+
+var latlng = L.latLng(50.5, 30.5);
+
All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:
+map.panTo([50, 30]);
+map.panTo({lon: 30, lat: 50});
+map.panTo({lat: 50, lng: 30});
+map.panTo(L.latLng(50, 30));
+
Note that LatLng does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.latLng(<Number> latitude, <Number> longitude, <Number> altitude?)
+ Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).
+
+
+ L.latLng(<Array> coords)
+ Expects an array of the form [Number, Number] or [Number, Number, Number] instead.
+
+
+ L.latLng(<Object> coords)
+ Expects an plain object of the form {lat: Number, lng: Number} or {lat: Number, lng: Number, alt: Number} instead.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ equals(<LatLng> otherLatLng, <Number> maxMargin?)
+ Boolean
+ Returns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overridden by setting maxMargin to a small number.
+
+
+
+ toString()
+ String
+ Returns a string representation of the point (for debugging purposes).
+
+
+
+ distanceTo(<LatLng> otherLatLng)
+ Number
+ Returns the distance (in meters) to the given LatLng calculated using the Spherical Law of Cosines.
+
+
+
+ wrap()
+ LatLng
+ Returns a new LatLng object with the longitude wrapped so it's always between -180 and +180 degrees.
+
+
+
+ toBounds(<Number> sizeInMeters)
+ LatLngBounds
+ Returns a new LatLngBounds object in which each boundary is sizeInMeters/2 meters apart from the LatLng.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ lat
+ Number
+ Latitude in degrees
+
+
+ lng
+ Number
+ Longitude in degrees
+
+
+ alt
+ Number
+ Altitude in meters (optional)
+
+
+
+
+
+
+ LatLngBounds
Represents a rectangular geographical area on a map.
+
+
+Usage example
+
+
+
+
+
+
+
+var corner1 = L.latLng(40.712, -74.227),
+corner2 = L.latLng(40.774, -74.125),
+bounds = L.latLngBounds(corner1, corner2);
+
+All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
+map.fitBounds([
+ [40.712, -74.227],
+ [40.774, -74.125]
+]);
+
+Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners outside the [-180, 180] degrees longitude range.
+Note that LatLngBounds does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.latLngBounds(<LatLng> corner1, <LatLng> corner2)
+ Creates a LatLngBounds object by defining two diagonally opposite corners of the rectangle.
+
+
+ L.latLngBounds(<LatLng[]> latlngs)
+ Creates a LatLngBounds object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with fitBounds.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ extend(<LatLng> latlng)
+ this
+ Extend the bounds to contain the given point
+
+
+
+ extend(<LatLngBounds> otherBounds)
+ this
+ Extend the bounds to contain the given bounds
+
+
+
+ pad(<Number> bufferRatio)
+ LatLngBounds
+ Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
+For example, a ratio of 0.5 extends the bounds by 50% in each direction.
+Negative values will retract the bounds.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center point of the bounds.
+
+
+
+ getSouthWest()
+ LatLng
+ Returns the south-west point of the bounds.
+
+
+
+ getNorthEast()
+ LatLng
+ Returns the north-east point of the bounds.
+
+
+
+ getNorthWest()
+ LatLng
+ Returns the north-west point of the bounds.
+
+
+
+ getSouthEast()
+ LatLng
+ Returns the south-east point of the bounds.
+
+
+
+ getWest()
+ Number
+ Returns the west longitude of the bounds
+
+
+
+ getSouth()
+ Number
+ Returns the south latitude of the bounds
+
+
+
+ getEast()
+ Number
+ Returns the east longitude of the bounds
+
+
+
+ getNorth()
+ Number
+ Returns the north latitude of the bounds
+
+
+
+ contains(<LatLngBounds> otherBounds)
+ Boolean
+ Returns true if the rectangle contains the given one.
+
+
+
+ contains(<LatLng> latlng)
+ Boolean
+ Returns true if the rectangle contains the given point.
+
+
+
+ intersects(<LatLngBounds> otherBounds)
+ Boolean
+ Returns true if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
+
+
+
+ overlaps(<Bounds> otherBounds)
+ Boolean
+ Returns true if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
+
+
+
+ toBBoxString()
+ String
+ Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
+
+
+
+ equals(<LatLngBounds> otherBounds, <Number> maxMargin?)
+ Boolean
+ Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting maxMargin to a small number.
+
+
+
+ isValid()
+ Boolean
+ Returns true if the bounds are properly initialized.
+
+
+
+
+
+
+
+ Point
Represents a point with x and y coordinates in pixels.
+
+
+Usage example
+
+
+
+
+
+
+
+var point = L.point(200, 300);
+
+All Leaflet methods and options that accept Point objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:
+map.panBy([200, 300]);
+map.panBy(L.point(200, 300));
+
+Note that Point does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.point(<Number> x, <Number> y, <Boolean> round?)
+ Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values.
+
+
+ L.point(<Number[]> coords)
+ Expects an array of the form [x, y] instead.
+
+
+ L.point(<Object> coords)
+ Expects a plain object of the form {x: Number, y: Number} instead.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ clone()
+ Point
+ Returns a copy of the current point.
+
+
+
+ add(<Point> otherPoint)
+ Point
+ Returns the result of addition of the current and the given points.
+
+
+
+ subtract(<Point> otherPoint)
+ Point
+ Returns the result of subtraction of the given point from the current.
+
+
+
+ divideBy(<Number> num)
+ Point
+ Returns the result of division of the current point by the given number.
+
+
+
+ multiplyBy(<Number> num)
+ Point
+ Returns the result of multiplication of the current point by the given number.
+
+
+
+ scaleBy(<Point> scale)
+ Point
+ Multiply each coordinate of the current point by each coordinate of
+scale. In linear algebra terms, multiply the point by the
+scaling matrix
+defined by scale.
+
+
+
+ unscaleBy(<Point> scale)
+ Point
+ Inverse of scaleBy. Divide each coordinate of the current point by
+each coordinate of scale.
+
+
+
+ round()
+ Point
+ Returns a copy of the current point with rounded coordinates.
+
+
+
+ floor()
+ Point
+ Returns a copy of the current point with floored coordinates (rounded down).
+
+
+
+ ceil()
+ Point
+ Returns a copy of the current point with ceiled coordinates (rounded up).
+
+
+
+ trunc()
+ Point
+ Returns a copy of the current point with truncated coordinates (rounded towards zero).
+
+
+
+ distanceTo(<Point> otherPoint)
+ Number
+ Returns the cartesian distance between the current and the given points.
+
+
+
+ equals(<Point> otherPoint)
+ Boolean
+ Returns true if the given point has the same coordinates.
+
+
+
+ contains(<Point> otherPoint)
+ Boolean
+ Returns true if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
+
+
+
+ toString()
+ String
+ Returns a string representation of the point for debugging purposes.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ x
+ Number
+ The x coordinate of the point
+
+
+ y
+ Number
+ The y coordinate of the point
+
+
+
+
+
+
+ Bounds
Represents a rectangular area in pixel coordinates.
+
+
+Usage example
+
+
+
+
+
+
+
+var p1 = L.point(10, 10),
+p2 = L.point(40, 60),
+bounds = L.bounds(p1, p2);
+
+All Leaflet methods that accept Bounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
+otherBounds.intersects([[10, 10], [40, 60]]);
+
+Note that Bounds does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.bounds(<Point> corner1, <Point> corner2)
+ Creates a Bounds object from two corners coordinate pairs.
+
+
+ L.bounds(<Point[]> points)
+ Creates a Bounds object from the given array of points.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ extend(<Point> point)
+ this
+ Extends the bounds to contain the given point.
+
+
+
+ getCenter(<Boolean> round?)
+ Point
+ Returns the center point of the bounds.
+
+
+
+ getBottomLeft()
+ Point
+ Returns the bottom-left point of the bounds.
+
+
+
+ getTopRight()
+ Point
+ Returns the top-right point of the bounds.
+
+
+
+ getTopLeft()
+ Point
+ Returns the top-left point of the bounds (i.e. this.min).
+
+
+
+ getBottomRight()
+ Point
+ Returns the bottom-right point of the bounds (i.e. this.max).
+
+
+
+ getSize()
+ Point
+ Returns the size of the given bounds
+
+
+
+ contains(<Bounds> otherBounds)
+ Boolean
+ Returns true if the rectangle contains the given one.
+
+
+
+ contains(<Point> point)
+ Boolean
+ Returns true if the rectangle contains the given point.
+
+
+
+ intersects(<Bounds> otherBounds)
+ Boolean
+ Returns true if the rectangle intersects the given bounds. Two bounds
+intersect if they have at least one point in common.
+
+
+
+ overlaps(<Bounds> otherBounds)
+ Boolean
+ Returns true if the rectangle overlaps the given bounds. Two bounds
+overlap if their intersection is an area.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ min
+ Point
+ The top left corner of the rectangle.
+
+
+ max
+ Point
+ The bottom right corner of the rectangle.
+
+
+
+
+
+
+ Icon
Represents an icon to provide when creating a marker.
+
+
+Usage example
+
+
+
+
+
+
+
+var myIcon = L.icon({
+ iconUrl: 'my-icon.png',
+ iconSize: [38, 95],
+ iconAnchor: [22, 94],
+ popupAnchor: [-3, -76],
+ shadowUrl: 'my-icon-shadow.png',
+ shadowSize: [68, 95],
+ shadowAnchor: [22, 94]
+});
+L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
+
+L.Icon.Default extends L.Icon and is the blue icon Leaflet uses for markers by default.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.icon(<Icon options> options)
+ Creates an icon instance with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ iconUrl
+ String
+ null
+ (required) The URL to the icon image (absolute or relative to your script path).
+
+
+ iconRetinaUrl
+ String
+ null
+ The URL to a retina sized version of the icon image (absolute or relative to your
+script path). Used for Retina screen devices.
+
+
+ iconSize
+ Point
+ null
+ Size of the icon image in pixels.
+
+
+ iconAnchor
+ Point
+ null
+ The coordinates of the "tip" of the icon (relative to its top left corner). The icon
+will be aligned so that this point is at the marker's geographical location. Centered
+by default if size is specified, also can be set in CSS with negative margins.
+
+
+ popupAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which popups will "open", relative to the icon anchor.
+
+
+ tooltipAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which tooltips will "open", relative to the icon anchor.
+
+
+ shadowUrl
+ String
+ null
+ The URL to the icon shadow image. If not specified, no shadow image will be created.
+
+
+ shadowRetinaUrl
+ String
+ null
+
+
+
+ shadowSize
+ Point
+ null
+ Size of the shadow image in pixels.
+
+
+ shadowAnchor
+ Point
+ null
+ The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
+as iconAnchor if not specified).
+
+
+ className
+ String
+ ''
+ A custom class name to assign to both icon and shadow images. Empty by default.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ createIcon(<HTMLElement> oldIcon?)
+ HTMLElement
+ Called internally when the icon has to be shown, returns a <img> HTML element
+styled according to the options.
+
+
+
+ createShadow(<HTMLElement> oldIcon?)
+ HTMLElement
+ As createIcon, but for the shadow beneath it.
+
+
+
+
+
+
+
+
+
+
+Icon.Default
+
+
+
+
+
+A trivial subclass of Icon, represents the icon to use in Markers when
+no icon is specified. Points to the blue marker image distributed with Leaflet
+releases.
+In order to customize the default icon, just change the properties of L.Icon.Default.prototype.options
+(which is a set of Icon options).
+If you want to completely replace the default icon, override the
+L.Marker.prototype.options.icon with your own icon instead.
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ imagePath
+ String
+
+ Icon.Default will try to auto-detect the location of the
+blue icon images. If you are placing these images in a non-standard
+way, set this option to point to the right path.
+
+
+
+
+
+
+ DivIcon
Represents a lightweight icon for markers that uses a simple <div>
+element instead of an image. Inherits from Icon but ignores the iconUrl and shadow options.
+
+
+Usage example
+
+
+
+
+
+
+
+var myIcon = L.divIcon({className: 'my-div-icon'});
+// you can set .my-div-icon styles in CSS
+L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
+
+By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.divIcon(<DivIcon options> options)
+ Creates a DivIcon instance with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ html
+ String|HTMLElement
+ ''
+ Custom HTML code to put inside the div element, empty by default. Alternatively,
+an instance of HTMLElement.
+
+
+ bgPos
+ Point
+ [0, 0]
+ Optional relative position of the background, in pixels
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ iconUrl
+ String
+ null
+ (required) The URL to the icon image (absolute or relative to your script path).
+
+
+ iconRetinaUrl
+ String
+ null
+ The URL to a retina sized version of the icon image (absolute or relative to your
+script path). Used for Retina screen devices.
+
+
+ iconSize
+ Point
+ null
+ Size of the icon image in pixels.
+
+
+ iconAnchor
+ Point
+ null
+ The coordinates of the "tip" of the icon (relative to its top left corner). The icon
+will be aligned so that this point is at the marker's geographical location. Centered
+by default if size is specified, also can be set in CSS with negative margins.
+
+
+ popupAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which popups will "open", relative to the icon anchor.
+
+
+ tooltipAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which tooltips will "open", relative to the icon anchor.
+
+
+ shadowUrl
+ String
+ null
+ The URL to the icon shadow image. If not specified, no shadow image will be created.
+
+
+ shadowRetinaUrl
+ String
+ null
+
+
+
+ shadowSize
+ Point
+ null
+ Size of the shadow image in pixels.
+
+
+ shadowAnchor
+ Point
+ null
+ The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
+as iconAnchor if not specified).
+
+
+ className
+ String
+ ''
+ A custom class name to assign to both icon and shadow images. Empty by default.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ createIcon(<HTMLElement> oldIcon?)
+ HTMLElement
+ Called internally when the icon has to be shown, returns a <img> HTML element
+styled according to the options.
+
+
+
+ createShadow(<HTMLElement> oldIcon?)
+ HTMLElement
+ As createIcon, but for the shadow beneath it.
+
+
+
+
+
+
+
+
+ Control.Zoom
A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its zoomControl option to false. Extends Control.
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.zoom(<Control.Zoom options> options)
+ Creates a zoom control
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ zoomInText
+ String
+ '+'
+ The text set on the 'zoom in' button.
+
+
+ zoomInTitle
+ String
+ 'Zoom in'
+ The title set on the 'zoom in' button.
+
+
+ zoomOutText
+ String
+ '−
+ '
+The text set on the 'zoom out' button.
+
+
+ zoomOutTitle
+ String
+ 'Zoom out'
+ The title set on the 'zoom out' button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Control.Attribution
The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its attributionControl option to false, and it fetches attribution texts from layers with the getAttribution method automatically. Extends Control.
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.attribution(<Control.Attribution options> options)
+ Creates an attribution control.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ prefix
+ String
+ 'Leaflet'
+ The HTML text shown before the attributions. Pass false to disable.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setPrefix(<String> prefix)
+ this
+ Sets the text before the attributions.
+
+
+
+ addAttribution(<String> text)
+ this
+ Adds an attribution text (e.g. 'Vector data © Mapbox').
+
+
+
+ removeAttribution(<String> text)
+ this
+ Removes an attribution text.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Control.Layers
The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the detailed example). Extends Control.
+
+
+Usage example
+
+
+
+
+
+
+
+var baseLayers = {
+ "Mapbox": mapbox,
+ "OpenStreetMap": osm
+};
+var overlays = {
+ "Marker": marker,
+ "Roads": roadsLayer
+};
+L.control.layers(baseLayers, overlays).addTo(map);
+
+The baseLayers and overlays parameters are object literals with layer names as keys and Layer objects as values:
+{
+ "<someName1>": layer1,
+ "<someName2>": layer2
+}
+
+The layer names can contain HTML, which allows you to add additional styling to the items:
+{"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.layers(<Object> baselayers?, <Object> overlays?, <Control.Layers options> options?)
+ Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ collapsed
+ Boolean
+ true
+ If true, the control will be collapsed into an icon and expanded on mouse hover or touch.
+
+
+ autoZIndex
+ Boolean
+ true
+ If true, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
+
+
+ hideSingleBase
+ Boolean
+ false
+ If true, the base layers in the control will be hidden when there is only one.
+
+
+ sortLayers
+ Boolean
+ false
+ Whether to sort the layers. When false, layers will keep the order
+in which they were added to the control.
+
+
+ sortFunction
+ Function
+ *
+ A compare function
+that will be used for sorting the layers, when sortLayers is true.
+The function receives both the L.Layer instances and their names, as in
+sortFunction(layerA, layerB, nameA, nameB).
+By default, it sorts layers alphabetically by their name.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addBaseLayer(<Layer> layer, <String> name)
+ this
+ Adds a base layer (radio button entry) with the given name to the control.
+
+
+
+ addOverlay(<Layer> layer, <String> name)
+ this
+ Adds an overlay (checkbox entry) with the given name to the control.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Remove the given layer from the control.
+
+
+
+ expand()
+ this
+ Expand the control container if collapsed.
+
+
+
+ collapse()
+ this
+ Collapse the control container if expanded.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Control.Scale
A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends Control.
+
+
+Usage example
+
+
+
+
+
+
+
+L.control.scale().addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.scale(<Control.Scale options> options?)
+ Creates an scale control with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ maxWidth
+ Number
+ 100
+ Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
+
+
+ metric
+ Boolean
+ True
+ Whether to show the metric scale line (m/km).
+
+
+ imperial
+ Boolean
+ True
+ Whether to show the imperial scale line (mi/ft).
+
+
+ updateWhenIdle
+ Boolean
+ false
+ If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Browser
A namespace with static properties for browser/feature detection used by Leaflet internally.
+
+
+Usage example
+
+
+
+
+
+
+
+if (L.Browser.ielt9) {
+ alert('Upgrade your browser, dude!');
+}
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ ie
+ Boolean
+ true for all Internet Explorer versions (not Edge).
+
+
+ ielt9
+ Boolean
+ true for Internet Explorer versions less than 9.
+
+
+ edge
+ Boolean
+ true for the Edge web browser.
+
+
+ webkit
+ Boolean
+ true for webkit-based browsers like Chrome and Safari (including mobile versions).
+
+
+ android
+ Boolean
+ true for any browser running on an Android platform.
+
+
+ android23
+ Boolean
+ true for browsers running on Android 2 or Android 3.
+
+
+ androidStock
+ Boolean
+ true for the Android stock browser (i.e. not Chrome)
+
+
+ opera
+ Boolean
+ true for the Opera browser
+
+
+ chrome
+ Boolean
+ true for the Chrome browser.
+
+
+ gecko
+ Boolean
+ true for gecko-based browsers like Firefox.
+
+
+ safari
+ Boolean
+ true for the Safari browser.
+
+
+ opera12
+ Boolean
+ true for the Opera browser supporting CSS transforms (version 12 or later).
+
+
+ win
+ Boolean
+ true when the browser is running in a Windows platform
+
+
+ ie3d
+ Boolean
+ true for all Internet Explorer versions supporting CSS transforms.
+
+
+ webkit3d
+ Boolean
+ true for webkit-based browsers supporting CSS transforms.
+
+
+ gecko3d
+ Boolean
+ true for gecko-based browsers supporting CSS transforms.
+
+
+ any3d
+ Boolean
+ true for all browsers supporting CSS transforms.
+
+
+ mobile
+ Boolean
+ true for all browsers running in a mobile device.
+
+
+ mobileWebkit
+ Boolean
+ true for all webkit-based browsers in a mobile device.
+
+
+ mobileWebkit3d
+ Boolean
+ true for all webkit-based browsers in a mobile device supporting CSS transforms.
+
+
+ msPointer
+ Boolean
+ true for browsers implementing the Microsoft touch events model (notably IE10).
+
+
+ pointer
+ Boolean
+ true for all browsers supporting pointer events.
+
+
+ touch
+ Boolean
+ true for all browsers supporting touch events.
+This does not necessarily mean that the browser is running in a computer with
+a touchscreen, it only means that the browser is capable of understanding
+touch events.
+
+
+ mobileOpera
+ Boolean
+ true for the Opera browser in a mobile device.
+
+
+ mobileGecko
+ Boolean
+ true for gecko-based browsers running in a mobile device.
+
+
+ retina
+ Boolean
+ true for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
+
+
+ canvas
+ Boolean
+ true when the browser supports <canvas>.
+
+
+ svg
+ Boolean
+ true when the browser supports SVG.
+
+
+ vml
+ Boolean
+ true if the browser supports VML.
+
+
+
+
+
+
+ Util
Various utility functions, used by Leaflet internally.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ extend(<Object> dest, <Object> src?)
+ Object
+ Merges the properties of the src object (or multiple objects) into dest object and returns the latter. Has an L.extend shortcut.
+
+
+ create(<Object> proto, <Object> properties?)
+ Object
+ Compatibility polyfill for Object.create
+
+
+ bind(<Function> fn, …)
+ Function
+ Returns a new function bound to the arguments passed, like Function.prototype.bind.
+Has a L.bind() shortcut.
+
+
+ stamp(<Object> obj)
+ Number
+ Returns the unique ID of an object, assigning it one if it doesn't have it.
+
+
+ throttle(<Function> fn, <Number> time, <Object> context)
+ Function
+ Returns a function which executes function fn with the given scope context
+(so that the this keyword refers to context inside fn's code). The function
+fn will be called no more than one time per given amount of time. The arguments
+received by the bound function will be any arguments passed when binding the
+function, followed by any arguments passed when invoking the bound function.
+Has an L.throttle shortcut.
+
+
+ wrapNum(<Number> num, <Number[]> range, <Boolean> includeMax?)
+ Number
+ Returns the number num modulo range in such a way so it lies within
+range[0] and range[1]. The returned value will be always smaller than
+range[1] unless includeMax is set to true.
+
+
+ falseFn()
+ Function
+ Returns a function which always returns false.
+
+
+ formatNum(<Number> num, <Number> digits?)
+ Number
+ Returns the number num rounded to digits decimals, or to 6 decimals by default.
+
+
+ trim(<String> str)
+ String
+ Compatibility polyfill for String.prototype.trim
+
+
+ splitWords(<String> str)
+ String[]
+ Trims and splits the string on whitespace and returns the array of parts.
+
+
+ setOptions(<Object> obj, <Object> options)
+ Object
+ Merges the given properties to the options of the obj object, returning the resulting options. See Class options. Has an L.setOptions shortcut.
+
+
+ getParamString(<Object> obj, <String> existingUrl?, <Boolean> uppercase?)
+ String
+ Converts an object into a parameter URL string, e.g. {a: "foo", b: "bar"}
+translates to '?a=foo&b=bar'. If existingUrl is set, the parameters will
+be appended at the end. If uppercase is true, the parameter names will
+be uppercased (e.g. '?A=foo&B=bar')
+
+
+ template(<String> str, <Object> data)
+ String
+ Simple templating facility, accepts a template string of the form 'Hello {a}, {b}'
+and a data object like {a: 'foo', b: 'bar'}, returns evaluated string
+('Hello foo, bar'). You can also specify functions instead of strings for
+data values — they will be evaluated passing data as an argument.
+
+
+ isArray(obj)
+ Boolean
+ Compatibility polyfill for Array.isArray
+
+
+ indexOf(<Array> array, <Object> el)
+ Number
+ Compatibility polyfill for Array.prototype.indexOf
+
+
+ requestAnimFrame(<Function> fn, <Object> context?, <Boolean> immediate?)
+ Number
+ Schedules fn to be executed when the browser repaints. fn is bound to
+context if given. When immediate is set, fn is called immediately if
+the browser doesn't have native support for
+window.requestAnimationFrame,
+otherwise it's delayed. Returns a request ID that can be used to cancel the request.
+
+
+ cancelAnimFrame(<Number> id)
+ undefined
+ Cancels a previous requestAnimFrame. See also window.cancelAnimationFrame.
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ lastId
+ Number
+ Last unique ID used by stamp()
+
+
+ emptyImageUrl
+ String
+ Data URI string containing a base64-encoded empty GIF image.
+Used as a hack to free memory from unused images on WebKit-powered
+mobile devices (by setting image src to this string).
+
+
+
+
+
+
+ Transformation
Represents an affine transformation: a set of coefficients a, b, c, d
+for transforming a point of a form (x, y) into (a*x + b, c*y + d) and doing
+the reverse. Used by Leaflet in its projections code.
+
+
+Usage example
+
+
+
+
+
+
+
+var transformation = L.transformation(2, 5, -1, 10),
+ p = L.point(1, 2),
+ p2 = transformation.transform(p), // L.point(7, 8)
+ p3 = transformation.untransform(p2); // L.point(1, 2)
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.transformation(<Number> a, <Number> b, <Number> c, <Number> d)
+ Instantiates a Transformation object with the given coefficients.
+
+
+ L.transformation(<Array> coefficients)
+ Expects an coefficients array of the form
+[a: Number, b: Number, c: Number, d: Number].
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ transform(<Point> point, <Number> scale?)
+ Point
+ Returns a transformed point, optionally multiplied by the given scale.
+Only accepts actual L.Point instances, not arrays.
+
+
+
+ untransform(<Point> point, <Number> scale?)
+ Point
+ Returns the reverse transformation of the given point, optionally divided
+by the given scale. Only accepts actual L.Point instances, not arrays.
+
+
+
+
+
+
+
+ LineUtil
Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ simplify(<Point[]> points, <Number> tolerance)
+ Point[]
+ Dramatically reduces the number of points in a polyline while retaining
+its shape and returns a new array of simplified points, using the
+Douglas-Peucker algorithm.
+Used for a huge performance boost when processing/displaying Leaflet polylines for
+each zoom level and also reducing visual noise. tolerance affects the amount of
+simplification (lesser value means higher quality but slower and with more points).
+Also released as a separated micro-library Simplify.js.
+
+
+ pointToSegmentDistance(<Point> p, <Point> p1, <Point> p2)
+ Number
+ Returns the distance between point p and segment p1 to p2.
+
+
+ closestPointOnSegment(<Point> p, <Point> p1, <Point> p2)
+ Number
+ Returns the closest point from a point p on a segment p1 to p2.
+
+
+ clipSegment(<Point> a, <Point> b, <Bounds> bounds, <Boolean> useLastCode?, <Boolean> round?)
+ Point[]|Boolean
+ Clips the segment a to b by rectangular bounds with the
+Cohen-Sutherland algorithm
+(modifying the segment points directly!). Used by Leaflet to only show polyline
+points that are on the screen or near, increasing performance.
+
+
+ isFlat(<LatLng[]> latlngs)
+ Boolean
+ Returns true if latlngs is a flat array, false is nested.
+
+
+
+
+
+
+ PolyUtil
Various utility functions for polygon geometries.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ clipPolygon(<Point[]> points, <Bounds> bounds, <Boolean> round?)
+ Point[]
+ Clips the polygon geometry defined by the given points by the given bounds (using the Sutherland-Hodgman algorithm).
+Used by Leaflet to only show polygon points that are on the screen or near, increasing
+performance. Note that polygon points needs different algorithm for clipping
+than polyline, so there's a separate method for it.
+
+
+
+
+
+
+ DomEvent
Utility functions to work with the DOM events, used by Leaflet internally.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ on(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular DOM event type of the
+element el. You can optionally specify the context of the listener
+(object the this keyword will point to). You can also pass several
+space-separated types (e.g. 'click dblclick').
+
+
+ on(<HTMLElement> el, <Object> eventMap, <Object> context?)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+ off(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
+ this
+ Removes a previously added listener function.
+Note that if you passed a custom context to on, you must pass the same
+context to off in order to remove the listener.
+
+
+ off(<HTMLElement> el, <Object> eventMap, <Object> context?)
+ this
+ Removes a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+ stopPropagation(<DOMEvent> ev)
+ this
+ Stop the given event from propagation to parent elements. Used inside the listener functions:
+L.DomEvent.on(div, 'click', function (ev) {
+ L.DomEvent.stopPropagation(ev);
+});
+
+
+
+ disableScrollPropagation(<HTMLElement> el)
+ this
+ Adds stopPropagation to the element's 'mousewheel' events (plus browser variants).
+
+
+ disableClickPropagation(<HTMLElement> el)
+ this
+ Adds stopPropagation to the element's 'click', 'doubleclick',
+'mousedown' and 'touchstart' events (plus browser variants).
+
+
+ preventDefault(<DOMEvent> ev)
+ this
+ Prevents the default action of the DOM Event ev from happening (such as
+following a link in the href of the a element, or doing a POST request
+with page reload when a <form> is submitted).
+Use it inside listener functions.
+
+
+ stop(<DOMEvent> ev)
+ this
+ Does stopPropagation and preventDefault at the same time.
+
+
+ getMousePosition(<DOMEvent> ev, <HTMLElement> container?)
+ Point
+ Gets normalized mouse position from a DOM event relative to the
+container (border excluded) or to the whole page if not specified.
+
+
+ getWheelDelta(<DOMEvent> ev)
+ Number
+ Gets normalized wheel delta from a mousewheel DOM event, in vertical
+pixels scrolled (negative if scrolling down).
+Events from pointing devices without precise scrolling are mapped to
+a best guess of 60 pixels.
+
+
+ addListener(…)
+ this
+ Alias to L.DomEvent.on
+
+
+ removeListener(…)
+ this
+ Alias to L.DomEvent.off
+
+
+
+
+
+
+ DomUtil
Utility functions to work with the DOM
+tree, used by Leaflet internally.
+Most functions expecting or returning a HTMLElement also work for
+SVG elements. The only difference is that classes refer to CSS classes
+in HTML and SVG classes in SVG.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ get(<String|HTMLElement> id)
+ HTMLElement
+ Returns an element given its DOM id, or returns the element itself
+if it was passed directly.
+
+
+ getStyle(<HTMLElement> el, <String> styleAttrib)
+ String
+ Returns the value for a certain style attribute on an element,
+including computed values or values set through CSS.
+
+
+ create(<String> tagName, <String> className?, <HTMLElement> container?)
+ HTMLElement
+ Creates an HTML element with tagName, sets its class to className, and optionally appends it to container element.
+
+
+ remove(<HTMLElement> el)
+
+ Removes el from its parent element
+
+
+ empty(<HTMLElement> el)
+
+ Removes all of el's children elements from el
+
+
+ toFront(<HTMLElement> el)
+
+ Makes el the last child of its parent, so it renders in front of the other children.
+
+
+ toBack(<HTMLElement> el)
+
+ Makes el the first child of its parent, so it renders behind the other children.
+
+
+ hasClass(<HTMLElement> el, <String> name)
+ Boolean
+ Returns true if the element's class attribute contains name.
+
+
+ addClass(<HTMLElement> el, <String> name)
+
+ Adds name to the element's class attribute.
+
+
+ removeClass(<HTMLElement> el, <String> name)
+
+ Removes name from the element's class attribute.
+
+
+ setClass(<HTMLElement> el, <String> name)
+
+ Sets the element's class.
+
+
+ getClass(<HTMLElement> el)
+ String
+ Returns the element's class.
+
+
+ setOpacity(<HTMLElement> el, <Number> opacity)
+
+ Set the opacity of an element (including old IE support).
+opacity must be a number from 0 to 1.
+
+
+ testProp(<String[]> props)
+ String|false
+ Goes through the array of style names and returns the first name
+that is a valid style name for an element. If no such name is found,
+it returns false. Useful for vendor-prefixed styles like transform.
+
+
+ setTransform(<HTMLElement> el, <Point> offset, <Number> scale?)
+
+ Resets the 3D CSS transform of el so it is translated by offset pixels
+and optionally scaled by scale. Does not have an effect if the
+browser doesn't support 3D CSS transforms.
+
+
+ setPosition(<HTMLElement> el, <Point> position)
+
+ Sets the position of el to coordinates specified by position,
+using CSS translate or top/left positioning depending on the browser
+(used by Leaflet internally to position its layers).
+
+
+ getPosition(<HTMLElement> el)
+ Point
+ Returns the coordinates of an element previously positioned with setPosition.
+
+
+ disableTextSelection()
+
+ Prevents the user from generating selectstart DOM events, usually generated
+when the user drags the mouse through a page with text. Used internally
+by Leaflet to override the behaviour of any click-and-drag interaction on
+the map. Affects drag interactions on the whole document.
+
+
+ enableTextSelection()
+
+ Cancels the effects of a previous L.DomUtil.disableTextSelection.
+
+
+ disableImageDrag()
+
+ As L.DomUtil.disableTextSelection, but
+for dragstart DOM events, usually generated when the user drags an image.
+
+
+ enableImageDrag()
+
+ Cancels the effects of a previous L.DomUtil.disableImageDrag.
+
+
+ preventOutline(<HTMLElement> el)
+
+ Makes the outline
+of the element el invisible. Used internally by Leaflet to prevent
+focusable elements from displaying an outline when the user performs a
+drag interaction on them.
+
+
+ restoreOutline()
+
+ Cancels the effects of a previous L.DomUtil.preventOutline.
+
+
+ getSizedParentNode(<HTMLElement> el)
+ HTMLElement
+ Finds the closest parent node which size (width and height) is not null.
+
+
+ getScale(<HTMLElement> el)
+ Object
+ Computes the CSS scale currently applied on the element.
+Returns an object with x and y members as horizontal and vertical scales respectively,
+and boundingClientRect as the result of getBoundingClientRect().
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ TRANSFORM
+ String
+ Vendor-prefixed transform style name (e.g. 'webkitTransform' for WebKit).
+
+
+ TRANSITION
+ String
+ Vendor-prefixed transition style name.
+
+
+ TRANSITION_END
+ String
+ Vendor-prefixed transitionend event name.
+
+
+
+
+
+
+ PosAnimation
Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.
+
+
+Usage example
+
+
+
+
+
+
+
+var fx = new L.PosAnimation();
+fx.run(el, [300, 500], 0.5);
+
+
+
+
+
+
+
+
+Constructor
+
+
+
+
+
+
+
+
+ Constructor
+ Description
+
+
+
+ L.PosAnimation()
+ Creates a PosAnimation object.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ start
+ Event
+ Fired when the animation starts
+
+
+ step
+ Event
+ Fired continuously during the animation.
+
+
+ end
+ Event
+ Fired when the animation ends.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ run(<HTMLElement> el, <Point> newPos, <Number> duration?, <Number> easeLinearity?)
+
+ Run an animation of a given element to a new position, optionally setting
+duration in seconds (0.25 by default) and easing linearity factor (3rd
+argument of the cubic bezier curve,
+0.5 by default).
+
+
+
+ stop()
+
+ Stops the animation (if currently running).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Draggable
A class for making DOM elements draggable (including touch support).
+Used internally for map and marker dragging. Only works for elements
+that were positioned with L.DomUtil.setPosition.
+
+
+Usage example
+
+
+
+
+
+
+
+var draggable = new L.Draggable(elementToDrag);
+draggable.enable();
+
+
+
+
+
+
+
+
+Constructor
+
+
+
+
+
+
+
+
+ Constructor
+ Description
+
+
+
+ L.Draggable(<HTMLElement> el, <HTMLElement> dragHandle?, <Boolean> preventOutline?, <Draggable options> options?)
+ Creates a Draggable object for moving el when you start dragging the dragHandle element (equals el itself by default).
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ clickTolerance
+ Number
+ 3
+ The max number of pixels a user can shift the mouse pointer during a click
+for it to be considered a valid click (as opposed to a mouse drag).
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ down
+ Event
+ Fired when a drag is about to start.
+
+
+ dragstart
+ Event
+ Fired when a drag starts
+
+
+ predrag
+ Event
+ Fired continuously during dragging before each corresponding
+update of the element's position.
+
+
+ drag
+ Event
+ Fired continuously during dragging.
+
+
+ dragend
+ DragEndEvent
+ Fired when the drag ends.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ enable()
+
+ Enables the dragging ability
+
+
+
+ disable()
+
+ Disables the dragging ability
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Class
L.Class powers the OOP facilities of Leaflet and is used to create almost all of the Leaflet classes documented here.
+In addition to implementing a simple classical inheritance model, it introduces several special properties for convenient code organization — options, includes and statics.
+
+
+Usage example
+
+
+
+
+
+
+
+var MyClass = L.Class.extend({
+initialize: function (greeter) {
+ this.greeter = greeter;
+ // class constructor
+},
+greet: function (name) {
+ alert(this.greeter + ', ' + name)
+ }
+});
+// create instance of MyClass, passing "Hello" to the constructor
+var a = new MyClass("Hello");
+// call greet method, alerting "Hello, World"
+a.greet("World");
+
+
+
+
+
+
+Class Factories
+
+
+
+You may have noticed that Leaflet objects are created without using
+the new keyword. This is achieved by complementing each class with a
+lowercase factory method:
+new L.Map('map'); // becomes:
+L.map('map');
+
+The factories are implemented very easily, and you can do this for your own classes:
+L.map = function (id, options) {
+ return new L.Map(id, options);
+};
+
+
+
+
+
+
+Inheritance
+
+
+
+You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it:
+var MyChildClass = MyClass.extend({
+ // ... new properties and methods
+});
+
+This will create a class that inherits all methods and properties of the parent class (through a proper prototype chain), adding or overriding the ones you pass to extend. It will also properly react to instanceof:
+var a = new MyChildClass();
+a instanceof MyChildClass; // true
+a instanceof MyClass; // true
+
+You can call parent methods (including constructor) from corresponding child ones (as you do with super calls in other languages) by accessing parent class prototype and using JavaScript's call or apply:
+var MyChildClass = MyClass.extend({
+ initialize: function () {
+ MyClass.prototype.initialize.call(this, "Yo");
+ },
+ greet: function (name) {
+ MyClass.prototype.greet.call(this, 'bro ' + name + '!');
+ }
+});
+var a = new MyChildClass();
+a.greet('Jason'); // alerts "Yo, bro Jason!"
+
+
+
+
+
+Options
+
+
+
+options is a special property that unlike other objects that you pass
+to extend will be merged with the parent one instead of overriding it
+completely, which makes managing configuration of objects and default
+values convenient:
+var MyClass = L.Class.extend({
+ options: {
+ myOption1: 'foo',
+ myOption2: 'bar'
+ }
+});
+var MyChildClass = MyClass.extend({
+ options: {
+ myOption1: 'baz',
+ myOption3: 5
+ }
+});
+var a = new MyChildClass();
+a.options.myOption1; // 'baz'
+a.options.myOption2; // 'bar'
+a.options.myOption3; // 5
+
+There's also L.Util.setOptions, a method for
+conveniently merging options passed to constructor with the defaults
+defines in the class:
+var MyClass = L.Class.extend({
+ options: {
+ foo: 'bar',
+ bla: 5
+ },
+ initialize: function (options) {
+ L.Util.setOptions(this, options);
+ ...
+ }
+});
+var a = new MyClass({bla: 10});
+a.options; // {foo: 'bar', bla: 10}
+
+Note that the options object allows any keys, not just
+the options defined by the class and its base classes.
+This means you can use the options object to store
+application specific information, as long as you avoid
+keys that are already used by the class in question.
+
+
+
+
+
+Includes
+
+
+
+includes is a special class property that merges all specified objects into the class (such objects are called mixins).
+ var MyMixin = {
+ foo: function () { ... },
+ bar: 5
+};
+var MyClass = L.Class.extend({
+ includes: MyMixin
+});
+var a = new MyClass();
+a.foo();
+
+You can also do such includes in runtime with the include method:
+MyClass.include(MyMixin);
+
+statics is just a convenience property that injects specified object properties as the static properties of the class, useful for defining constants:
+var MyClass = L.Class.extend({
+ statics: {
+ FOO: 'bar',
+ BLA: 5
+ }
+});
+MyClass.FOO; // 'bar'
+
+
+
+
+
+
+Constructor hooks
+
+
+
+If you're a plugin developer, you often need to add additional initialization code to existing classes (e.g. editing hooks for L.Polyline). Leaflet comes with a way to do it easily using the addInitHook method:
+MyClass.addInitHook(function () {
+ // ... do something in constructor additionally
+ // e.g. add event listeners, set custom properties etc.
+});
+
+You can also use the following shortcut when you just need to make one additional method call:
+MyClass.addInitHook('methodName', arg1, arg2, …);
+
+
+
+
+
+
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ extend(<Object> props)
+ Function
+ Extends the current class given the properties to be included.
+Returns a Javascript function that is a class constructor (to be called with new).
+
+
+ include(<Object> properties)
+ this
+ Includes a mixin into the current class.
+
+
+ mergeOptions(<Object> options)
+ this
+ Merges options into the defaults of the class.
+
+
+ addInitHook(<Function> fn)
+ this
+ Adds a constructor hook to the class.
+
+
+
+
+
+
+ Evented
A set of methods shared between event-powered classes (like Map and Marker). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire 'click' event).
+
+
+Usage example
+
+
+
+
+
+
+
+map.on('click', function(e) {
+ alert(e.latlng);
+} );
+
+Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
+function onClick(e) { ... }
+map.on('click', onClick);
+map.off('click', onClick);
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+ Layer
A set of methods from the Layer base class that all Leaflet layers use.
+Inherits all methods, options and events from L.Evented.
+
+
+Usage example
+
+
+
+
+
+
+
+var layer = L.marker(latlng).addTo(map);
+layer.addTo(map);
+layer.remove();
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ add
+ Event
+ Fired after the layer is added to a map
+
+
+ remove
+ Event
+ Fired after the layer is removed from a map
+
+
+
+
+
+Popup events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+Tooltip events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+Classes extending L.Layer will inherit the following methods:
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+Extension methods
+
+Every layer should extend from L.Layer and (re-)implement the following methods.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ onAdd(<Map> map)
+ this
+ Should contain code that creates DOM elements for the layer, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).
+
+
+
+ onRemove(<Map> map)
+ this
+ Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
+
+
+
+ getEvents()
+ Object
+ This optional method should return an object like { viewreset: this._reset } for addEventListener. The event handlers in this object will be automatically added and removed from the map with your layer.
+
+
+
+ getAttribution()
+ String
+ This optional method should return a string containing HTML to be shown on the Attribution control whenever the layer is visible.
+
+
+
+ beforeAdd(<Map> map)
+ this
+ Optional method. Called on map.addLayer(layer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
+
+
+
+
+
+
+Popup methods
+
+All layers share a set of methods convenient for binding popups to it.
+var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);
+layer.openPopup();
+layer.closePopup();
+
+Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+Tooltip methods
+
+All layers share a set of methods convenient for binding tooltips to it.
+var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
+layer.openTooltip();
+layer.closeTooltip();
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Interactive layer
Some Layers can be made interactive - when the user interacts
+with such a layer, mouse events like click and mouseover can be handled.
+Use the event handling methods to handle these events.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+Mouse events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Control
L.Control is a base class for implementing map controls. Handles positioning.
+All other controls extend from this class.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+Classes extending L.Control will inherit the following methods:
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+Extension methods
+
+Every control should extend from L.Control and (re-)implement the following methods.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ onAdd(<Map> map)
+ HTMLElement
+ Should return the container DOM element for the control and add listeners on relevant map events. Called on control.addTo(map).
+
+
+
+ onRemove(<Map> map)
+
+ Optional method. Should contain all clean up code that removes the listeners previously added in onAdd. Called on control.remove().
+
+
+
+
+
+
+
+ Handler
Abstract class for map interaction handlers
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ enable()
+ this
+ Enables the handler
+
+
+
+ disable()
+ this
+ Disables the handler
+
+
+
+ enabled()
+ Boolean
+ Returns true if the handler is enabled
+
+
+
+
+
+
+Extension methods
+
+Classes inheriting from Handler must implement the two following methods:
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addHooks()
+
+ Called when the handler is enabled, should add event hooks.
+
+
+
+ removeHooks()
+
+ Called when the handler is disabled, should remove the event hooks added previously.
+
+
+
+
+
+
+
+
+Functions
+
+
+
+There is static function which can be called without instantiating L.Handler:
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ addTo(<Map> map, <String> name)
+ this
+ Adds a new Handler to the given map with the given name.
+
+
+
+
+
+
+ Projection
An object with methods for projecting geographical coordinates of the world onto
+a flat surface (and back). See Map projection.
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ project(<LatLng> latlng)
+ Point
+ Projects geographical coordinates into a 2D point.
+Only accepts actual L.LatLng instances, not arrays.
+
+
+
+ unproject(<Point> point)
+ LatLng
+ The inverse of project. Projects a 2D point into a geographical location.
+Only accepts actual L.Point instances, not arrays.
+Note that the projection instances do not inherit from Leaflet's Class object,
+and can't be instantiated. Also, new classes can't inherit from them,
+and methods can't be added to them with the include function.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ bounds
+ Bounds
+ The bounds (specified in CRS units) where the projection is valid
+
+
+
+
+
+
+
+Defined projections
+
+
+
+
+
+Leaflet comes with a set of already defined Projections out of the box:
+
+
+
+ Projection
+ Description
+
+
+
+ L.Projection.LonLat
+ Equirectangular, or Plate Carree projection — the most simple projection,
+mostly used by GIS enthusiasts. Directly maps x as longitude, and y as
+latitude. Also suitable for flat worlds, e.g. game maps. Used by the
+EPSG:4326 and Simple CRS.
+
+
+ L.Projection.Mercator
+ Elliptical Mercator projection — more complex than Spherical Mercator. Assumes that Earth is an ellipsoid. Used by the EPSG:3395 CRS.
+
+
+ L.Projection.SphericalMercator
+ Spherical Mercator projection — the most common projection for online maps,
+used by almost all free and commercial tile providers. Assumes that Earth is
+a sphere. Used by the EPSG:3857 CRS.
+
+
+
+
+
+
+ CRS
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ latLngToPoint(<LatLng> latlng, <Number> zoom)
+ Point
+ Projects geographical coordinates into pixel coordinates for a given zoom.
+
+
+
+ pointToLatLng(<Point> point, <Number> zoom)
+ LatLng
+ The inverse of latLngToPoint. Projects pixel coordinates on a given
+zoom into geographical coordinates.
+
+
+
+ project(<LatLng> latlng)
+ Point
+ Projects geographical coordinates into coordinates in units accepted for
+this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
+
+
+
+ unproject(<Point> point)
+ LatLng
+ Given a projected coordinate returns the corresponding LatLng.
+The inverse of project.
+
+
+
+ scale(<Number> zoom)
+ Number
+ Returns the scale used when transforming projected coordinates into
+pixel coordinates for a particular zoom. For example, it returns
+256 * 2^zoom for Mercator-based CRS.
+
+
+
+ zoom(<Number> scale)
+ Number
+ Inverse of scale(), returns the zoom level corresponding to a scale
+factor of scale.
+
+
+
+ getProjectedBounds(<Number> zoom)
+ Bounds
+ Returns the projection's bounds scaled and transformed for the provided zoom.
+
+
+
+ distance(<LatLng> latlng1, <LatLng> latlng2)
+ Number
+ Returns the distance between two geographical coordinates.
+
+
+
+ wrapLatLng(<LatLng> latlng)
+ LatLng
+ Returns a LatLng where lat and lng has been wrapped according to the
+CRS's wrapLat and wrapLng properties, if they are outside the CRS's bounds.
+
+
+
+ wrapLatLngBounds(<LatLngBounds> bounds)
+ LatLngBounds
+ Returns a LatLngBounds with the same size as the given one, ensuring
+that its center is within the CRS's bounds.
+Only accepts actual L.LatLngBounds instances, not arrays.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ code
+ String
+ Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857')
+
+
+ wrapLng
+ Number[]
+ An array of two numbers defining whether the longitude (horizontal) coordinate
+axis wraps around a given range and how. Defaults to [-180, 180] in most
+geographical CRSs. If undefined, the longitude axis does not wrap around.
+
+
+ wrapLat
+ Number[]
+ Like wrapLng, but for the latitude (vertical) axis.
+
+
+ infinite
+ Boolean
+ If true, the coordinate space will be unbounded (infinite in both axes)
+
+
+
+
+
+
+
+Defined CRSs
+
+
+
+
+
+
+
+
+ CRS
+ Description
+
+
+
+ L.CRS.EPSG3395
+ Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
+
+
+ L.CRS.EPSG3857
+ The most common CRS for online maps, used by almost all free and commercial
+tile providers. Uses Spherical Mercator projection. Set in by default in
+Map's crs option.
+
+
+ L.CRS.EPSG4326
+ A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
+Leaflet 1.0.x complies with the TMS coordinate scheme for EPSG:4326,
+which is a breaking change from 0.7.x behaviour. If you are using a TileLayer
+with this CRS, ensure that there are two 256x256 pixel tiles covering the
+whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),
+or (-180,-90) for TileLayers with the tms option set.
+
+
+ L.CRS.Earth
+ Serves as the base for CRS that are global such that they cover the earth.
+Can only be used as the base for other CRS and cannot be used directly,
+since it does not have a code, projection or transformation. distance() returns
+meters.
+
+
+ L.CRS.Simple
+ A simple CRS that maps longitude and latitude into x and y directly.
+May be used for maps of flat surfaces (e.g. game maps). Note that the y
+axis should still be inverted (going from bottom to top). distance() returns
+simple euclidean distance.
+
+
+ L.CRS.Base
+ Object that defines coordinate reference systems for projecting
+geographical points into pixel (screen) coordinates and back (and to
+coordinates in other units for WMS services). See
+spatial reference system.
+Leaflet defines the most usual CRSs by default. If you want to use a
+CRS not defined by default, take a look at the
+Proj4Leaflet plugin.
+Note that the CRS instances do not inherit from Leaflet's Class object,
+and can't be instantiated. Also, new classes can't inherit from them,
+and methods can't be added to them with the include function.
+
+
+
+
+
+
+ Renderer
Base class for vector renderer implementations (SVG, Canvas). Handles the
+DOM container of the renderer, its bounds, and its zoom animation.
+A Renderer works as an implicit layer group for all Paths - the renderer
+itself can be added or removed to the map. All paths use a renderer, which can
+be implicit (the map will decide the type of renderer and use it automatically)
+or explicit (using the renderer option of the path).
+Do not use this class directly, use SVG and Canvas instead.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ padding
+ Number
+ 0.1
+ How much to extend the clip area around the map view (relative to its size)
+e.g. 0.1 would be 10% of map view in each direction
+
+
+ tolerance
+ Number
+ 0
+ How much to extend click tolerance round a path/object on the map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ update
+ Event
+ Fired when the renderer updates its bounds, center and zoom, for example when
+its map has moved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Event objects
Whenever a class inheriting from Evented fires an event, a listener function
+will be called with an event argument, which is a plain object containing
+information about the event. For example:
+map.on('click', function(ev) {
+ alert(ev.latlng); // ev is an event object (MouseEvent in this case)
+});
+
+The information available depends on the event type:
+
+
+
+
+Event
+
+
+
+
+
+The base event object. All other event objects contain these properties too.
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+KeyboardEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ originalEvent
+ DOMEvent
+ The original DOM KeyboardEvent that triggered this Leaflet event.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+MouseEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ latlng
+ LatLng
+ The geographical point where the mouse event occurred.
+
+
+ layerPoint
+ Point
+ Pixel coordinates of the point where the mouse event occurred relative to the map layer.
+
+
+ containerPoint
+ Point
+ Pixel coordinates of the point where the mouse event occurred relative to the map сontainer.
+
+
+ originalEvent
+ DOMEvent
+ The original DOM MouseEvent or DOM TouchEvent that triggered this Leaflet event.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+LocationEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ latlng
+ LatLng
+ Detected geographical location of the user.
+
+
+ bounds
+ LatLngBounds
+ Geographical bounds of the area user is located in (with respect to the accuracy of location).
+
+
+ accuracy
+ Number
+ Accuracy of location in meters.
+
+
+ altitude
+ Number
+ Height of the position above the WGS84 ellipsoid in meters.
+
+
+ altitudeAccuracy
+ Number
+ Accuracy of altitude in meters.
+
+
+ heading
+ Number
+ The direction of travel in degrees counting clockwise from true North.
+
+
+ speed
+ Number
+ Current velocity in meters per second.
+
+
+ timestamp
+ Number
+ The time when the position was acquired.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+ErrorEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ message
+ String
+ Error message.
+
+
+ code
+ Number
+ Error code (if applicable).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+LayerEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ layer
+ Layer
+ The layer that was added or removed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+
+
+
+
+
+
+
+
+LayersControlEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ layer
+ Layer
+ The layer that was added or removed.
+
+
+ name
+ String
+ The name of the layer that was added or removed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+
+
+
+
+
+
+
+
+TileEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ tile
+ HTMLElement
+ The tile element (image).
+
+
+ coords
+ Point
+ Point object with the tile's x, y, and z (zoom level) coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+TileErrorEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ tile
+ HTMLElement
+ The tile element (image).
+
+
+ coords
+ Point
+ Point object with the tile's x, y, and z (zoom level) coordinates.
+
+
+ error
+ *
+ Error passed to the tile's done() callback.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+ResizeEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ oldSize
+ Point
+ The old size before resize event.
+
+
+ newSize
+ Point
+ The new size after the resize event.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+GeoJSONEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ layer
+ Layer
+ The layer for the GeoJSON feature that is being added to the map.
+
+
+ properties
+ Object
+ GeoJSON properties of the feature.
+
+
+ geometryType
+ String
+ GeoJSON geometry type of the feature.
+
+
+ id
+ String
+ GeoJSON ID of the feature (if present).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+
+
+
+
+
+
+
+
+PopupEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ popup
+ Popup
+ The popup that was opened or closed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+TooltipEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ tooltip
+ Tooltip
+ The tooltip that was opened or closed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+DragEndEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ distance
+ Number
+ The distance in pixels the draggable element was moved by.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+ZoomAnimEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ center
+ LatLng
+ The current center of the map
+
+
+ zoom
+ Number
+ The current zoom level of the map
+
+
+ noUpdate
+ Boolean
+ Whether layers should update their contents due to this event
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+ DivOverlay
Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ offset
+ Point
+ Point(0, 7)
+ The offset of the popup position. Useful to control the anchor
+of the popup when opening it on some overlays.
+
+
+ className
+ String
+ ''
+ A custom CSS class name to assign to the popup.
+
+
+ pane
+ String
+ 'popupPane'
+ Map pane where the popup will be added.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Global Switches
Global switches are created for rare cases and generally make
+Leaflet to not detect a particular browser feature even if it's
+there. You need to set the switch as a global variable to true
+before including Leaflet on the page, like this:
+<script>L_NO_TOUCH = true;</script>
+<script src="leaflet.js"></script>
+
+
+
+
+Switch
+Description
+
+
+
+
+L_NO_TOUCH
+Forces Leaflet to not use touch events even if it detects them.
+
+
+L_DISABLE_3D
+Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning (which may cause glitches in some rare environments) even if they're supported.
+
+
+
+
+noConflict
This method restores the L global variable to the original value
+it had before Leaflet inclusion, and returns the real Leaflet
+namespace so you can put it elsewhere, like this:
+<script src='libs/l.js'>
+<!-- L points to some other library -->
+<script src='leaflet.js'>
+<!-- you include Leaflet, it replaces the L variable to Leaflet namespace -->
+<script>
+var Leaflet = L.noConflict();
+// now L points to that other library again, and you can use Leaflet.Map etc.
+</script>
+
+
+version
A constant that represents the Leaflet version in use.
+L.version; // contains "1.0.0" (or whatever version is currently in use)
+
diff --git a/docs/reference-1.5.0.html b/docs/reference-1.6.0.html
similarity index 88%
rename from docs/reference-1.5.0.html
rename to docs/reference-1.6.0.html
index 4ee68516249..1fa18a9b9f8 100644
--- a/docs/reference-1.5.0.html
+++ b/docs/reference-1.6.0.html
@@ -6,7 +6,7 @@
Leaflet API reference
-This reference reflects Leaflet 1.5.0 and Leaflet 1.5.1. Check this list if you are using a different version of Leaflet.
+This reference reflects Leaflet 1.6.0. Check this list if you are using a different version of Leaflet.
@@ -169,12 +169,12 @@ Creation
- L.map(<String> id, <Map options> options?)
+ L.map(<String> id, <Map options> options?)
Instantiates a map object given the DOM ID of a <div> element
and optionally an object literal with Map options.
- L.map(<HTMLElement> el, <Map options> options?)
+ L.map(<HTMLElement> el, <Map options> options?)
Instantiates a map object given an instance of a <div> HTML element
and optionally an object literal with Map options.
@@ -201,7 +201,7 @@ Options
preferCanvas
- Boolean
+ Boolean
false
Whether Paths should be rendered on a Canvas renderer.
By default, all Paths are rendered in a SVG renderer.
@@ -223,13 +223,13 @@ Control options
attributionControl
- Boolean
+ Boolean
true
Whether a attribution control is added to the map by default.
zoomControl
- Boolean
+ Boolean
true
Whether a zoom control is added to the map by default.
@@ -250,13 +250,13 @@ Interaction Options
closePopupOnClick
- Boolean
+ Boolean
true
Set it to false if you don't want popups to close when user clicks the map.
zoomSnap
- Number
+ Number
1
Forces the map's zoom level to always be a multiple of this, particularly
right after a fitBounds() or a pinch-zoom.
@@ -266,7 +266,7 @@ Interaction Options
zoomDelta
- Number
+ Number
1
Controls how much the map's zoom level will change after a
zoomIn(), zoomOut(), pressing +
@@ -275,20 +275,20 @@ Interaction Options
trackResize
- Boolean
+ Boolean
true
Whether the map automatically handles browser window resize to update itself.
boxZoom
- Boolean
+ Boolean
true
Whether the map can be zoomed to a rectangular area specified by
dragging the mouse while pressing the shift key.
doubleClickZoom
- Boolean|String
+ Boolean|String
true
Whether the map can be zoomed in by double clicking on it and
zoomed out by double clicking while holding shift. If passed
@@ -297,7 +297,7 @@ Interaction Options
dragging
- Boolean
+ Boolean
true
Whether the map be draggable with mouse/touch or not.
@@ -318,26 +318,26 @@ Map State Options
crs
- CRS
+ CRS
L.CRS.EPSG3857
The Coordinate Reference System to use. Don't change this if you're not
sure what it means.
center
- LatLng
+ LatLng
undefined
Initial geographic center of the map
zoom
- Number
+ Number
undefined
Initial map zoom level
minZoom
- Number
+ Number
*
Minimum zoom level of the map.
If not specified and at least one GridLayer or TileLayer is in the map,
@@ -345,7 +345,7 @@ Map State Options
maxZoom
- Number
+ Number
*
Maximum zoom level of the map.
If not specified and at least one GridLayer or TileLayer is in the map,
@@ -353,13 +353,13 @@ Map State Options
layers
- Layer[]
+ Layer[]
[]
Array of layers that will be added to the map initially
maxBounds
- LatLngBounds
+ LatLngBounds
null
When this option is set, the map restricts the view to the given
geographical bounds, bouncing the user back if the user tries to pan
@@ -368,7 +368,7 @@ Map State Options
renderer
- Renderer
+ Renderer
*
The default method for drawing vector layers on the map. L.SVG
or L.Canvas by default depending on browser support.
@@ -390,27 +390,27 @@ Animation Options
zoomAnimation
- Boolean
+ Boolean
true
Whether the map zoom animation is enabled. By default it's enabled
in all browsers that support CSS3 Transitions except Android.
zoomAnimationThreshold
- Number
+ Number
4
Won't animate zoom if the zoom difference exceeds this value.
fadeAnimation
- Boolean
+ Boolean
true
Whether the tile fade animation is enabled. By default it's enabled
in all browsers that support CSS3 Transitions except Android.
markerZoomAnimation
- Boolean
+ Boolean
true
Whether markers animate their zoom with the zoom animation, if disabled
they will disappear for the length of the animation. By default it's
@@ -418,7 +418,7 @@ Animation Options
transform3DLimit
- Number
+ Number
2^23
Defines the maximum size of a CSS translation transform. The default
value should not be changed unless a web browser positions layers in
@@ -441,7 +441,7 @@ Panning Inertia Options
inertia
- Boolean
+ Boolean
*
If enabled, panning of the map will have an inertia effect where
the map builds momentum while dragging and continues moving in
@@ -450,25 +450,25 @@ Panning Inertia Options
inertiaDeceleration
- Number
+ Number
3000
The rate with which the inertial movement slows down, in pixels/second².
inertiaMaxSpeed
- Number
+ Number
Infinity
Max speed of the inertial movement, in pixels/second.
easeLinearity
- Number
+ Number
0.2
worldCopyJump
- Boolean
+ Boolean
false
With this option enabled, the map tracks when you pan to another "copy"
of the world and seamlessly jumps to the original one so that all overlays
@@ -476,7 +476,7 @@ Panning Inertia Options
maxBoundsViscosity
- Number
+ Number
0.0
If maxBounds is set, this option will control how solid the bounds
are when dragging the map around. The default value of 0.0 allows the
@@ -501,14 +501,14 @@ Keyboard Navigation Options
keyboard
- Boolean
+ Boolean
true
Makes the map focusable and allows users to navigate the map with keyboard
arrows and +/- keys.
keyboardPanDelta
- Number
+ Number
80
Amount of pixels to pan when pressing an arrow key.
@@ -529,21 +529,21 @@ Mousewheel options
scrollWheelZoom
- Boolean|String
+ Boolean|String
true
Whether the map can be zoomed by using the mouse wheel. If passed 'center',
it will zoom to the center of the view regardless of where the mouse was.
wheelDebounceTime
- Number
+ Number
40
Limits the rate at which a wheel can fire (in milliseconds). By default
user can't zoom via wheel more often than once per 40 ms.
wheelPxPerZoomLevel
- Number
+ Number
60
How many scroll pixels (as reported by L.DomEvent.getWheelDelta)
mean a change of one full zoom level. Smaller values will make wheel-zooming
@@ -566,21 +566,21 @@ Touch interaction options
tap
- Boolean
+ Boolean
true
Enables mobile hacks for supporting instant taps (fixing 200ms click
delay on iOS/Android) and touch holds (fired as contextmenu events).
tapTolerance
- Number
+ Number
15
The max number of pixels a user can shift his finger during touch
for it to be considered a valid tap.
touchZoom
- Boolean|String
+ Boolean|String
*
Whether the map can be zoomed by touch-dragging with two fingers. If
passed 'center', it will zoom to the center of the view regardless of
@@ -589,7 +589,7 @@ Touch interaction options
bounceAtZoomLimits
- Boolean
+ Boolean
true
Set it to false if you don't want the map to zoom beyond min/max zoom
and then bounce back when pinch-zooming.
@@ -615,27 +615,27 @@ Layer events
- baselayerchange
+ baselayerchange
LayersControlEvent
Fired when the base layer is changed through the layer control.
- overlayadd
+ overlayadd
LayersControlEvent
Fired when an overlay is selected through the layer control.
- overlayremove
+ overlayremove
LayersControlEvent
Fired when an overlay is deselected through the layer control.
- layeradd
+ layeradd
LayerEvent
Fired when a new layer is added to the map.
- layerremove
+ layerremove
LayerEvent
Fired when some layer is removed from the map
@@ -655,62 +655,62 @@ Map state change events
- zoomlevelschange
+ zoomlevelschange
Event
Fired when the number of zoomlevels on the map is changed due
to adding or removing a layer.
- resize
+ resize
ResizeEvent
Fired when the map is resized.
- unload
+ unload
Event
Fired when the map is destroyed with remove method.
- viewreset
+ viewreset
Event
Fired when the map needs to redraw its content (this usually happens
on map zoom or load). Very useful for creating custom overlays.
- load
+ load
Event
Fired when the map is initialized (when its center and zoom are set
for the first time).
- zoomstart
+ zoomstart
Event
Fired when the map zoom is about to change (e.g. before zoom animation).
- movestart
+ movestart
Event
Fired when the view of the map starts changing (e.g. user starts dragging the map).
- zoom
+ zoom
Event
Fired repeatedly during any change in zoom level, including zoom
and fly animations.
- move
+ move
Event
Fired repeatedly during any movement of the map, including pan and
fly animations.
- zoomend
+ zoomend
Event
Fired when the map has changed, after any animations.
- moveend
+ moveend
Event
Fired when the center of the map stops changing (e.g. user stopped
dragging the map).
@@ -730,17 +730,17 @@ Popup events
- popupopen
+ popupopen
PopupEvent
Fired when a popup is opened in the map
- popupclose
+ popupclose
PopupEvent
Fired when a popup in the map is closed
- autopanstart
+ autopanstart
Event
Fired when the map starts autopanning when opening a popup.
@@ -759,12 +759,12 @@ Tooltip events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip is opened in the map.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip in the map is closed.
@@ -783,12 +783,12 @@ Location events
- locationerror
+ locationerror
ErrorEvent
Fired when geolocation (using the locate method) failed.
- locationfound
+ locationfound
LocationEvent
Fired when geolocation (using the locate method)
went successfully.
@@ -808,42 +808,42 @@ Interaction events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the map.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the map.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the map.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button on the map.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the map.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the map.
- mousemove
+ mousemove
MouseEvent
Fired while the mouse moves over the map.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user pushes the right mouse button on the map, prevents
default browser context menu from showing if there are listeners on
@@ -851,24 +851,24 @@ Interaction events
for a second (also called long press).
- keypress
+ keypress
KeyboardEvent
Fired when the user presses a key from the keyboard that produces a character value while the map is focused.
- keydown
+ keydown
KeyboardEvent
Fired when the user presses a key from the keyboard while the map is focused. Unlike the keypress event,
the keydown event is fired for keys that produce a character value and for keys
that do not produce a character value.
- keyup
+ keyup
KeyboardEvent
Fired when the user releases a key from the keyboard while the map is focused.
- preclick
+ preclick
MouseEvent
Fired before mouse click on the map (sometimes useful when you
want something to happen on click before any existing click
@@ -878,7 +878,7 @@ Interaction events
-Other Methods
+Other Events
@@ -889,7 +889,7 @@ Other Methods
- zoomanim
+ zoomanim
ZoomAnimEvent
Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom.
@@ -914,7 +914,7 @@ Methods
- getRenderer(<Path> layer)
+ getRenderer(<Path> layer)
Renderer
Returns the instance of Renderer that should be used to render the given
Path. It will ensure that the renderer options of the map and paths
@@ -937,37 +937,37 @@
Methods for Layers and Controls
- addControl(<Control> control)
+ addControl(<Control> control)
this
Adds the given control to the map
- removeControl(<Control> control)
+ removeControl(<Control> control)
this
Removes the given control from the map
- addLayer(<Layer> layer)
+ addLayer(<Layer> layer)
this
Adds the given layer to the map
- removeLayer(<Layer> layer)
+ removeLayer(<Layer> layer)
this
Removes the given layer from the map.
- hasLayer(<Layer> layer)
+ hasLayer(<Layer> layer)
Boolean
Returns true if the given layer is currently added to the map
- eachLayer(<Function> fn, <Object> context?)
+ eachLayer(<Function> fn, <Object> context?)
this
Iterates over the layers of the map, optionally specifying context of the iterator function.
map.eachLayer(function(layer){
@@ -976,37 +976,37 @@ Methods for Layers and Controls
- openPopup(<Popup> popup)
+ openPopup(<Popup> popup)
this
Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
- openPopup(<String|HTMLElement> content, <LatLng> latlng, <Popup options> options?)
+ openPopup(<String|HTMLElement> content, <LatLng> latlng, <Popup options> options?)
this
Creates a popup with the specified content and options and opens it in the given point on a map.
- closePopup(<Popup> popup?)
+ closePopup(<Popup> popup?)
this
Closes the popup previously opened with openPopup (or the given one).
- openTooltip(<Tooltip> tooltip)
+ openTooltip(<Tooltip> tooltip)
this
Opens the specified tooltip.
- openTooltip(<String|HTMLElement> content, <LatLng> latlng, <Tooltip options> options?)
+ openTooltip(<String|HTMLElement> content, <LatLng> latlng, <Tooltip options> options?)
this
Creates a tooltip with the specified content and options and open it.
- closeTooltip(<Tooltip> tooltip?)
+ closeTooltip(<Tooltip> tooltip?)
this
Closes the tooltip given as parameter.
@@ -1026,109 +1026,109 @@ Methods for modifying map state
- setView(<LatLng> center, <Number> zoom, <Zoom/pan options> options?)
+ setView(<LatLng> center, <Number> zoom, <Zoom/pan options> options?)
this
Sets the view of the map (geographical center and zoom) with the given
animation options.
- setZoom(<Number> zoom, <Zoom/pan options> options?)
+ setZoom(<Number> zoom, <Zoom/pan options> options?)
this
Sets the zoom of the map.
- zoomIn(<Number> delta?, <Zoom options> options?)
+ zoomIn(<Number> delta?, <Zoom options> options?)
this
Increases the zoom of the map by delta (zoomDelta by default).
- zoomOut(<Number> delta?, <Zoom options> options?)
+ zoomOut(<Number> delta?, <Zoom options> options?)
this
Decreases the zoom of the map by delta (zoomDelta by default).
- setZoomAround(<LatLng> latlng, <Number> zoom, <Zoom options> options)
+ setZoomAround(<LatLng> latlng, <Number> zoom, <Zoom options> options)
this
Zooms the map while keeping a specified geographical point on the map
stationary (e.g. used internally for scroll zoom and double-click zoom).
- setZoomAround(<Point> offset, <Number> zoom, <Zoom options> options)
+ setZoomAround(<Point> offset, <Number> zoom, <Zoom options> options)
this
Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
- fitBounds(<LatLngBounds> bounds, <fitBounds options> options?)
+ fitBounds(<LatLngBounds> bounds, <fitBounds options> options?)
this
Sets a map view that contains the given geographical bounds with the
maximum zoom level possible.
- fitWorld(<fitBounds options> options?)
+ fitWorld(<fitBounds options> options?)
this
Sets a map view that mostly contains the whole world with the maximum
zoom level possible.
- panTo(<LatLng> latlng, <Pan options> options?)
+ panTo(<LatLng> latlng, <Pan options> options?)
this
Pans the map to a given center.
- panBy(<Point> offset, <Pan options> options?)
+ panBy(<Point> offset, <Pan options> options?)
this
Pans the map by a given number of pixels (animated).
- flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?)
+ flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?)
this
Sets the view of the map (geographical center and zoom) performing a smooth
pan-zoom animation.
- flyToBounds(<LatLngBounds> bounds, <fitBounds options> options?)
+ flyToBounds(<LatLngBounds> bounds, <fitBounds options> options?)
this
Sets the view of the map with a smooth animation like flyTo,
but takes a bounds parameter like fitBounds.
- setMaxBounds(<Bounds> bounds)
+ setMaxBounds(<Bounds> bounds)
this
Restricts the map view to the given bounds (see the maxBounds option).
- setMinZoom(<Number> zoom)
+ setMinZoom(<Number> zoom)
this
Sets the lower limit for the available zoom levels (see the minZoom option).
- setMaxZoom(<Number> zoom)
+ setMaxZoom(<Number> zoom)
this
Sets the upper limit for the available zoom levels (see the maxZoom option).
- panInsideBounds(<LatLngBounds> bounds, <Pan options> options?)
+ panInsideBounds(<LatLngBounds> bounds, <Pan options> options?)
this
Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
- panInside(<LatLng> latlng, <options> options?)
+ panInside(<LatLng> latlng, <options> options?)
this
Pans the map the minimum amount to make the latlng visible. Use
padding, paddingTopLeft and paddingTopRight options to fit
@@ -1138,7 +1138,7 @@
Methods for modifying map state
- invalidateSize(<Zoom/pan options> options)
+ invalidateSize(<Zoom/pan options> options)
this
Checks if the map container size changed and updates the map if so —
call it after you've changed the map size dynamically, also animating
@@ -1149,7 +1149,7 @@
Methods for modifying map state
- invalidateSize(<Boolean> animate)
+ invalidateSize(<Boolean> animate)
this
Checks if the map container size changed and updates the map if so —
call it after you've changed the map size dynamically, also animating
@@ -1157,7 +1157,7 @@
Methods for modifying map state
- stop()
+ stop()
this
Stops the currently running panTo or flyTo animation, if any.
@@ -1177,7 +1177,7 @@ Geolocation methods
- locate(<Locate options> options?)
+ locate(<Locate options> options?)
this
Tries to locate the user using the Geolocation API, firing a locationfound
event with location data on success or a locationerror event on failure,
@@ -1189,7 +1189,7 @@
Geolocation methods
- stopLocate()
+ stopLocate()
this
Stops watching location previously initiated by map.locate({watch: true})
and aborts resetting the map view if map.locate was called with
@@ -1211,19 +1211,19 @@
Other Methods
- addHandler(<String> name, <Function> HandlerClass)
+ addHandler(<String> name, <Function> HandlerClass)
this
Adds a new Handler to the map, given its name and constructor function.
- remove()
+ remove()
this
Destroys the map and clears all related event listeners.
- createPane(<String> name, <HTMLElement> container?)
+ createPane(<String> name, <HTMLElement> container?)
HTMLElement
Creates a new map pane with the given name if it doesn't exist already,
then returns it. The pane is created as a child of container, or
@@ -1231,26 +1231,26 @@
Other Methods
- getPane(<String|HTMLElement> pane)
+ getPane(<String|HTMLElement> pane)
HTMLElement
Returns a map pane, given its name or its HTML element (its identity).
- getPanes()
+ getPanes()
Object
Returns a plain object containing the names of all panes as keys and
the panes as values.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTML element that contains the map.
- whenReady(<Function> fn, <Object> context?)
+ whenReady(<Function> fn, <Object> context?)
this
Runs the given function fn when the map gets initialized with
a view (center and zoom) and at least one layer, or immediately
@@ -1272,37 +1272,37 @@
Methods for Getting Map State
- getCenter()
+ getCenter()
LatLng
Returns the geographical center of the map view
- getZoom()
+ getZoom()
Number
Returns the current zoom level of the map view
- getBounds()
+ getBounds()
LatLngBounds
Returns the geographical bounds visible in the current map view
- getMinZoom()
+ getMinZoom()
Number
Returns the minimum zoom level of the map (if set in the minZoom option of the map or of any layers), or 0 by default.
- getMaxZoom()
+ getMaxZoom()
Number
Returns the maximum zoom level of the map (if set in the maxZoom option of the map or of any layers).
- getBoundsZoom(<LatLngBounds> bounds, <Boolean> inside?, <Point> padding?)
+ getBoundsZoom(<LatLngBounds> bounds, <Boolean> inside?, <Point> padding?)
Number
Returns the maximum zoom level on which the given bounds fit to the map
view in its entirety. If inside (optional) is set to true, the method
@@ -1311,27 +1311,27 @@
Methods for Getting Map State
- getSize()
+ getSize()
Point
Returns the current size of the map container (in pixels).
- getPixelBounds()
+ getPixelBounds()
Bounds
Returns the bounds of the current map view in projected pixel
coordinates (sometimes useful in layer and overlay implementations).
- getPixelOrigin()
+ getPixelOrigin()
Point
Returns the projected pixel coordinates of the top left point of
the map layer (useful in custom layer and overlay implementations).
- getPixelWorldBounds(<Number> zoom?)
+ getPixelWorldBounds(<Number> zoom?)
Bounds
Returns the world's bounds in pixel coordinates for zoom level zoom.
If zoom is omitted, the map's current zoom level is used.
@@ -1352,14 +1352,14 @@ Conversion Methods
- getZoomScale(<Number> toZoom, <Number> fromZoom)
+ getZoomScale(<Number> toZoom, <Number> fromZoom)
Number
Returns the scale factor to be applied to a map transition from zoom level
fromZoom to toZoom. Used internally to help with zoom animations.
- getScaleZoom(<Number> scale, <Number> fromZoom)
+ getScaleZoom(<Number> scale, <Number> fromZoom)
Number
Returns the zoom level that the map would end up at, if it is at fromZoom
level and everything is scaled by a factor of scale. Inverse of
@@ -1367,7 +1367,7 @@
Conversion Methods
- project(<LatLng> latlng, <Number> zoom)
+ project(<LatLng> latlng, <Number> zoom)
Point
Projects a geographical coordinate LatLng according to the projection
of the map's CRS, then scales it according to zoom and the CRS's
@@ -1376,27 +1376,27 @@
Conversion Methods
- unproject(<Point> point, <Number> zoom)
+ unproject(<Point> point, <Number> zoom)
LatLng
Inverse of project.
- layerPointToLatLng(<Point> point)
+ layerPointToLatLng(<Point> point)
LatLng
Given a pixel coordinate relative to the origin pixel,
returns the corresponding geographical coordinate (for the current zoom level).
- latLngToLayerPoint(<LatLng> latlng)
+ latLngToLayerPoint(<LatLng> latlng)
Point
Given a geographical coordinate, returns the corresponding pixel coordinate
relative to the origin pixel.
- wrapLatLng(<LatLng> latlng)
+ wrapLatLng(<LatLng> latlng)
LatLng
Returns a LatLng where lat and lng has been wrapped according to the
map's CRS's wrapLat and wrapLng properties, if they are outside the
@@ -1406,7 +1406,7 @@
Conversion Methods
- wrapLatLngBounds(<LatLngBounds> bounds)
+ wrapLatLngBounds(<LatLngBounds> bounds)
LatLngBounds
Returns a LatLngBounds with the same size as the given one, ensuring that
its center is within the CRS's bounds.
@@ -1416,56 +1416,56 @@
Conversion Methods
- distance(<LatLng> latlng1, <LatLng> latlng2)
+ distance(<LatLng> latlng1, <LatLng> latlng2)
Number
Returns the distance between two geographical coordinates according to
the map's CRS. By default this measures distance in meters.
- containerPointToLayerPoint(<Point> point)
+ containerPointToLayerPoint(<Point> point)
Point
Given a pixel coordinate relative to the map container, returns the corresponding
pixel coordinate relative to the origin pixel.
- layerPointToContainerPoint(<Point> point)
+ layerPointToContainerPoint(<Point> point)
Point
Given a pixel coordinate relative to the origin pixel,
returns the corresponding pixel coordinate relative to the map container.
- containerPointToLatLng(<Point> point)
+ containerPointToLatLng(<Point> point)
LatLng
Given a pixel coordinate relative to the map container, returns
the corresponding geographical coordinate (for the current zoom level).
- latLngToContainerPoint(<LatLng> latlng)
+ latLngToContainerPoint(<LatLng> latlng)
Point
Given a geographical coordinate, returns the corresponding pixel coordinate
relative to the map container.
- mouseEventToContainerPoint(<MouseEvent> ev)
+ mouseEventToContainerPoint(<MouseEvent> ev)
Point
Given a MouseEvent object, returns the pixel coordinate relative to the
map container where the event took place.
- mouseEventToLayerPoint(<MouseEvent> ev)
+ mouseEventToLayerPoint(<MouseEvent> ev)
Point
Given a MouseEvent object, returns the pixel coordinate relative to
the origin pixel where the event took place.
- mouseEventToLatLng(<MouseEvent> ev)
+ mouseEventToLatLng(<MouseEvent> ev)
LatLng
Given a MouseEvent object, returns geographical coordinate where the
event took place.
@@ -1492,37 +1492,37 @@ Conversion Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -1530,61 +1530,61 @@
Conversion Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -1611,7 +1611,7 @@ Controls
- zoomControl
+ zoomControl
Control.Zoom
The default zoom control (only available if the
zoomControl option was true when creating the map).
@@ -1631,37 +1631,37 @@ Handlers
- boxZoom
+ boxZoom
Handler
Box (shift-drag with mouse) zoom handler.
- doubleClickZoom
+ doubleClickZoom
Handler
Double click zoom handler.
- dragging
+ dragging
Handler
Map dragging handler (by both mouse and touch).
- keyboard
+ keyboard
Handler
Keyboard navigation handler.
- scrollWheelZoom
+ scrollWheelZoom
Handler
Scroll wheel zoom handler.
- tap
+ tap
Handler
Mobile touch hacks (quick tap and touch hold) handler.
- touchZoom
+ touchZoom
Handler
Touch zoom handler.
@@ -1693,43 +1693,43 @@ Map panes
mapPane
- HTMLElement
+ HTMLElement
'auto'
Pane that contains all other map panes
tilePane
- HTMLElement
+ HTMLElement
200
Pane for GridLayers and TileLayers
overlayPane
- HTMLElement
+ HTMLElement
400
Pane for vectors (Paths, like Polylines and Polygons), ImageOverlays and VideoOverlays
shadowPane
- HTMLElement
+ HTMLElement
500
Pane for overlay shadows (e.g. Marker shadows)
markerPane
- HTMLElement
+ HTMLElement
600
Pane for Icons of Markers
tooltipPane
- HTMLElement
+ HTMLElement
650
Pane for Tooltips.
popupPane
- HTMLElement
+ HTMLElement
700
Pane for Popups.
@@ -1760,7 +1760,7 @@ Locate options
watch
- Boolean
+ Boolean
false
If true, starts continuous watching of location changes (instead of detecting it
once) using W3C watchPosition method. You can later stop watching using
@@ -1768,34 +1768,34 @@ Locate options
setView
- Boolean
+ Boolean
false
If true, automatically sets the map view to the user location with respect to
detection accuracy, or to world view if geolocation failed.
maxZoom
- Number
+ Number
Infinity
The maximum zoom for automatic view setting when using setView option.
timeout
- Number
+ Number
10000
Number of milliseconds to wait for a response from geolocation before firing a
locationerror event.
maximumAge
- Number
+ Number
0
Maximum age of detected location. If less than this amount of milliseconds
passed since last geolocation response, locate will return a cached location.
enableHighAccuracy
- Boolean
+ Boolean
false
Enables high accuracy, see description in the W3C spec.
@@ -1827,7 +1827,7 @@ Zoom options
animate
- Boolean
+ Boolean
If not specified, zoom animation will happen if the zoom origin is inside the
current view. If true, the map will attempt animating zoom disregarding where
@@ -1862,7 +1862,7 @@ Pan options
animate
- Boolean
+ Boolean
If true, panning will always be animated if possible. If false, it will
not animate panning, either resetting the map view if panning more than a
@@ -1871,13 +1871,13 @@ Pan options
duration
- Number
+ Number
0.25
Duration of animated panning, in seconds.
easeLinearity
- Number
+ Number
0.25
The curvature factor of panning animation easing (third parameter of the
Cubic Bezier curve). 1.0 means linear animation,
@@ -1885,7 +1885,7 @@ Pan options
noMoveStart
- Boolean
+ Boolean
false
If true, panning won't fire movestart event on start (used internally for
panning inertia).
@@ -1921,7 +1921,7 @@ Zoom/pan options
animate
- Boolean
+ Boolean
If not specified, zoom animation will happen if the zoom origin is inside the
current view. If true, the map will attempt animating zoom disregarding where
@@ -1952,13 +1952,13 @@ Zoom/pan options
duration
- Number
+ Number
0.25
Duration of animated panning, in seconds.
easeLinearity
- Number
+ Number
0.25
The curvature factor of panning animation easing (third parameter of the
Cubic Bezier curve). 1.0 means linear animation,
@@ -1966,7 +1966,7 @@ Zoom/pan options
noMoveStart
- Boolean
+ Boolean
false
If true, panning won't fire movestart event on start (used internally for
panning inertia).
@@ -1997,7 +1997,7 @@ FitBounds options
paddingTopLeft
- Point
+ Point
[0, 0]
Sets the amount of padding in the top left corner of a map container that
shouldn't be accounted for when setting the view to fit bounds. Useful if you
@@ -2006,19 +2006,19 @@ FitBounds options
paddingBottomRight
- Point
+ Point
[0, 0]
The same for the bottom right corner of the map.
padding
- Point
+ Point
[0, 0]
Equivalent of setting both top left and bottom right padding to the same value.
maxZoom
- Number
+ Number
null
The maximum possible zoom to use.
@@ -2045,7 +2045,7 @@ FitBounds options
animate
- Boolean
+ Boolean
If not specified, zoom animation will happen if the zoom origin is inside the
current view. If true, the map will attempt animating zoom disregarding where
@@ -2076,13 +2076,13 @@ FitBounds options
duration
- Number
+ Number
0.25
Duration of animated panning, in seconds.
easeLinearity
- Number
+ Number
0.25
The curvature factor of panning animation easing (third parameter of the
Cubic Bezier curve). 1.0 means linear animation,
@@ -2090,7 +2090,7 @@ FitBounds options
noMoveStart
- Boolean
+ Boolean
false
If true, panning won't fire movestart event on start (used internally for
panning inertia).
@@ -2135,7 +2135,7 @@ Creation
- L.marker(<LatLng> latlng, <Marker options> options?)
+ L.marker(<LatLng> latlng, <Marker options> options?)
Instantiates a Marker object given a geographical point and optionally an options object.
@@ -2161,7 +2161,7 @@ Options
icon
- Icon
+ Icon
*
Icon instance to use for rendering the marker.
See Icon documentation for details on how to customize the marker icon.
@@ -2169,56 +2169,56 @@ Options
keyboard
- Boolean
+ Boolean
true
Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
title
- String
+ String
''
Text for the browser tooltip that appear on marker hover (no tooltip by default).
alt
- String
+ String
''
Text for the alt attribute of the icon image (useful for accessibility).
zIndexOffset
- Number
+ Number
0
By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
opacity
- Number
+ Number
1.0
The opacity of the marker.
riseOnHover
- Boolean
+ Boolean
false
If true, the marker will get on top of others when you hover the mouse over it.
riseOffset
- Number
+ Number
250
The z-index offset used for the riseOnHover feature.
pane
- String
+ String
'markerPane'
Map pane where the markers icon will be added.
Map pane where the markers shadow will be added.
bubblingMouseEvents
- Boolean
+ Boolean
false
When true, a mouse event on this marker will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
@@ -2240,26 +2240,26 @@ Draggable marker options
draggable
- Boolean
+ Boolean
false
Whether the marker is draggable with mouse/touch or not.
autoPan
- Boolean
+ Boolean
false
Whether to pan the map when dragging this marker near its edge or not.
autoPanPadding
- Point
+ Point
Point(50, 50)
Distance (in pixels to the left/right and to the top/bottom) of the
map edge to start panning the map.
autoPanSpeed
- Number
+ Number
10
Number of pixels the map should pan by.
@@ -2286,7 +2286,7 @@ Draggable marker options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
@@ -2314,7 +2314,7 @@ Draggable marker options
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -2331,7 +2331,6 @@ Events
-In addition to shared layer methods like addTo() and remove() and popup methods like bindPopup() you can also use the following methods:
@@ -2341,7 +2340,7 @@ Events
- move
+ move
Event
Fired when the marker is moved via setLatLng or by dragging. Old and new coordinates are included in event arguments as oldLatLng, latlng.
@@ -2360,27 +2359,27 @@ Dragging events
- dragstart
+ dragstart
Event
Fired when the user starts dragging the marker.
- movestart
+ movestart
Event
Fired when the marker starts moving (because of dragging).
- drag
+ drag
Event
Fired repeatedly while the user drags the marker.
- dragend
+ dragend
DragEndEvent
Fired when the user stops dragging the marker.
- moveend
+ moveend
Event
Fired when the marker stops moving (because of dragging).
@@ -2405,37 +2404,37 @@ Dragging events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -2464,12 +2463,12 @@ Dragging events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -2495,12 +2494,12 @@ Dragging events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -2526,12 +2525,12 @@ Dragging events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -2548,6 +2547,7 @@ Methods
+In addition to shared layer methods like addTo() and remove() and popup methods like bindPopup() you can also use the following methods:
@@ -2556,52 +2556,66 @@ Methods
Description
-
- toGeoJSON(<Number> precision?)
- Object
- precision is the number of decimal places for coordinates.
-The default value is 6 places.
-Returns a GeoJSON representation of the marker (as a GeoJSON Point Feature).
-
-
- getLatLng()
+ getLatLng()
LatLng
Returns the current geographical position of the marker.
- setLatLng(<LatLng> latlng)
+ setLatLng(<LatLng> latlng)
this
Changes the marker position to the given point.
- setZIndexOffset(<Number> offset)
+ setZIndexOffset(<Number> offset)
this
Changes the zIndex offset of the marker.
- getIcon()
+ getIcon()
Icon
Returns the current icon used by the marker
- setIcon(<Icon> icon)
+ setIcon(<Icon> icon)
this
Changes the marker icon.
- setOpacity(<Number> opacity)
+ setOpacity(<Number> opacity)
this
Changes the opacity of the marker.
+
+
+Other methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the marker (as a GeoJSON Point Feature).
+
+
+
+
@@ -2621,31 +2635,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -2672,7 +2686,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -2680,43 +2694,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -2743,7 +2757,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -2751,43 +2765,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -2814,37 +2828,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -2852,61 +2866,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -2936,7 +2950,7 @@ Interaction handlers
- dragging
+ dragging
Handler
Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set marker.options.draggable).
@@ -2989,7 +3003,7 @@ Creation
- L.popup(<Popup options> options?, <Layer> source?)
+ L.popup(<Popup options> options?, <Layer> source?)
Instantiates a Popup object given an optional options object that describes its appearance and location and an optional source object that is used to tag the popup with a reference to the Layer to which it refers.
@@ -3015,87 +3029,87 @@ Options
maxWidth
- Number
+ Number
300
Max width of the popup, in pixels.
minWidth
- Number
+ Number
50
Min width of the popup, in pixels.
maxHeight
- Number
+ Number
null
If set, creates a scrollable container of the given height
inside a popup if its content exceeds it.
autoPan
- Boolean
+ Boolean
true
Set it to false if you don't want the map to do panning animation
to fit the opened popup.
autoPanPaddingTopLeft
- Point
+ Point
null
The margin between the popup and the top left corner of the map
view after autopanning was performed.
autoPanPaddingBottomRight
- Point
+ Point
null
The margin between the popup and the bottom right corner of the map
view after autopanning was performed.
autoPanPadding
- Point
+ Point
Point(5, 5)
Equivalent of setting both top left and bottom right autopan padding to the same value.
keepInView
- Boolean
+ Boolean
false
Set it to true if you want to prevent users from panning the popup
off of the screen while it is open.
closeButton
- Boolean
+ Boolean
true
Controls the presence of a close button in the popup.
autoClose
- Boolean
+ Boolean
true
Set it to false if you want to override the default behavior of
the popup closing when another popup is opened.
closeOnEscapeKey
- Boolean
+ Boolean
true
Set it to false if you want to override the default behavior of
the ESC key for closing of the popup.
closeOnClick
- Boolean
+ Boolean
*
Set it if you want to override the default behavior of the popup closing when user clicks
on the map. Defaults to the map's closePopupOnClick option.
className
- String
+ String
''
A custom CSS class name to assign to the popup.
@@ -3122,14 +3136,14 @@ Options
offset
- Point
+ Point
Point(0, 7)
The offset of the popup position. Useful to control the anchor
of the popup when opening it on some overlays.
pane
- String
+ String
'popupPane'
Map pane where the popup will be added.
@@ -3157,7 +3171,7 @@ Options
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -3189,12 +3203,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -3220,12 +3234,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -3251,12 +3265,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -3282,61 +3296,61 @@ Methods
- getLatLng()
+ getLatLng()
LatLng
Returns the geographical point of popup.
- setLatLng(<LatLng> latlng)
+ setLatLng(<LatLng> latlng)
this
Sets the geographical point where the popup will open.
- getContent()
+ getContent()
String|HTMLElement
Returns the content of the popup.
- setContent(<String|HTMLElement|Function> htmlContent)
+ setContent(<String|HTMLElement|Function> htmlContent)
this
Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a String or HTMLElement to be used in the popup.
- getElement()
+ getElement()
String|HTMLElement
Alias for getContent()
- update()
+ update()
null
Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
- isOpen()
+ isOpen()
Boolean
Returns true when the popup is visible on the map.
- bringToFront()
+ bringToFront()
this
Brings this popup in front of other popups (in the same map pane).
- bringToBack()
+ bringToBack()
this
Brings this popup to the back of other popups (in the same map pane).
- openOn(<Map> map)
+ openOn(<Map> map)
this
Adds the popup to the map and closes the previous one. The same as map.openPopup(popup).
@@ -3362,31 +3376,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -3413,7 +3427,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -3421,43 +3435,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -3484,7 +3498,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -3492,43 +3506,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -3555,37 +3569,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -3593,61 +3607,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -3701,7 +3715,7 @@ Creation
- L.tooltip(<Tooltip options> options?, <Layer> source?)
+ L.tooltip(<Tooltip options> options?, <Layer> source?)
Instantiates a Tooltip object given an optional options object that describes its appearance and location and an optional source object that is used to tag the tooltip with a reference to the Layer to which it refers.
@@ -3727,19 +3741,19 @@ Options
pane
- String
+ String
'tooltipPane'
Map pane where the tooltip will be added.
offset
- Point
+ Point
Point(0, 0)
Optional offset of the tooltip position.
direction
- String
+ String
'auto'
Direction where to open the tooltip. Possible values are: right, left,
top, bottom, center, auto.
@@ -3748,25 +3762,25 @@ Options
permanent
- Boolean
+ Boolean
false
Whether to open the tooltip permanently or only on mouseover.
sticky
- Boolean
+ Boolean
false
If true, the tooltip will follow the mouse instead of being fixed at the feature center.
interactive
- Boolean
+ Boolean
false
If true, the tooltip will listen to the feature events.
opacity
- Number
+ Number
0.9
Tooltip container opacity.
@@ -3793,7 +3807,7 @@ Options
className
- String
+ String
''
A custom CSS class name to assign to the popup.
@@ -3821,7 +3835,7 @@ Options
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -3853,12 +3867,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -3884,12 +3898,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -3915,12 +3929,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -3952,31 +3966,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -4003,7 +4017,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -4011,43 +4025,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -4074,7 +4088,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -4082,43 +4096,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -4145,37 +4159,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -4183,61 +4197,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -4259,7 +4273,7 @@ Usage example
-L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map);
+L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
@@ -4296,7 +4310,7 @@ Extension methods
- L.tilelayer(<String> urlTemplate, <TileLayer options> options?)
+ L.tilelayer(<String> urlTemplate, <TileLayer options> options?)
Instantiates a tile layer object given a URL template and optionally an options object.
@@ -4322,55 +4336,55 @@ Options
minZoom
- Number
+ Number
0
The minimum zoom level down to which this layer will be displayed (inclusive).
maxZoom
- Number
+ Number
18
The maximum zoom level up to which this layer will be displayed (inclusive).
subdomains
- String|String[]
+ String|String[]
'abc'
Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
errorTileUrl
- String
+ String
''
URL to the tile image to show in place of the tile that failed to load.
zoomOffset
- Number
+ Number
0
The zoom number used in tile URLs will be offset with this value.
tms
- Boolean
+ Boolean
false
If true, inverses Y axis numbering for tiles (turn this on for TMS services).
zoomReverse
- Boolean
+ Boolean
false
If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
detectRetina
- Boolean
+ Boolean
false
If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
crossOrigin
- Boolean|String
+ Boolean|String
false
Whether the crossOrigin attribute will be added to the tiles.
If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
@@ -4399,19 +4413,19 @@ Options
tileSize
- Number|Point
+ Number|Point
256
Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
opacity
- Number
+ Number
1.0
Opacity of the tiles. Can be used in the createTile() function.
updateWhenIdle
- Boolean
+ Boolean
(depends)
Load new tiles only when panning ends.
true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
@@ -4420,31 +4434,31 @@ Options
updateWhenZooming
- Boolean
+ Boolean
true
By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
updateInterval
- Number
+ Number
200
Tiles will not update more than once every updateInterval milliseconds when panning.
zIndex
- Number
+ Number
1
The explicit zIndex of the tile layer.
bounds
- LatLngBounds
+ LatLngBounds
undefined
If set, tiles will only be loaded inside the set LatLngBounds.
maxNativeZoom
- Number
+ Number
undefined
Maximum zoom number the tile source has available. If it is specified,
the tiles on all zoom levels higher than maxNativeZoom will be loaded
@@ -4452,7 +4466,7 @@ Options
minNativeZoom
- Number
+ Number
undefined
Minimum zoom number the tile source has available. If it is specified,
the tiles on all zoom levels lower than minNativeZoom will be loaded
@@ -4460,7 +4474,7 @@ Options
noWrap
- Boolean
+ Boolean
false
Whether the layer is wrapped around the antimeridian. If true, the
GridLayer will only be displayed once at low zoom levels. Has no
@@ -4470,19 +4484,19 @@ Options
pane
- String
+ String
'tilePane'
Map pane where the grid layer will be added.
className
- String
+ String
''
A custom class name to assign to the tile layer. Empty by default.
keepBuffer
- Number
+ Number
2
When panning the map, keep this many rows and columns of tiles before unloading them.
@@ -4510,7 +4524,7 @@ Options
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -4542,32 +4556,32 @@ Events
- loading
+ loading
Event
Fired when the grid layer starts loading tiles.
- tileunload
+ tileunload
TileEvent
Fired when a tile is removed (e.g. when a tile goes off the screen).
- tileloadstart
+ tileloadstart
TileEvent
Fired when a tile is requested and starts loading.
- tileerror
+ tileerror
TileErrorEvent
Fired when there is an error loading a tile.
- tileload
+ tileload
TileEvent
Fired when a tile loads.
- load
+ load
Event
Fired when the grid layer loaded all visible tiles.
@@ -4593,12 +4607,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -4624,12 +4638,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -4655,12 +4669,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -4686,7 +4700,7 @@ Methods
- setUrl(<String> url, <Boolean> noRedraw?)
+ setUrl(<String> url, <Boolean> noRedraw?)
this
Updates the layer's URL template and redraws it (unless noRedraw is set to true).
If the URL does not change, the layer will not be redrawn unless
@@ -4694,7 +4708,7 @@
Methods
- createTile(<Object> coords, <Function> done?)
+ createTile(<Object> coords, <Function> done?)
HTMLElement
Called only internally, overrides GridLayer's createTile()
to return an <img> HTML element with the appropriate image URL given coords. The done
@@ -4717,7 +4731,7 @@
Extension methods
- getTileUrl(<Object> coords)
+ getTileUrl(<Object> coords)
String
Called only internally, returns the URL for a tile given its coordinates.
Classes extending TileLayer can override this function to provide custom tile URL naming schemes.
@@ -4744,49 +4758,49 @@ Extension methods
- bringToFront()
+ bringToFront()
this
Brings the tile layer to the top of all tile layers.
- bringToBack()
+ bringToBack()
this
Brings the tile layer to the bottom of all tile layers.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTML element that contains the tiles for this layer.
- setOpacity(<Number> opacity)
+ setOpacity(<Number> opacity)
this
Changes the opacity of the grid layer.
- setZIndex(<Number> zIndex)
+ setZIndex(<Number> zIndex)
this
Changes the zIndex of the grid layer.
- isLoading()
+ isLoading()
Boolean
Returns true if any tile in the grid layer has not finished loading.
- redraw()
+ redraw()
this
Causes the layer to clear all the tiles and request them again.
- getTileSize()
+ getTileSize()
Point
Normalizes the tileSize option into a point. Used by the createTile() method.
@@ -4813,31 +4827,31 @@ Extension methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -4864,7 +4878,7 @@ Extension methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -4872,43 +4886,43 @@
Extension methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -4935,7 +4949,7 @@ Extension methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -4943,43 +4957,43 @@
Extension methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -5006,37 +5020,37 @@ Extension methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -5044,61 +5058,61 @@
Extension methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -5148,7 +5162,7 @@ Creation
- L.tileLayer.wms(<String> baseUrl, <TileLayer.WMS options> options)
+ L.tileLayer.wms(<String> baseUrl, <TileLayer.WMS options> options)
Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.
@@ -5177,44 +5191,44 @@ Options
layers
- String
+ String
''
(required) Comma-separated list of WMS layers to show.
styles
- String
+ String
''
Comma-separated list of WMS styles.
format
- String
+ String
'image/jpeg'
WMS image format (use 'image/png' for layers with transparency).
transparent
- Boolean
+ Boolean
false
If true, the WMS service will return images with transparency.
version
- String
+ String
'1.1.1'
Version of the WMS service to use
crs
- CRS
+ CRS
null
Coordinate Reference System to use for the WMS requests, defaults to
map CRS. Don't change this if you're not sure what it means.
uppercase
- Boolean
+ Boolean
false
If true, WMS request parameter keys will be uppercase.
@@ -5241,55 +5255,55 @@ Options
minZoom
- Number
+ Number
0
The minimum zoom level down to which this layer will be displayed (inclusive).
maxZoom
- Number
+ Number
18
The maximum zoom level up to which this layer will be displayed (inclusive).
subdomains
- String|String[]
+ String|String[]
'abc'
Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
errorTileUrl
- String
+ String
''
URL to the tile image to show in place of the tile that failed to load.
zoomOffset
- Number
+ Number
0
The zoom number used in tile URLs will be offset with this value.
tms
- Boolean
+ Boolean
false
If true, inverses Y axis numbering for tiles (turn this on for TMS services).
zoomReverse
- Boolean
+ Boolean
false
If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
detectRetina
- Boolean
+ Boolean
false
If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
crossOrigin
- Boolean|String
+ Boolean|String
false
Whether the crossOrigin attribute will be added to the tiles.
If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
@@ -5319,19 +5333,19 @@ Options
tileSize
- Number|Point
+ Number|Point
256
Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
opacity
- Number
+ Number
1.0
Opacity of the tiles. Can be used in the createTile() function.
updateWhenIdle
- Boolean
+ Boolean
(depends)
Load new tiles only when panning ends.
true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
@@ -5340,31 +5354,31 @@ Options
updateWhenZooming
- Boolean
+ Boolean
true
By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
updateInterval
- Number
+ Number
200
Tiles will not update more than once every updateInterval milliseconds when panning.
zIndex
- Number
+ Number
1
The explicit zIndex of the tile layer.
bounds
- LatLngBounds
+ LatLngBounds
undefined
If set, tiles will only be loaded inside the set LatLngBounds.
maxNativeZoom
- Number
+ Number
undefined
Maximum zoom number the tile source has available. If it is specified,
the tiles on all zoom levels higher than maxNativeZoom will be loaded
@@ -5372,7 +5386,7 @@ Options
minNativeZoom
- Number
+ Number
undefined
Minimum zoom number the tile source has available. If it is specified,
the tiles on all zoom levels lower than minNativeZoom will be loaded
@@ -5380,7 +5394,7 @@ Options
noWrap
- Boolean
+ Boolean
false
Whether the layer is wrapped around the antimeridian. If true, the
GridLayer will only be displayed once at low zoom levels. Has no
@@ -5390,19 +5404,19 @@ Options
pane
- String
+ String
'tilePane'
Map pane where the grid layer will be added.
className
- String
+ String
''
A custom class name to assign to the tile layer. Empty by default.
keepBuffer
- Number
+ Number
2
When panning the map, keep this many rows and columns of tiles before unloading them.
@@ -5430,7 +5444,7 @@ Options
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -5462,32 +5476,32 @@ Events
- loading
+ loading
Event
Fired when the grid layer starts loading tiles.
- tileunload
+ tileunload
TileEvent
Fired when a tile is removed (e.g. when a tile goes off the screen).
- tileloadstart
+ tileloadstart
TileEvent
Fired when a tile is requested and starts loading.
- tileerror
+ tileerror
TileErrorEvent
Fired when there is an error loading a tile.
- tileload
+ tileload
TileEvent
Fired when a tile loads.
- load
+ load
Event
Fired when the grid layer loaded all visible tiles.
@@ -5513,12 +5527,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -5544,12 +5558,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -5575,12 +5589,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -5606,7 +5620,7 @@ Methods
- setParams(<Object> params, <Boolean> noRedraw?)
+ setParams(<Object> params, <Boolean> noRedraw?)
this
Merges an object with the new parameters and re-requests tiles on the current screen (unless noRedraw was set to true).
@@ -5632,7 +5646,7 @@ Methods
- setUrl(<String> url, <Boolean> noRedraw?)
+ setUrl(<String> url, <Boolean> noRedraw?)
this
Updates the layer's URL template and redraws it (unless noRedraw is set to true).
If the URL does not change, the layer will not be redrawn unless
@@ -5640,7 +5654,7 @@
Methods
- createTile(<Object> coords, <Function> done?)
+ createTile(<Object> coords, <Function> done?)
HTMLElement
Called only internally, overrides GridLayer's createTile()
to return an <img> HTML element with the appropriate image URL given coords. The done
@@ -5669,49 +5683,49 @@
Methods
- bringToFront()
+ bringToFront()
this
Brings the tile layer to the top of all tile layers.
- bringToBack()
+ bringToBack()
this
Brings the tile layer to the bottom of all tile layers.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTML element that contains the tiles for this layer.
- setOpacity(<Number> opacity)
+ setOpacity(<Number> opacity)
this
Changes the opacity of the grid layer.
- setZIndex(<Number> zIndex)
+ setZIndex(<Number> zIndex)
this
Changes the zIndex of the grid layer.
- isLoading()
+ isLoading()
Boolean
Returns true if any tile in the grid layer has not finished loading.
- redraw()
+ redraw()
this
Causes the layer to clear all the tiles and request them again.
- getTileSize()
+ getTileSize()
Point
Normalizes the tileSize option into a point. Used by the createTile() method.
@@ -5738,31 +5752,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -5789,7 +5803,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -5797,43 +5811,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -5860,7 +5874,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -5868,43 +5882,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -5931,37 +5945,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -5969,61 +5983,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -6070,7 +6084,7 @@ Creation
- L.imageOverlay(<String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options?)
+ L.imageOverlay(<String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options?)
Instantiates an image overlay object given the URL of the image and the
geographical bounds it is tied to.
@@ -6097,25 +6111,25 @@ Options
opacity
- Number
+ Number
1.0
The opacity of the image overlay.
alt
- String
+ String
''
Text for the alt attribute of the image (useful for accessibility).
interactive
- Boolean
+ Boolean
false
If true, the image overlay will emit mouse events when clicked or hovered.
crossOrigin
- Boolean|String
+ Boolean|String
false
Whether the crossOrigin attribute will be added to the image.
If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
@@ -6123,19 +6137,19 @@ Options
errorOverlayUrl
- String
+ String
''
URL to the overlay image to show in place of the overlay that failed to load.
zIndex
- Number
+ Number
1
The explicit zIndex of the overlay layer.
className
- String
+ String
''
A custom class name to assign to the image. Empty by default.
@@ -6162,7 +6176,7 @@ Options
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this layer will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
@@ -6191,13 +6205,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -6223,12 +6237,12 @@ Events
- load
+ load
Event
Fired when the ImageOverlay layer has loaded its image
- error
+ error
Event
Fired when the ImageOverlay layer fails to load its image
@@ -6253,37 +6267,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -6312,12 +6326,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -6343,12 +6357,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -6374,12 +6388,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -6405,49 +6419,49 @@ Methods
- setOpacity(<Number> opacity)
+ setOpacity(<Number> opacity)
this
Sets the opacity of the overlay.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all overlays.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all overlays.
- setUrl(<String> url)
+ setUrl(<String> url)
this
Changes the URL of the image.
- setBounds(<LatLngBounds> bounds)
+ setBounds(<LatLngBounds> bounds)
this
Update the bounds that this ImageOverlay covers
- setZIndex(<Number> value)
+ setZIndex(<Number> value)
this
Changes the zIndex of the image overlay.
- getBounds()
+ getBounds()
LatLngBounds
Get the bounds that this ImageOverlay covers
- getElement()
+ getElement()
HTMLElement
Returns the instance of HTMLImageElement
used by this overlay.
@@ -6474,31 +6488,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -6525,7 +6539,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -6533,43 +6547,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -6596,7 +6610,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -6604,43 +6618,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -6667,37 +6681,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -6705,61 +6719,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -6808,7 +6822,7 @@ Creation
- L.videoOverlay(<String|Array|HTMLVideoElement> video, <LatLngBounds> bounds, <VideoOverlay options> options?)
+ L.videoOverlay(<String|Array|HTMLVideoElement> video, <LatLngBounds> bounds, <VideoOverlay options> options?)
Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
geographical bounds it is tied to.
@@ -6835,19 +6849,19 @@ Options
autoplay
- Boolean
+ Boolean
true
Whether the video starts playing automatically when loaded.
loop
- Boolean
+ Boolean
true
Whether the video will loop back to the beginning when played.
keepAspectRatio
- Boolean
+ Boolean
true
Whether the video will save aspect ratio after the projection.
Relevant for supported browsers. Browser compatibility- https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
@@ -6875,25 +6889,25 @@ Options
opacity
- Number
+ Number
1.0
The opacity of the image overlay.
alt
- String
+ String
''
Text for the alt attribute of the image (useful for accessibility).
interactive
- Boolean
+ Boolean
false
If true, the image overlay will emit mouse events when clicked or hovered.
crossOrigin
- Boolean|String
+ Boolean|String
false
Whether the crossOrigin attribute will be added to the image.
If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
@@ -6901,19 +6915,19 @@ Options
errorOverlayUrl
- String
+ String
''
URL to the overlay image to show in place of the overlay that failed to load.
zIndex
- Number
+ Number
1
The explicit zIndex of the overlay layer.
className
- String
+ String
''
A custom class name to assign to the image. Empty by default.
@@ -6941,7 +6955,7 @@ Options
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this layer will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
@@ -6970,13 +6984,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -7002,7 +7016,7 @@ Events
- load
+ load
Event
Fired when the video has finished loading the first frame
@@ -7027,7 +7041,7 @@ Events
- error
+ error
Event
Fired when the ImageOverlay layer fails to load its image
@@ -7053,37 +7067,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -7112,12 +7126,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -7143,12 +7157,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -7174,12 +7188,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -7205,7 +7219,7 @@ Methods
- getElement()
+ getElement()
HTMLVideoElement
Returns the instance of HTMLVideoElement
used by this overlay.
@@ -7232,43 +7246,43 @@ Methods
- setOpacity(<Number> opacity)
+ setOpacity(<Number> opacity)
this
Sets the opacity of the overlay.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all overlays.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all overlays.
- setUrl(<String> url)
+ setUrl(<String> url)
this
Changes the URL of the image.
- setBounds(<LatLngBounds> bounds)
+ setBounds(<LatLngBounds> bounds)
this
Update the bounds that this ImageOverlay covers
- setZIndex(<Number> value)
+ setZIndex(<Number> value)
this
Changes the zIndex of the image overlay.
- getBounds()
+ getBounds()
LatLngBounds
Get the bounds that this ImageOverlay covers
@@ -7295,31 +7309,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -7346,7 +7360,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -7354,43 +7368,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -7417,7 +7431,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -7425,43 +7439,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -7488,37 +7502,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -7526,61 +7540,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -7631,7 +7645,7 @@ Creation
- L.svgOverlay(<String|SVGElement> svg, <LatLngBounds> bounds, <SVGOverlay options> options?)
+ L.svgOverlay(<String|SVGElement> svg, <LatLngBounds> bounds, <SVGOverlay options> options?)
Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to.
A viewBox attribute is required on the SVG element to zoom in and out properly.
@@ -7664,25 +7678,25 @@ Options
opacity
- Number
+ Number
1.0
The opacity of the image overlay.
alt
- String
+ String
''
Text for the alt attribute of the image (useful for accessibility).
interactive
- Boolean
+ Boolean
false
If true, the image overlay will emit mouse events when clicked or hovered.
crossOrigin
- Boolean|String
+ Boolean|String
false
Whether the crossOrigin attribute will be added to the image.
If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
@@ -7690,19 +7704,19 @@ Options
errorOverlayUrl
- String
+ String
''
URL to the overlay image to show in place of the overlay that failed to load.
zIndex
- Number
+ Number
1
The explicit zIndex of the overlay layer.
className
- String
+ String
''
A custom class name to assign to the image. Empty by default.
@@ -7730,7 +7744,7 @@ Options
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this layer will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
@@ -7759,13 +7773,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -7797,12 +7811,12 @@ Events
- load
+ load
Event
Fired when the ImageOverlay layer has loaded its image
- error
+ error
Event
Fired when the ImageOverlay layer fails to load its image
@@ -7828,37 +7842,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -7887,12 +7901,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -7918,12 +7932,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -7949,12 +7963,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -7980,7 +7994,7 @@ Methods
- getElement()
+ getElement()
SVGElement
Returns the instance of SVGElement
used by this overlay.
@@ -8007,43 +8021,43 @@ Methods
- setOpacity(<Number> opacity)
+ setOpacity(<Number> opacity)
this
Sets the opacity of the overlay.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all overlays.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all overlays.
- setUrl(<String> url)
+ setUrl(<String> url)
this
Changes the URL of the image.
- setBounds(<LatLngBounds> bounds)
+ setBounds(<LatLngBounds> bounds)
this
Update the bounds that this ImageOverlay covers
- setZIndex(<Number> value)
+ setZIndex(<Number> value)
this
Changes the zIndex of the image overlay.
- getBounds()
+ getBounds()
LatLngBounds
Get the bounds that this ImageOverlay covers
@@ -8070,31 +8084,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -8121,7 +8135,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -8129,43 +8143,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -8192,7 +8206,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -8200,43 +8214,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -8263,37 +8277,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -8301,61 +8315,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -8387,93 +8401,93 @@ Options
stroke
- Boolean
+ Boolean
true
Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
color
- String
+ String
'#3388ff'
Stroke color
weight
- Number
+ Number
3
Stroke width in pixels
opacity
- Number
+ Number
1.0
Stroke opacity
lineCap
- String
+ String
'round'
A string that defines shape to be used at the end of the stroke.
lineJoin
- String
+ String
'round'
A string that defines shape to be used at the corners of the stroke.
dashArray
- String
+ String
null
A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
dashOffset
- String
+ String
null
A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
fill
- Boolean
+ Boolean
depends
Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
fillColor
- String
+ String
*
Fill color. Defaults to the value of the color option
fillOpacity
- Number
+ Number
0.2
Fill opacity.
fillRule
- String
+ String
'evenodd'
A string that defines how the inside of a shape is determined.
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this path will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
renderer
- Renderer
+ Renderer
Use this specific instance of Renderer for this path. Takes
precedence over the map's default renderer.
className
- String
+ String
null
Custom class name set on an element. Only for SVG renderer.
@@ -8500,7 +8514,7 @@ Options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
@@ -8528,13 +8542,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -8566,37 +8580,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -8625,12 +8639,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -8656,12 +8670,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -8687,12 +8701,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -8718,25 +8732,25 @@ Methods
- redraw()
+ redraw()
this
Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
- setStyle(<Path options> style)
+ setStyle(<Path options> style)
this
Changes the appearance of a Path based on the options in the Path options object.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all path layers.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all path layers.
@@ -8762,31 +8776,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -8813,7 +8827,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -8821,43 +8835,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -8884,7 +8898,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -8892,43 +8906,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -8955,37 +8969,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -8993,61 +9007,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -9111,7 +9125,7 @@ Creation
- L.polyline(<LatLng[]> latlngs, <Polyline options> options?)
+ L.polyline(<LatLng[]> latlngs, <Polyline options> options?)
Instantiates a polyline object given an array of geographical points and
optionally an options object. You can create a Polyline object with
multiple separate lines (MultiPolyline) by passing an array of arrays
@@ -9140,14 +9154,14 @@ Options
smoothFactor
- Number
+ Number
1.0
How much to simplify the polyline on each zoom level. More means
better performance and smoother look, and less means more accurate representation.
noClip
- Boolean
+ Boolean
false
Disable polyline clipping.
@@ -9174,93 +9188,93 @@ Options
stroke
- Boolean
+ Boolean
true
Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
color
- String
+ String
'#3388ff'
Stroke color
weight
- Number
+ Number
3
Stroke width in pixels
opacity
- Number
+ Number
1.0
Stroke opacity
lineCap
- String
+ String
'round'
A string that defines shape to be used at the end of the stroke.
lineJoin
- String
+ String
'round'
A string that defines shape to be used at the corners of the stroke.
dashArray
- String
+ String
null
A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
dashOffset
- String
+ String
null
A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
fill
- Boolean
+ Boolean
depends
Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
fillColor
- String
+ String
*
Fill color. Defaults to the value of the color option
fillOpacity
- Number
+ Number
0.2
Fill opacity.
fillRule
- String
+ String
'evenodd'
A string that defines how the inside of a shape is determined.
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this path will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
renderer
- Renderer
+ Renderer
Use this specific instance of Renderer for this path. Takes
precedence over the map's default renderer.
className
- String
+ String
null
Custom class name set on an element. Only for SVG renderer.
@@ -9288,7 +9302,7 @@ Options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
@@ -9316,13 +9330,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -9354,37 +9368,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -9413,12 +9427,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -9444,12 +9458,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -9475,12 +9489,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -9506,7 +9520,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -9514,43 +9528,43 @@
Methods
- getLatLngs()
+ getLatLngs()
LatLng[]
Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
- setLatLngs(<LatLng[]> latlngs)
+ setLatLngs(<LatLng[]> latlngs)
this
Replaces all the points in the polyline with the given array of geographical points.
- isEmpty()
+ isEmpty()
Boolean
Returns true if the Polyline has no LatLngs.
- closestLayerPoint(<Point> p)
+ closestLayerPoint(<Point> p)
Point
Returns the point closest to p on the Polyline.
- getCenter()
+ getCenter()
LatLng
Returns the center (centroid) of the polyline.
- getBounds()
+ getBounds()
LatLngBounds
Returns the LatLngBounds of the path.
- addLatLng(<LatLng> latlng)
+ addLatLng(<LatLng> latlng)
this
Adds a given point to the polyline. By default, adds to the first ring of
the polyline in case of a multi-polyline, but can be overridden by passing
@@ -9578,25 +9592,25 @@
Methods
- redraw()
+ redraw()
this
Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
- setStyle(<Path options> style)
+ setStyle(<Path options> style)
this
Changes the appearance of a Path based on the options in the Path options object.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all path layers.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all path layers.
@@ -9623,31 +9637,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -9674,7 +9688,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -9682,43 +9696,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -9745,7 +9759,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -9753,43 +9767,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -9816,37 +9830,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -9854,61 +9868,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -9975,7 +9989,7 @@ Creation
- L.polygon(<LatLng[]> latlngs, <Polyline options> options?)
+ L.polygon(<LatLng[]> latlngs, <Polyline options> options?)
@@ -10007,14 +10021,14 @@ Options
smoothFactor
- Number
+ Number
1.0
How much to simplify the polyline on each zoom level. More means
better performance and smoother look, and less means more accurate representation.
noClip
- Boolean
+ Boolean
false
Disable polyline clipping.
@@ -10042,93 +10056,93 @@ Options
stroke
- Boolean
+ Boolean
true
Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
color
- String
+ String
'#3388ff'
Stroke color
weight
- Number
+ Number
3
Stroke width in pixels
opacity
- Number
+ Number
1.0
Stroke opacity
lineCap
- String
+ String
'round'
A string that defines shape to be used at the end of the stroke.
lineJoin
- String
+ String
'round'
A string that defines shape to be used at the corners of the stroke.
dashArray
- String
+ String
null
A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
dashOffset
- String
+ String
null
A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
fill
- Boolean
+ Boolean
depends
Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
fillColor
- String
+ String
*
Fill color. Defaults to the value of the color option
fillOpacity
- Number
+ Number
0.2
Fill opacity.
fillRule
- String
+ String
'evenodd'
A string that defines how the inside of a shape is determined.
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this path will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
renderer
- Renderer
+ Renderer
Use this specific instance of Renderer for this path. Takes
precedence over the map's default renderer.
className
- String
+ String
null
Custom class name set on an element. Only for SVG renderer.
@@ -10156,7 +10170,7 @@ Options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
@@ -10184,13 +10198,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -10222,37 +10236,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -10281,12 +10295,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -10312,12 +10326,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -10343,12 +10357,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -10374,7 +10388,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -10402,43 +10416,43 @@
Methods
- getLatLngs()
+ getLatLngs()
LatLng[]
Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
- setLatLngs(<LatLng[]> latlngs)
+ setLatLngs(<LatLng[]> latlngs)
this
Replaces all the points in the polyline with the given array of geographical points.
- isEmpty()
+ isEmpty()
Boolean
Returns true if the Polyline has no LatLngs.
- closestLayerPoint(<Point> p)
+ closestLayerPoint(<Point> p)
Point
Returns the point closest to p on the Polyline.
- getCenter()
+ getCenter()
LatLng
Returns the center (centroid) of the polyline.
- getBounds()
+ getBounds()
LatLngBounds
Returns the LatLngBounds of the path.
- addLatLng(<LatLng> latlng)
+ addLatLng(<LatLng> latlng)
this
Adds a given point to the polyline. By default, adds to the first ring of
the polyline in case of a multi-polyline, but can be overridden by passing
@@ -10467,25 +10481,25 @@
Methods
- redraw()
+ redraw()
this
Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
- setStyle(<Path options> style)
+ setStyle(<Path options> style)
this
Changes the appearance of a Path based on the options in the Path options object.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all path layers.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all path layers.
@@ -10512,31 +10526,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -10563,7 +10577,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -10571,43 +10585,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -10634,7 +10648,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -10642,43 +10656,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -10705,37 +10719,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -10743,61 +10757,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -10847,7 +10861,7 @@ Creation
- L.rectangle(<LatLngBounds> latLngBounds, <Polyline options> options?)
+ L.rectangle(<LatLngBounds> latLngBounds, <Polyline options> options?)
@@ -10879,14 +10893,14 @@ Options
smoothFactor
- Number
+ Number
1.0
How much to simplify the polyline on each zoom level. More means
better performance and smoother look, and less means more accurate representation.
noClip
- Boolean
+ Boolean
false
Disable polyline clipping.
@@ -10914,93 +10928,93 @@ Options
stroke
- Boolean
+ Boolean
true
Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
color
- String
+ String
'#3388ff'
Stroke color
weight
- Number
+ Number
3
Stroke width in pixels
opacity
- Number
+ Number
1.0
Stroke opacity
lineCap
- String
+ String
'round'
A string that defines shape to be used at the end of the stroke.
lineJoin
- String
+ String
'round'
A string that defines shape to be used at the corners of the stroke.
dashArray
- String
+ String
null
A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
dashOffset
- String
+ String
null
A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
fill
- Boolean
+ Boolean
depends
Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
fillColor
- String
+ String
*
Fill color. Defaults to the value of the color option
fillOpacity
- Number
+ Number
0.2
Fill opacity.
fillRule
- String
+ String
'evenodd'
A string that defines how the inside of a shape is determined.
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this path will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
renderer
- Renderer
+ Renderer
Use this specific instance of Renderer for this path. Takes
precedence over the map's default renderer.
className
- String
+ String
null
Custom class name set on an element. Only for SVG renderer.
@@ -11028,7 +11042,7 @@ Options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
@@ -11056,13 +11070,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -11094,37 +11108,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -11153,12 +11167,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -11184,12 +11198,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -11215,12 +11229,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -11246,7 +11260,7 @@ Methods
- setBounds(<LatLngBounds> latLngBounds)
+ setBounds(<LatLngBounds> latLngBounds)
this
Redraws the rectangle with the passed bounds.
@@ -11272,7 +11286,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -11301,43 +11315,43 @@
Methods
- getLatLngs()
+ getLatLngs()
LatLng[]
Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
- setLatLngs(<LatLng[]> latlngs)
+ setLatLngs(<LatLng[]> latlngs)
this
Replaces all the points in the polyline with the given array of geographical points.
- isEmpty()
+ isEmpty()
Boolean
Returns true if the Polyline has no LatLngs.
- closestLayerPoint(<Point> p)
+ closestLayerPoint(<Point> p)
Point
Returns the point closest to p on the Polyline.
- getCenter()
+ getCenter()
LatLng
Returns the center (centroid) of the polyline.
- getBounds()
+ getBounds()
LatLngBounds
Returns the LatLngBounds of the path.
- addLatLng(<LatLng> latlng)
+ addLatLng(<LatLng> latlng)
this
Adds a given point to the polyline. By default, adds to the first ring of
the polyline in case of a multi-polyline, but can be overridden by passing
@@ -11366,25 +11380,25 @@
Methods
- redraw()
+ redraw()
this
Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
- setStyle(<Path options> style)
+ setStyle(<Path options> style)
this
Changes the appearance of a Path based on the options in the Path options object.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all path layers.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all path layers.
@@ -11411,31 +11425,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -11462,7 +11476,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -11470,43 +11484,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -11533,7 +11547,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -11541,43 +11555,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -11604,37 +11618,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -11642,61 +11656,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -11742,12 +11756,12 @@ Creation
- L.circle(<LatLng> latlng, <Circle options> options?)
+ L.circle(<LatLng> latlng, <Circle options> options?)
Instantiates a circle object given a geographical point, and an options object
which contains the circle radius.
- L.circle(<LatLng> latlng, <Number> radius, <Circle options> options?)
+ L.circle(<LatLng> latlng, <Number> radius, <Circle options> options?)
Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
Do not use in new applications or plugins.
@@ -11774,7 +11788,7 @@ Options
radius
- Number
+ Number
Radius of the circle, in meters.
@@ -11801,93 +11815,93 @@ Options
stroke
- Boolean
+ Boolean
true
Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
color
- String
+ String
'#3388ff'
Stroke color
weight
- Number
+ Number
3
Stroke width in pixels
opacity
- Number
+ Number
1.0
Stroke opacity
lineCap
- String
+ String
'round'
A string that defines shape to be used at the end of the stroke.
lineJoin
- String
+ String
'round'
A string that defines shape to be used at the corners of the stroke.
dashArray
- String
+ String
null
A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
dashOffset
- String
+ String
null
A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
fill
- Boolean
+ Boolean
depends
Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
fillColor
- String
+ String
*
Fill color. Defaults to the value of the color option
fillOpacity
- Number
+ Number
0.2
Fill opacity.
fillRule
- String
+ String
'evenodd'
A string that defines how the inside of a shape is determined.
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this path will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
renderer
- Renderer
+ Renderer
Use this specific instance of Renderer for this path. Takes
precedence over the map's default renderer.
className
- String
+ String
null
Custom class name set on an element. Only for SVG renderer.
@@ -11915,7 +11929,7 @@ Options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
@@ -11943,13 +11957,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -11965,6 +11979,32 @@ Events
+
+
+
+
+
@@ -11981,37 +12021,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -12040,12 +12080,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -12071,12 +12111,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -12102,12 +12142,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -12133,19 +12173,19 @@ Methods
- setRadius(<Number> radius)
+ setRadius(<Number> radius)
this
Sets the radius of a circle. Units are in meters.
- getRadius()
+ getRadius()
Number
Returns the current radius of a circle. Units are in meters.
- getBounds()
+ getBounds()
LatLngBounds
Returns the LatLngBounds of the path.
@@ -12171,7 +12211,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -12179,13 +12219,13 @@
Methods
- setLatLng(<LatLng> latLng)
+ setLatLng(<LatLng> latLng)
this
Sets the position of a circle marker to a new location.
- getLatLng()
+ getLatLng()
LatLng
Returns the current geographical position of the circle marker
@@ -12212,25 +12252,25 @@ Methods
- redraw()
+ redraw()
this
Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
- setStyle(<Path options> style)
+ setStyle(<Path options> style)
this
Changes the appearance of a Path based on the options in the Path options object.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all path layers.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all path layers.
@@ -12257,31 +12297,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -12308,7 +12348,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -12316,43 +12356,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -12379,7 +12419,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -12387,43 +12427,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -12450,37 +12490,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -12488,61 +12528,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -12570,7 +12610,7 @@ Creation
- L.circleMarker(<LatLng> latlng, <CircleMarker options> options?)
+ L.circleMarker(<LatLng> latlng, <CircleMarker options> options?)
Instantiates a circle marker object given a geographical point, and an optional options object.
@@ -12596,7 +12636,7 @@ Options
radius
- Number
+ Number
10
Radius of the circle marker, in pixels
@@ -12623,93 +12663,93 @@ Options
stroke
- Boolean
+ Boolean
true
Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
color
- String
+ String
'#3388ff'
Stroke color
weight
- Number
+ Number
3
Stroke width in pixels
opacity
- Number
+ Number
1.0
Stroke opacity
lineCap
- String
+ String
'round'
A string that defines shape to be used at the end of the stroke.
lineJoin
- String
+ String
'round'
A string that defines shape to be used at the corners of the stroke.
dashArray
- String
+ String
null
A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
dashOffset
- String
+ String
null
A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
fill
- Boolean
+ Boolean
depends
Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
fillColor
- String
+ String
*
Fill color. Defaults to the value of the color option
fillOpacity
- Number
+ Number
0.2
Fill opacity.
fillRule
- String
+ String
'evenodd'
A string that defines how the inside of a shape is determined.
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this path will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
renderer
- Renderer
+ Renderer
Use this specific instance of Renderer for this path. Takes
precedence over the map's default renderer.
className
- String
+ String
null
Custom class name set on an element. Only for SVG renderer.
@@ -12737,7 +12777,7 @@ Options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
@@ -12765,13 +12805,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -12782,11 +12822,30 @@ Options
-Events
+Events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ move
+ Event
+ Fired when the marker is moved via setLatLng. Old and new coordinates are included in event arguments as oldLatLng, latlng.
+
+
+
+
+
+
@@ -12803,37 +12862,37 @@ Events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -12862,12 +12921,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -12893,12 +12952,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -12924,12 +12983,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -12955,7 +13014,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -12963,25 +13022,25 @@
Methods
- setLatLng(<LatLng> latLng)
+ setLatLng(<LatLng> latLng)
this
Sets the position of a circle marker to a new location.
- getLatLng()
+ getLatLng()
LatLng
Returns the current geographical position of the circle marker
- setRadius(<Number> radius)
+ setRadius(<Number> radius)
this
Sets the radius of a circle marker. Units are in pixels.
- getRadius()
+ getRadius()
Number
Returns the current radius of the circle
@@ -13007,25 +13066,25 @@ Methods
- redraw()
+ redraw()
this
Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
- setStyle(<Path options> style)
+ setStyle(<Path options> style)
this
Changes the appearance of a Path based on the options in the Path options object.
- bringToFront()
+ bringToFront()
this
Brings the layer to the top of all path layers.
- bringToBack()
+ bringToBack()
this
Brings the layer to the bottom of all path layers.
@@ -13052,31 +13111,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -13103,7 +13162,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -13111,43 +13170,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -13174,7 +13233,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -13182,43 +13241,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -13245,37 +13304,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -13283,61 +13342,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -13400,7 +13459,7 @@ Creation
- L.svg(<Renderer options> options?)
+ L.svg(<Renderer options> options?)
Creates a SVG renderer with the given options.
@@ -13432,14 +13491,14 @@ Options
padding
- Number
+ Number
0.1
How much to extend the clip area around the map view (relative to its size)
e.g. 0.1 would be 10% of map view in each direction
tolerance
- Number
+ Number
0
How much to extend click tolerance round a path/object on the map
@@ -13467,13 +13526,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -13505,7 +13564,7 @@ Events
- update
+ update
Event
Fired when the renderer updates its bounds, center and zoom, for example when
its map has moved
@@ -13532,12 +13591,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -13563,12 +13622,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -13594,12 +13653,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -13631,31 +13690,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -13682,7 +13741,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -13690,43 +13749,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -13753,7 +13812,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -13761,43 +13820,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -13824,37 +13883,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -13862,61 +13921,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -13944,14 +14003,14 @@ Functions
- create(<String> name)
+ create(<String> name)
SVGElement
Returns a instance of SVGElement,
corresponding to the class name passed. For example, using 'line' will return
an instance of SVGLineElement.
- pointsToPath(<Point[]> rings, <Boolean> closed)
+ pointsToPath(<Point[]> rings, <Boolean> closed)
String
Generates a SVG path string for multiple rings, with each ring turning
into "M..L..L.." instructions
@@ -14008,7 +14067,7 @@ Creation
- L.canvas(<Renderer options> options?)
+ L.canvas(<Renderer options> options?)
Creates a Canvas renderer with the given options.
@@ -14040,14 +14099,14 @@ Options
padding
- Number
+ Number
0.1
How much to extend the clip area around the map view (relative to its size)
e.g. 0.1 would be 10% of map view in each direction
tolerance
- Number
+ Number
0
How much to extend click tolerance round a path/object on the map
@@ -14075,13 +14134,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -14113,7 +14172,7 @@ Events
- update
+ update
Event
Fired when the renderer updates its bounds, center and zoom, for example when
its map has moved
@@ -14140,12 +14199,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -14171,12 +14230,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -14202,12 +14261,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -14239,31 +14298,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -14290,7 +14349,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -14298,43 +14357,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -14361,7 +14420,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -14369,43 +14428,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -14432,37 +14491,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -14470,61 +14529,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -14573,7 +14632,7 @@ Creation
- L.layerGroup(<Layer[]> layers?, <Object> options?)
+ L.layerGroup(<Layer[]> layers?, <Object> options?)
Create a layer group, optionally given an initial set of layers and an options object.
@@ -14605,13 +14664,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -14643,12 +14702,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -14674,12 +14733,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -14705,12 +14764,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -14736,7 +14795,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -14744,43 +14803,43 @@
Methods
- addLayer(<Layer> layer)
+ addLayer(<Layer> layer)
this
Adds the given layer to the group.
- removeLayer(<Layer> layer)
+ removeLayer(<Layer> layer)
this
Removes the given layer from the group.
- removeLayer(<Number> id)
+ removeLayer(<Number> id)
this
Removes the layer with the given internal ID from the group.
- hasLayer(<Layer> layer)
+ hasLayer(<Layer> layer)
Boolean
Returns true if the given layer is currently added to the group.
- hasLayer(<Number> id)
+ hasLayer(<Number> id)
Boolean
Returns true if the given internal ID is currently added to the group.
- clearLayers()
+ clearLayers()
this
Removes all the layers from the group.
- invoke(<String> methodName, …)
+ invoke(<String> methodName, …)
this
Calls methodName on every layer contained in this group, passing any
additional parameters. Has no effect if the layers contained do not
@@ -14788,7 +14847,7 @@
Methods
- eachLayer(<Function> fn, <Object> context?)
+ eachLayer(<Function> fn, <Object> context?)
this
Iterates over the layers of the group, optionally specifying context of the iterator function.
group.eachLayer(function (layer) {
@@ -14798,25 +14857,25 @@ Methods
- getLayer(<Number> id)
+ getLayer(<Number> id)
Layer
Returns the layer with the given internal ID.
- getLayers()
+ getLayers()
Layer[]
Returns an array of all the layers added to the group.
- setZIndex(<Number> zIndex)
+ setZIndex(<Number> zIndex)
this
Calls setZIndex on every layer contained in this group, passing the z-index.
- getLayerId(<Layer> layer)
+ getLayerId(<Layer> layer)
Number
Returns the internal ID for a layer
@@ -14842,31 +14901,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -14893,7 +14952,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -14901,43 +14960,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -14964,7 +15023,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -14972,43 +15031,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -15035,37 +15094,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -15073,61 +15132,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -15182,7 +15241,7 @@ Creation
- L.featureGroup(<Layer[]> layers)
+ L.featureGroup(<Layer[]> layers)
Create a feature group, optionally given an initial set of layers.
@@ -15214,13 +15273,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -15246,12 +15305,12 @@ Events
- layeradd
+ layeradd
LayerEvent
Fired when a layer is added to this FeatureGroup
- layerremove
+ layerremove
LayerEvent
Fired when a layer is removed from this FeatureGroup
@@ -15276,12 +15335,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -15307,12 +15366,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -15338,12 +15397,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -15369,25 +15428,25 @@ Methods
- setStyle(<Path options> style)
+ setStyle(<Path options> style)
this
Sets the given path options to each layer of the group that has a setStyle method.
- bringToFront()
+ bringToFront()
this
Brings the layer group to the top of all other layers
- bringToBack()
+ bringToBack()
this
Brings the layer group to the back of all other layers
- getBounds()
+ getBounds()
LatLngBounds
Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
@@ -15413,7 +15472,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -15421,43 +15480,43 @@
Methods
- addLayer(<Layer> layer)
+ addLayer(<Layer> layer)
this
Adds the given layer to the group.
- removeLayer(<Layer> layer)
+ removeLayer(<Layer> layer)
this
Removes the given layer from the group.
- removeLayer(<Number> id)
+ removeLayer(<Number> id)
this
Removes the layer with the given internal ID from the group.
- hasLayer(<Layer> layer)
+ hasLayer(<Layer> layer)
Boolean
Returns true if the given layer is currently added to the group.
- hasLayer(<Number> id)
+ hasLayer(<Number> id)
Boolean
Returns true if the given internal ID is currently added to the group.
- clearLayers()
+ clearLayers()
this
Removes all the layers from the group.
- invoke(<String> methodName, …)
+ invoke(<String> methodName, …)
this
Calls methodName on every layer contained in this group, passing any
additional parameters. Has no effect if the layers contained do not
@@ -15465,7 +15524,7 @@
Methods
- eachLayer(<Function> fn, <Object> context?)
+ eachLayer(<Function> fn, <Object> context?)
this
Iterates over the layers of the group, optionally specifying context of the iterator function.
group.eachLayer(function (layer) {
@@ -15475,25 +15534,25 @@ Methods
- getLayer(<Number> id)
+ getLayer(<Number> id)
Layer
Returns the layer with the given internal ID.
- getLayers()
+ getLayers()
Layer[]
Returns an array of all the layers added to the group.
- setZIndex(<Number> zIndex)
+ setZIndex(<Number> zIndex)
this
Calls setZIndex on every layer contained in this group, passing the z-index.
- getLayerId(<Layer> layer)
+ getLayerId(<Layer> layer)
Number
Returns the internal ID for a layer
@@ -15520,31 +15579,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -15571,7 +15630,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -15579,43 +15638,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -15642,7 +15701,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -15650,43 +15709,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -15713,37 +15772,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -15751,61 +15810,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -15857,7 +15916,7 @@ Creation
- L.geoJSON(<Object> geojson?, <GeoJSON options> options?)
+ L.geoJSON(<Object> geojson?, <GeoJSON options> options?)
Creates a GeoJSON layer. Optionally accepts an object in
GeoJSON format to display on the map
(you can alternatively add it later with addData method) and an options object.
@@ -15885,7 +15944,7 @@ Options
pointToLayer
- Function
+ Function
*
A Function defining how GeoJSON points spawn Leaflet layers. It is internally
called when data is added, passing the GeoJSON point feature and its LatLng.
@@ -15897,7 +15956,7 @@ Options
style
- Function
+ Function
*
A Function defining the Path options for styling GeoJSON lines and polygons,
called internally when data is added.
@@ -15909,7 +15968,7 @@ Options
onEachFeature
- Function
+ Function
*
A Function that will be called once for each created Feature, after it has
been created and styled. Useful for attaching events and popups to features.
@@ -15919,7 +15978,7 @@ Options
filter
- Function
+ Function
*
A Function that will be used to decide whether to include a feature or not.
The default is to include all features:
@@ -15932,11 +15991,17 @@ Options
coordsToLatLng
- Function
+ Function
*
A Function that will be used for converting GeoJSON coordinates to LatLngs.
The default is the coordsToLatLng static method.
+
+ markersInheritOptions
+ Boolean
+ false
+ Whether default Markers for "Point" type Features inherit from group options.
+
@@ -15960,13 +16025,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -15998,12 +16063,12 @@ Events
- layeradd
+ layeradd
LayerEvent
Fired when a layer is added to this FeatureGroup
- layerremove
+ layerremove
LayerEvent
Fired when a layer is removed from this FeatureGroup
@@ -16029,12 +16094,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -16060,12 +16125,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -16091,12 +16156,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -16122,19 +16187,20 @@ Methods
- addData(data)
+ addData(data)
this
Adds a GeoJSON object to the layer.
- resetStyle(layer)
+ resetStyle(layer?)
this
- Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
+ Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
+If layer is omitted, the style of all features in the current layer is reset.
- setStyle(style)
+ setStyle(style)
this
Changes styles of GeoJSON vector layers with the given style function.
@@ -16160,19 +16226,19 @@ Methods
- bringToFront()
+ bringToFront()
this
Brings the layer group to the top of all other layers
- bringToBack()
+ bringToBack()
this
Brings the layer group to the back of all other layers
- getBounds()
+ getBounds()
LatLngBounds
Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
@@ -16199,7 +16265,7 @@ Methods
- toGeoJSON(<Number> precision?)
+ toGeoJSON(<Number> precision?)
Object
precision is the number of decimal places for coordinates.
The default value is 6 places.
@@ -16207,43 +16273,43 @@
Methods
- addLayer(<Layer> layer)
+ addLayer(<Layer> layer)
this
Adds the given layer to the group.
- removeLayer(<Layer> layer)
+ removeLayer(<Layer> layer)
this
Removes the given layer from the group.
- removeLayer(<Number> id)
+ removeLayer(<Number> id)
this
Removes the layer with the given internal ID from the group.
- hasLayer(<Layer> layer)
+ hasLayer(<Layer> layer)
Boolean
Returns true if the given layer is currently added to the group.
- hasLayer(<Number> id)
+ hasLayer(<Number> id)
Boolean
Returns true if the given internal ID is currently added to the group.
- clearLayers()
+ clearLayers()
this
Removes all the layers from the group.
- invoke(<String> methodName, …)
+ invoke(<String> methodName, …)
this
Calls methodName on every layer contained in this group, passing any
additional parameters. Has no effect if the layers contained do not
@@ -16251,7 +16317,7 @@
Methods
- eachLayer(<Function> fn, <Object> context?)
+ eachLayer(<Function> fn, <Object> context?)
this
Iterates over the layers of the group, optionally specifying context of the iterator function.
group.eachLayer(function (layer) {
@@ -16261,25 +16327,25 @@ Methods
- getLayer(<Number> id)
+ getLayer(<Number> id)
Layer
Returns the layer with the given internal ID.
- getLayers()
+ getLayers()
Layer[]
Returns an array of all the layers added to the group.
- setZIndex(<Number> zIndex)
+ setZIndex(<Number> zIndex)
this
Calls setZIndex on every layer contained in this group, passing the z-index.
- getLayerId(<Layer> layer)
+ getLayerId(<Layer> layer)
Number
Returns the internal ID for a layer
@@ -16306,31 +16372,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -16357,7 +16423,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -16365,43 +16431,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -16428,7 +16494,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -16436,43 +16502,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -16499,37 +16565,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -16537,61 +16603,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -16619,38 +16685,38 @@ Functions
- geometryToLayer(<Object> featureData, <GeoJSON options> options?)
+ geometryToLayer(<Object> featureData, <GeoJSON options> options?)
Layer
Creates a Layer from a given GeoJSON feature. Can use a custom
pointToLayer and/or coordsToLatLng
functions if provided as options.
- coordsToLatLng(<Array> coords)
+ coordsToLatLng(<Array> coords)
LatLng
Creates a LatLng object from an array of 2 numbers (longitude, latitude)
or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
- coordsToLatLngs(<Array> coords, <Number> levelsDeep?, <Function> coordsToLatLng?)
+ coordsToLatLngs(<Array> coords, <Number> levelsDeep?, <Function> coordsToLatLng?)
Array
Creates a multidimensional array of LatLngs from a GeoJSON coordinates array.
levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).
Can use a custom coordsToLatLng function.
- latLngToCoords(<LatLng> latlng, <Number> precision?)
+ latLngToCoords(<LatLng> latlng, <Number> precision?)
Array
Reverse of coordsToLatLng
- latLngsToCoords(<Array> latlngs, <Number> levelsDeep?, <Boolean> closed?)
+ latLngsToCoords(<Array> latlngs, <Number> levelsDeep?, <Boolean> closed?)
Array
Reverse of coordsToLatLngs
closed determines whether the first point should be appended to the end of the array to close the feature, only used when levelsDeep is 0. False by default.
- asFeature(<Object> geojson)
+ asFeature(<Object> geojson)
Object
Normalize GeoJSON geometries/features into GeoJSON features.
@@ -16735,7 +16801,7 @@ Creation
- L.gridLayer(<GridLayer options> options?)
+ L.gridLayer(<GridLayer options> options?)
Creates a new instance of GridLayer with the supplied options.
@@ -16762,19 +16828,19 @@ Options
tileSize
- Number|Point
+ Number|Point
256
Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
opacity
- Number
+ Number
1.0
Opacity of the tiles. Can be used in the createTile() function.
updateWhenIdle
- Boolean
+ Boolean
(depends)
Load new tiles only when panning ends.
true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
@@ -16783,43 +16849,43 @@ Options
updateWhenZooming
- Boolean
+ Boolean
true
By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
updateInterval
- Number
+ Number
200
Tiles will not update more than once every updateInterval milliseconds when panning.
zIndex
- Number
+ Number
1
The explicit zIndex of the tile layer.
bounds
- LatLngBounds
+ LatLngBounds
undefined
If set, tiles will only be loaded inside the set LatLngBounds.
minZoom
- Number
+ Number
0
The minimum zoom level down to which this layer will be displayed (inclusive).
maxZoom
- Number
+ Number
undefined
The maximum zoom level up to which this layer will be displayed (inclusive).
maxNativeZoom
- Number
+ Number
undefined
Maximum zoom number the tile source has available. If it is specified,
the tiles on all zoom levels higher than maxNativeZoom will be loaded
@@ -16827,7 +16893,7 @@ Options
minNativeZoom
- Number
+ Number
undefined
Minimum zoom number the tile source has available. If it is specified,
the tiles on all zoom levels lower than minNativeZoom will be loaded
@@ -16835,7 +16901,7 @@ Options
noWrap
- Boolean
+ Boolean
false
Whether the layer is wrapped around the antimeridian. If true, the
GridLayer will only be displayed once at low zoom levels. Has no
@@ -16845,19 +16911,19 @@ Options
pane
- String
+ String
'tilePane'
Map pane where the grid layer will be added.
className
- String
+ String
''
A custom class name to assign to the tile layer. Empty by default.
keepBuffer
- Number
+ Number
2
When panning the map, keep this many rows and columns of tiles before unloading them.
@@ -16884,7 +16950,7 @@ Options
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -16910,32 +16976,32 @@ Events
- loading
+ loading
Event
Fired when the grid layer starts loading tiles.
- tileunload
+ tileunload
TileEvent
Fired when a tile is removed (e.g. when a tile goes off the screen).
- tileloadstart
+ tileloadstart
TileEvent
Fired when a tile is requested and starts loading.
- tileerror
+ tileerror
TileErrorEvent
Fired when there is an error loading a tile.
- tileload
+ tileload
TileEvent
Fired when a tile loads.
- load
+ load
Event
Fired when the grid layer loaded all visible tiles.
@@ -16960,12 +17026,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -16991,12 +17057,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -17022,12 +17088,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -17053,49 +17119,49 @@ Methods
- bringToFront()
+ bringToFront()
this
Brings the tile layer to the top of all tile layers.
- bringToBack()
+ bringToBack()
this
Brings the tile layer to the bottom of all tile layers.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTML element that contains the tiles for this layer.
- setOpacity(<Number> opacity)
+ setOpacity(<Number> opacity)
this
Changes the opacity of the grid layer.
- setZIndex(<Number> zIndex)
+ setZIndex(<Number> zIndex)
this
Changes the zIndex of the grid layer.
- isLoading()
+ isLoading()
Boolean
Returns true if any tile in the grid layer has not finished loading.
- redraw()
+ redraw()
this
Causes the layer to clear all the tiles and request them again.
- getTileSize()
+ getTileSize()
Point
Normalizes the tileSize option into a point. Used by the createTile() method.
@@ -17116,7 +17182,7 @@ Extension methods
- createTile(<Object> coords, <Function> done?)
+ createTile(<Object> coords, <Function> done?)
HTMLElement
Called only internally, must be overridden by classes extending GridLayer.
Returns the HTMLElement corresponding to the given coords. If the done callback
@@ -17144,31 +17210,31 @@
Extension methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -17195,7 +17261,7 @@ Extension methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -17203,43 +17269,43 @@
Extension methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -17266,7 +17332,7 @@ Extension methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -17274,43 +17340,43 @@
Extension methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -17337,37 +17403,37 @@ Extension methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -17375,61 +17441,61 @@
Extension methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -17481,15 +17547,15 @@ Creation
- L.latLng(<Number> latitude, <Number> longitude, <Number> altitude?)
+ L.latLng(<Number> latitude, <Number> longitude, <Number> altitude?)
Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).
- L.latLng(<Array> coords)
+ L.latLng(<Array> coords)
Expects an array of the form [Number, Number] or [Number, Number, Number] instead.
- L.latLng(<Object> coords)
+ L.latLng(<Object> coords)
Expects an plain object of the form {lat: Number, lng: Number} or {lat: Number, lng: Number, alt: Number} instead.
@@ -17513,31 +17579,31 @@ Methods
- equals(<LatLng> otherLatLng, <Number> maxMargin?)
+ equals(<LatLng> otherLatLng, <Number> maxMargin?)
Boolean
Returns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overridden by setting maxMargin to a small number.
- toString()
+ toString()
String
Returns a string representation of the point (for debugging purposes).
- distanceTo(<LatLng> otherLatLng)
+ distanceTo(<LatLng> otherLatLng)
Number
Returns the distance (in meters) to the given LatLng calculated using the Spherical Law of Cosines.
- wrap()
+ wrap()
LatLng
Returns a new LatLng object with the longitude wrapped so it's always between -180 and +180 degrees.
- toBounds(<Number> sizeInMeters)
+ toBounds(<Number> sizeInMeters)
LatLngBounds
Returns a new LatLngBounds object in which each boundary is sizeInMeters/2 meters apart from the LatLng.
@@ -17563,17 +17629,17 @@ Properties
- lat
+ lat
Number
Latitude in degrees
- lng
+ lng
Number
Longitude in degrees
- alt
+ alt
Number
Altitude in meters (optional)
@@ -17628,11 +17694,11 @@ Creation
- L.latLngBounds(<LatLng> corner1, <LatLng> corner2)
+ L.latLngBounds(<LatLng> corner1, <LatLng> corner2)
Creates a LatLngBounds object by defining two diagonally opposite corners of the rectangle.
- L.latLngBounds(<LatLng[]> latlngs)
+ L.latLngBounds(<LatLng[]> latlngs)
Creates a LatLngBounds object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with fitBounds.
@@ -17656,19 +17722,19 @@ Methods
- extend(<LatLng> latlng)
+ extend(<LatLng> latlng)
this
Extend the bounds to contain the given point
- extend(<LatLngBounds> otherBounds)
+ extend(<LatLngBounds> otherBounds)
this
Extend the bounds to contain the given bounds
- pad(<Number> bufferRatio)
+ pad(<Number> bufferRatio)
LatLngBounds
Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
For example, a ratio of 0.5 extends the bounds by 50% in each direction.
@@ -17676,97 +17742,97 @@
Methods
- getCenter()
+ getCenter()
LatLng
Returns the center point of the bounds.
- getSouthWest()
+ getSouthWest()
LatLng
Returns the south-west point of the bounds.
- getNorthEast()
+ getNorthEast()
LatLng
Returns the north-east point of the bounds.
- getNorthWest()
+ getNorthWest()
LatLng
Returns the north-west point of the bounds.
- getSouthEast()
+ getSouthEast()
LatLng
Returns the south-east point of the bounds.
- getWest()
+ getWest()
Number
Returns the west longitude of the bounds
- getSouth()
+ getSouth()
Number
Returns the south latitude of the bounds
- getEast()
+ getEast()
Number
Returns the east longitude of the bounds
- getNorth()
+ getNorth()
Number
Returns the north latitude of the bounds
- contains(<LatLngBounds> otherBounds)
+ contains(<LatLngBounds> otherBounds)
Boolean
Returns true if the rectangle contains the given one.
- contains(<LatLng> latlng)
+ contains(<LatLng> latlng)
Boolean
Returns true if the rectangle contains the given point.
- intersects(<LatLngBounds> otherBounds)
+ intersects(<LatLngBounds> otherBounds)
Boolean
Returns true if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
- overlaps(<Bounds> otherBounds)
+ overlaps(<Bounds> otherBounds)
Boolean
Returns true if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
- toBBoxString()
+ toBBoxString()
String
Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
- equals(<LatLngBounds> otherBounds, <Number> maxMargin?)
+ equals(<LatLngBounds> otherBounds, <Number> maxMargin?)
Boolean
Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting maxMargin to a small number.
- isValid()
+ isValid()
Boolean
Returns true if the bounds are properly initialized.
@@ -17817,15 +17883,15 @@ Creation
- L.point(<Number> x, <Number> y, <Boolean> round?)
+ L.point(<Number> x, <Number> y, <Boolean> round?)
Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values.
- L.point(<Number[]> coords)
+ L.point(<Number[]> coords)
Expects an array of the form [x, y] instead.
- L.point(<Object> coords)
+ L.point(<Object> coords)
Expects a plain object of the form {x: Number, y: Number} instead.
@@ -17849,37 +17915,37 @@ Methods
- clone()
+ clone()
Point
Returns a copy of the current point.
- add(<Point> otherPoint)
+ add(<Point> otherPoint)
Point
Returns the result of addition of the current and the given points.
- subtract(<Point> otherPoint)
+ subtract(<Point> otherPoint)
Point
Returns the result of subtraction of the given point from the current.
- divideBy(<Number> num)
+ divideBy(<Number> num)
Point
Returns the result of division of the current point by the given number.
- multiplyBy(<Number> num)
+ multiplyBy(<Number> num)
Point
Returns the result of multiplication of the current point by the given number.
- scaleBy(<Point> scale)
+ scaleBy(<Point> scale)
Point
Multiply each coordinate of the current point by each coordinate of
scale. In linear algebra terms, multiply the point by the
@@ -17888,56 +17954,56 @@
Methods
- unscaleBy(<Point> scale)
+ unscaleBy(<Point> scale)
Point
Inverse of scaleBy. Divide each coordinate of the current point by
each coordinate of scale.
- round()
+ round()
Point
Returns a copy of the current point with rounded coordinates.
- floor()
+ floor()
Point
Returns a copy of the current point with floored coordinates (rounded down).
- ceil()
+ ceil()
Point
Returns a copy of the current point with ceiled coordinates (rounded up).
- trunc()
+ trunc()
Point
Returns a copy of the current point with truncated coordinates (rounded towards zero).
- distanceTo(<Point> otherPoint)
+ distanceTo(<Point> otherPoint)
Number
Returns the cartesian distance between the current and the given points.
- equals(<Point> otherPoint)
+ equals(<Point> otherPoint)
Boolean
Returns true if the given point has the same coordinates.
- contains(<Point> otherPoint)
+ contains(<Point> otherPoint)
Boolean
Returns true if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
- toString()
+ toString()
String
Returns a string representation of the point for debugging purposes.
@@ -17963,12 +18029,12 @@ Properties
- x
+ x
Number
The x coordinate of the point
- y
+ y
Number
The y coordinate of the point
@@ -18019,11 +18085,11 @@ Creation
- L.bounds(<Point> corner1, <Point> corner2)
+ L.bounds(<Point> corner1, <Point> corner2)
Creates a Bounds object from two corners coordinate pairs.
- L.bounds(<Point[]> points)
+ L.bounds(<Point[]> points)
Creates a Bounds object from the given array of points.
@@ -18047,68 +18113,68 @@ Methods
- extend(<Point> point)
+ extend(<Point> point)
this
Extends the bounds to contain the given point.
- getCenter(<Boolean> round?)
+ getCenter(<Boolean> round?)
Point
Returns the center point of the bounds.
- getBottomLeft()
+ getBottomLeft()
Point
Returns the bottom-left point of the bounds.
- getTopRight()
+ getTopRight()
Point
Returns the top-right point of the bounds.
- getTopLeft()
+ getTopLeft()
Point
Returns the top-left point of the bounds (i.e. this.min).
- getBottomRight()
+ getBottomRight()
Point
Returns the bottom-right point of the bounds (i.e. this.max).
- getSize()
+ getSize()
Point
Returns the size of the given bounds
- contains(<Bounds> otherBounds)
+ contains(<Bounds> otherBounds)
Boolean
Returns true if the rectangle contains the given one.
- contains(<Point> point)
+ contains(<Point> point)
Boolean
Returns true if the rectangle contains the given point.
- intersects(<Bounds> otherBounds)
+ intersects(<Bounds> otherBounds)
Boolean
Returns true if the rectangle intersects the given bounds. Two bounds
intersect if they have at least one point in common.
- overlaps(<Bounds> otherBounds)
+ overlaps(<Bounds> otherBounds)
Boolean
Returns true if the rectangle overlaps the given bounds. Two bounds
overlap if their intersection is an area.
@@ -18135,12 +18201,12 @@ Properties
- min
+ min
Point
The top left corner of the rectangle.
- max
+ max
Point
The bottom right corner of the rectangle.
@@ -18193,7 +18259,7 @@ Creation
- L.icon(<Icon options> options)
+ L.icon(<Icon options> options)
Creates an icon instance with the given options.
@@ -18219,26 +18285,26 @@ Options
iconUrl
- String
+ String
null
(required) The URL to the icon image (absolute or relative to your script path).
iconRetinaUrl
- String
+ String
null
The URL to a retina sized version of the icon image (absolute or relative to your
script path). Used for Retina screen devices.
iconSize
- Point
+ Point
null
Size of the icon image in pixels.
iconAnchor
- Point
+ Point
null
The coordinates of the "tip" of the icon (relative to its top left corner). The icon
will be aligned so that this point is at the marker's geographical location. Centered
@@ -18246,44 +18312,44 @@ Options
popupAnchor
- Point
+ Point
[0, 0]
The coordinates of the point from which popups will "open", relative to the icon anchor.
tooltipAnchor
- Point
+ Point
[0, 0]
The coordinates of the point from which tooltips will "open", relative to the icon anchor.
shadowUrl
- String
+ String
null
The URL to the icon shadow image. If not specified, no shadow image will be created.
shadowRetinaUrl
- String
+ String
null
shadowSize
- Point
+ Point
null
Size of the shadow image in pixels.
shadowAnchor
- Point
+ Point
null
The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
as iconAnchor if not specified).
className
- String
+ String
''
A custom class name to assign to both icon and shadow images. Empty by default.
@@ -18308,14 +18374,14 @@ Methods
- createIcon(<HTMLElement> oldIcon?)
+ createIcon(<HTMLElement> oldIcon?)
HTMLElement
Called internally when the icon has to be shown, returns a <img> HTML element
styled according to the options.
- createShadow(<HTMLElement> oldIcon?)
+ createShadow(<HTMLElement> oldIcon?)
HTMLElement
As createIcon, but for the shadow beneath it.
@@ -18352,7 +18418,7 @@ Icon.Default
imagePath
- String
+ String
Icon.Default will try to auto-detect the location of the
blue icon images. If you are placing these images in a non-standard
@@ -18401,7 +18467,7 @@ Creation
- L.divIcon(<DivIcon options> options)
+ L.divIcon(<DivIcon options> options)
Creates a DivIcon instance with the given options.
@@ -18427,14 +18493,14 @@ Options
html
- String|HTMLElement
+ String|HTMLElement
''
Custom HTML code to put inside the div element, empty by default. Alternatively,
an instance of HTMLElement.
bgPos
- Point
+ Point
[0, 0]
Optional relative position of the background, in pixels
@@ -18461,26 +18527,26 @@ Options
iconUrl
- String
+ String
null
(required) The URL to the icon image (absolute or relative to your script path).
iconRetinaUrl
- String
+ String
null
The URL to a retina sized version of the icon image (absolute or relative to your
script path). Used for Retina screen devices.
iconSize
- Point
+ Point
null
Size of the icon image in pixels.
iconAnchor
- Point
+ Point
null
The coordinates of the "tip" of the icon (relative to its top left corner). The icon
will be aligned so that this point is at the marker's geographical location. Centered
@@ -18488,44 +18554,44 @@ Options
popupAnchor
- Point
+ Point
[0, 0]
The coordinates of the point from which popups will "open", relative to the icon anchor.
tooltipAnchor
- Point
+ Point
[0, 0]
The coordinates of the point from which tooltips will "open", relative to the icon anchor.
shadowUrl
- String
+ String
null
The URL to the icon shadow image. If not specified, no shadow image will be created.
shadowRetinaUrl
- String
+ String
null
shadowSize
- Point
+ Point
null
Size of the shadow image in pixels.
shadowAnchor
- Point
+ Point
null
The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
as iconAnchor if not specified).
className
- String
+ String
''
A custom class name to assign to both icon and shadow images. Empty by default.
@@ -18557,14 +18623,14 @@ Methods
- createIcon(<HTMLElement> oldIcon?)
+ createIcon(<HTMLElement> oldIcon?)
HTMLElement
Called internally when the icon has to be shown, returns a <img> HTML element
styled according to the options.
- createShadow(<HTMLElement> oldIcon?)
+ createShadow(<HTMLElement> oldIcon?)
HTMLElement
As createIcon, but for the shadow beneath it.
@@ -18592,7 +18658,7 @@ Creation
- L.control.zoom(<Control.Zoom options> options)
+ L.control.zoom(<Control.Zoom options> options)
Creates a zoom control
@@ -18618,26 +18684,26 @@ Options
zoomInText
- String
+ String
'+'
The text set on the 'zoom in' button.
zoomInTitle
- String
+ String
'Zoom in'
The title set on the 'zoom in' button.
zoomOutText
- String
+ String
'−
'
The text set on the 'zoom out' button.
zoomOutTitle
- String
+ String
'Zoom out'
The title set on the 'zoom out' button.
@@ -18664,7 +18730,7 @@ Options
position
- String
+ String
'topright'
The position of the control (one of the map corners). Possible values are 'topleft',
'topright', 'bottomleft' or 'bottomright'
@@ -18697,31 +18763,31 @@ Methods
- getPosition()
+ getPosition()
string
Returns the position of the control.
- setPosition(<string> position)
+ setPosition(<string> position)
this
Sets the position of the control.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTMLElement that contains the control.
- addTo(<Map> map)
+ addTo(<Map> map)
this
Adds the control to the given map.
- remove()
+ remove()
this
Removes the control from the map it is currently active on.
@@ -18749,7 +18815,7 @@ Creation
- L.control.attribution(<Control.Attribution options> options)
+ L.control.attribution(<Control.Attribution options> options)
Creates an attribution control.
@@ -18775,7 +18841,7 @@ Options
prefix
- String
+ String
'Leaflet'
The HTML text shown before the attributions. Pass false to disable.
@@ -18802,7 +18868,7 @@ Options
position
- String
+ String
'topright'
The position of the control (one of the map corners). Possible values are 'topleft',
'topright', 'bottomleft' or 'bottomright'
@@ -18829,19 +18895,19 @@ Methods
- setPrefix(<String> prefix)
+ setPrefix(<String> prefix)
this
Sets the text before the attributions.
- addAttribution(<String> text)
+ addAttribution(<String> text)
this
Adds an attribution text (e.g. 'Vector data © Mapbox').
- removeAttribution(<String> text)
+ removeAttribution(<String> text)
this
Removes an attribution text.
@@ -18867,31 +18933,31 @@ Methods
- getPosition()
+ getPosition()
string
Returns the position of the control.
- setPosition(<string> position)
+ setPosition(<string> position)
this
Sets the position of the control.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTMLElement that contains the control.
- addTo(<Map> map)
+ addTo(<Map> map)
this
Adds the control to the given map.
- remove()
+ remove()
this
Removes the control from the map it is currently active on.
@@ -18953,8 +19019,8 @@ Creation
- L.control.layers(<Object> baselayers?, <Object> overlays?, <Control.Layers options> options?)
- Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
+ L.control.layers(<Object> baselayers?, <Object> overlays?, <Control.Layers options> options?)
+ Creates a layers control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
@@ -18979,32 +19045,32 @@ Options
collapsed
- Boolean
+ Boolean
true
If true, the control will be collapsed into an icon and expanded on mouse hover or touch.
autoZIndex
- Boolean
+ Boolean
true
If true, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
hideSingleBase
- Boolean
+ Boolean
false
If true, the base layers in the control will be hidden when there is only one.
sortLayers
- Boolean
+ Boolean
false
Whether to sort the layers. When false, layers will keep the order
in which they were added to the control.
sortFunction
- Function
+ Function
*
A compare function
that will be used for sorting the layers, when sortLayers is true.
@@ -19035,7 +19101,7 @@ Options
position
- String
+ String
'topright'
The position of the control (one of the map corners). Possible values are 'topleft',
'topright', 'bottomleft' or 'bottomright'
@@ -19062,31 +19128,31 @@ Methods
- addBaseLayer(<Layer> layer, <String> name)
+ addBaseLayer(<Layer> layer, <String> name)
this
Adds a base layer (radio button entry) with the given name to the control.
- addOverlay(<Layer> layer, <String> name)
+ addOverlay(<Layer> layer, <String> name)
this
Adds an overlay (checkbox entry) with the given name to the control.
- removeLayer(<Layer> layer)
+ removeLayer(<Layer> layer)
this
Remove the given layer from the control.
- expand()
+ expand()
this
Expand the control container if collapsed.
- collapse()
+ collapse()
this
Collapse the control container if expanded.
@@ -19112,31 +19178,31 @@ Methods
- getPosition()
+ getPosition()
string
Returns the position of the control.
- setPosition(<string> position)
+ setPosition(<string> position)
this
Sets the position of the control.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTMLElement that contains the control.
- addTo(<Map> map)
+ addTo(<Map> map)
this
Adds the control to the given map.
- remove()
+ remove()
this
Removes the control from the map it is currently active on.
@@ -19181,7 +19247,7 @@ Creation
- L.control.scale(<Control.Scale options> options?)
+ L.control.scale(<Control.Scale options> options?)
Creates an scale control with the given options.
@@ -19207,25 +19273,25 @@ Options
maxWidth
- Number
+ Number
100
Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
metric
- Boolean
+ Boolean
True
Whether to show the metric scale line (m/km).
imperial
- Boolean
+ Boolean
True
Whether to show the imperial scale line (mi/ft).
updateWhenIdle
- Boolean
+ Boolean
false
If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).
@@ -19252,7 +19318,7 @@ Options
position
- String
+ String
'topright'
The position of the control (one of the map corners). Possible values are 'topleft',
'topright', 'bottomleft' or 'bottomright'
@@ -19285,31 +19351,31 @@ Methods
- getPosition()
+ getPosition()
string
Returns the position of the control.
- setPosition(<string> position)
+ setPosition(<string> position)
this
Sets the position of the control.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTMLElement that contains the control.
- addTo(<Map> map)
+ addTo(<Map> map)
this
Adds the control to the given map.
- remove()
+ remove()
this
Removes the control from the map it is currently active on.
@@ -19357,117 +19423,117 @@ Properties
- ie
+ ie
Boolean
true for all Internet Explorer versions (not Edge).
- ielt9
+ ielt9
Boolean
true for Internet Explorer versions less than 9.
- edge
+ edge
Boolean
true for the Edge web browser.
- webkit
+ webkit
Boolean
true for webkit-based browsers like Chrome and Safari (including mobile versions).
- android
+ android
Boolean
true for any browser running on an Android platform.
- android23
+ android23
Boolean
true for browsers running on Android 2 or Android 3.
- androidStock
+ androidStock
Boolean
true for the Android stock browser (i.e. not Chrome)
- opera
+ opera
Boolean
true for the Opera browser
- chrome
+ chrome
Boolean
true for the Chrome browser.
- gecko
+ gecko
Boolean
true for gecko-based browsers like Firefox.
- safari
+ safari
Boolean
true for the Safari browser.
- opera12
+ opera12
Boolean
true for the Opera browser supporting CSS transforms (version 12 or later).
- win
+ win
Boolean
true when the browser is running in a Windows platform
- ie3d
+ ie3d
Boolean
true for all Internet Explorer versions supporting CSS transforms.
- webkit3d
+ webkit3d
Boolean
true for webkit-based browsers supporting CSS transforms.
- gecko3d
+ gecko3d
Boolean
true for gecko-based browsers supporting CSS transforms.
- any3d
+ any3d
Boolean
true for all browsers supporting CSS transforms.
- mobile
+ mobile
Boolean
true for all browsers running in a mobile device.
- mobileWebkit
+ mobileWebkit
Boolean
true for all webkit-based browsers in a mobile device.
- mobileWebkit3d
+ mobileWebkit3d
Boolean
true for all webkit-based browsers in a mobile device supporting CSS transforms.
- msPointer
+ msPointer
Boolean
true for browsers implementing the Microsoft touch events model (notably IE10).
- pointer
+ pointer
Boolean
true for all browsers supporting pointer events.
- touch
+ touch
Boolean
true for all browsers supporting touch events.
This does not necessarily mean that the browser is running in a computer with
@@ -19475,32 +19541,37 @@ Properties
touch events.
- mobileOpera
+ mobileOpera
Boolean
true for the Opera browser in a mobile device.
- mobileGecko
+ mobileGecko
Boolean
true for gecko-based browsers running in a mobile device.
- retina
+ retina
Boolean
true for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
+
+ passiveEvents
+ Boolean
+ true for browsers that support passive events.
+
- canvas
+ canvas
Boolean
true when the browser supports <canvas>.
- svg
+ svg
Boolean
true when the browser supports SVG.
- vml
+ vml
Boolean
true if the browser supports VML.
@@ -19527,28 +19598,28 @@ Functions
- extend(<Object> dest, <Object> src?)
+ extend(<Object> dest, <Object> src?)
Object
Merges the properties of the src object (or multiple objects) into dest object and returns the latter. Has an L.extend shortcut.
- create(<Object> proto, <Object> properties?)
+ create(<Object> proto, <Object> properties?)
Object
Compatibility polyfill for Object.create
- bind(<Function> fn, …)
+ bind(<Function> fn, …)
Function
Returns a new function bound to the arguments passed, like Function.prototype.bind.
Has a L.bind() shortcut.
- stamp(<Object> obj)
+ stamp(<Object> obj)
Number
Returns the unique ID of an object, assigning it one if it doesn't have it.
- throttle(<Function> fn, <Number> time, <Object> context)
+ throttle(<Function> fn, <Number> time, <Object> context)
Function
Returns a function which executes function fn with the given scope context
(so that the this keyword refers to context inside fn's code). The function
@@ -19558,39 +19629,39 @@ Functions
Has an L.throttle shortcut.
- wrapNum(<Number> num, <Number[]> range, <Boolean> includeMax?)
+ wrapNum(<Number> num, <Number[]> range, <Boolean> includeMax?)
Number
Returns the number num modulo range in such a way so it lies within
range[0] and range[1]. The returned value will be always smaller than
range[1] unless includeMax is set to true.
- falseFn()
+ falseFn()
Function
Returns a function which always returns false.
- formatNum(<Number> num, <Number> digits?)
+ formatNum(<Number> num, <Number> digits?)
Number
Returns the number num rounded to digits decimals, or to 6 decimals by default.
- trim(<String> str)
+ trim(<String> str)
String
Compatibility polyfill for String.prototype.trim
- splitWords(<String> str)
+ splitWords(<String> str)
String[]
Trims and splits the string on whitespace and returns the array of parts.
- setOptions(<Object> obj, <Object> options)
+ setOptions(<Object> obj, <Object> options)
Object
Merges the given properties to the options of the obj object, returning the resulting options. See Class options. Has an L.setOptions shortcut.
- getParamString(<Object> obj, <String> existingUrl?, <Boolean> uppercase?)
+ getParamString(<Object> obj, <String> existingUrl?, <Boolean> uppercase?)
String
Converts an object into a parameter URL string, e.g. {a: "foo", b: "bar"}
translates to '?a=foo&b=bar'. If existingUrl is set, the parameters will
@@ -19598,7 +19669,7 @@ Functions
be uppercased (e.g. '?A=foo&B=bar')
- template(<String> str, <Object> data)
+ template(<String> str, <Object> data)
String
Simple templating facility, accepts a template string of the form 'Hello {a}, {b}'
and a data object like {a: 'foo', b: 'bar'}, returns evaluated string
@@ -19606,17 +19677,17 @@ Functions
data values — they will be evaluated passing data as an argument.
- isArray(obj)
+ isArray(obj)
Boolean
Compatibility polyfill for Array.isArray
- indexOf(<Array> array, <Object> el)
+ indexOf(<Array> array, <Object> el)
Number
Compatibility polyfill for Array.prototype.indexOf
- requestAnimFrame(<Function> fn, <Object> context?, <Boolean> immediate?)
+ requestAnimFrame(<Function> fn, <Object> context?, <Boolean> immediate?)
Number
Schedules fn to be executed when the browser repaints. fn is bound to
context if given. When immediate is set, fn is called immediately if
@@ -19625,7 +19696,7 @@ Functions
otherwise it's delayed. Returns a request ID that can be used to cancel the request.
- cancelAnimFrame(<Number> id)
+ cancelAnimFrame(<Number> id)
undefined
Cancels a previous requestAnimFrame. See also window.cancelAnimationFrame.
@@ -19650,12 +19721,12 @@ Properties
- lastId
+ lastId
Number
Last unique ID used by stamp()
- emptyImageUrl
+ emptyImageUrl
String
Data URI string containing a base64-encoded empty GIF image.
Used as a hack to free memory from unused images on WebKit-powered
@@ -19705,11 +19776,11 @@ Creation
- L.transformation(<Number> a, <Number> b, <Number> c, <Number> d)
+ L.transformation(<Number> a, <Number> b, <Number> c, <Number> d)
Instantiates a Transformation object with the given coefficients.
- L.transformation(<Array> coefficients)
+ L.transformation(<Array> coefficients)
Expects an coefficients array of the form
[a: Number, b: Number, c: Number, d: Number].
@@ -19734,14 +19805,14 @@ Methods
- transform(<Point> point, <Number> scale?)
+ transform(<Point> point, <Number> scale?)
Point
Returns a transformed point, optionally multiplied by the given scale.
Only accepts actual L.Point instances, not arrays.
- untransform(<Point> point, <Number> scale?)
+ untransform(<Point> point, <Number> scale?)
Point
Returns the reverse transformation of the given point, optionally divided
by the given scale. Only accepts actual L.Point instances, not arrays.
@@ -19770,7 +19841,7 @@ Functions
- simplify(<Point[]> points, <Number> tolerance)
+ simplify(<Point[]> points, <Number> tolerance)
Point[]
Dramatically reduces the number of points in a polyline while retaining
its shape and returns a new array of simplified points, using the
@@ -19781,17 +19852,17 @@ Functions
Also released as a separated micro-library Simplify.js.
- pointToSegmentDistance(<Point> p, <Point> p1, <Point> p2)
+ pointToSegmentDistance(<Point> p, <Point> p1, <Point> p2)
Number
Returns the distance between point p and segment p1 to p2.
- closestPointOnSegment(<Point> p, <Point> p1, <Point> p2)
+ closestPointOnSegment(<Point> p, <Point> p1, <Point> p2)
Number
Returns the closest point from a point p on a segment p1 to p2.
- clipSegment(<Point> a, <Point> b, <Bounds> bounds, <Boolean> useLastCode?, <Boolean> round?)
+ clipSegment(<Point> a, <Point> b, <Bounds> bounds, <Boolean> useLastCode?, <Boolean> round?)
Point[]|Boolean
Clips the segment a to b by rectangular bounds with the
Cohen-Sutherland algorithm
@@ -19799,7 +19870,7 @@ Functions
points that are on the screen or near, increasing performance.
- isFlat(<LatLng[]> latlngs)
+ isFlat(<LatLng[]> latlngs)
Boolean
Returns true if latlngs is a flat array, false is nested.
@@ -19826,7 +19897,7 @@ Functions
- clipPolygon(<Point[]> points, <Bounds> bounds, <Boolean> round?)
+ clipPolygon(<Point[]> points, <Bounds> bounds, <Boolean> round?)
Point[]
Clips the polygon geometry defined by the given points by the given bounds (using the Sutherland-Hodgman algorithm).
Used by Leaflet to only show polygon points that are on the screen or near, increasing
@@ -19856,7 +19927,7 @@ Functions
- on(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
+ on(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular DOM event type of the
element el. You can optionally specify the context of the listener
@@ -19864,24 +19935,24 @@ Functions
space-separated types (e.g. 'click dblclick').
- on(<HTMLElement> el, <Object> eventMap, <Object> context?)
+ on(<HTMLElement> el, <Object> eventMap, <Object> context?)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
+ off(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
this
Removes a previously added listener function.
Note that if you passed a custom context to on, you must pass the same
context to off in order to remove the listener.
- off(<HTMLElement> el, <Object> eventMap, <Object> context?)
+ off(<HTMLElement> el, <Object> eventMap, <Object> context?)
this
Removes a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- stopPropagation(<DOMEvent> ev)
+ stopPropagation(<DOMEvent> ev)
this
Stop the given event from propagation to parent elements. Used inside the listener functions:
L.DomEvent.on(div, 'click', function (ev) {
@@ -19890,18 +19961,18 @@ Functions
- disableScrollPropagation(<HTMLElement> el)
+ disableScrollPropagation(<HTMLElement> el)
this
Adds stopPropagation to the element's 'mousewheel' events (plus browser variants).
- disableClickPropagation(<HTMLElement> el)
+ disableClickPropagation(<HTMLElement> el)
this
Adds stopPropagation to the element's 'click', 'doubleclick',
'mousedown' and 'touchstart' events (plus browser variants).
- preventDefault(<DOMEvent> ev)
+ preventDefault(<DOMEvent> ev)
this
Prevents the default action of the DOM Event ev from happening (such as
following a link in the href of the a element, or doing a POST request
@@ -19909,18 +19980,18 @@ Functions
Use it inside listener functions.
- stop(<DOMEvent> ev)
+ stop(<DOMEvent> ev)
this
Does stopPropagation and preventDefault at the same time.
- getMousePosition(<DOMEvent> ev, <HTMLElement> container?)
+ getMousePosition(<DOMEvent> ev, <HTMLElement> container?)
Point
Gets normalized mouse position from a DOM event relative to the
container (border excluded) or to the whole page if not specified.
- getWheelDelta(<DOMEvent> ev)
+ getWheelDelta(<DOMEvent> ev)
Number
Gets normalized wheel delta from a mousewheel DOM event, in vertical
pixels scrolled (negative if scrolling down).
@@ -19928,12 +19999,12 @@ Functions
a best guess of 60 pixels.
- addListener(…)
+ addListener(…)
this
Alias to L.DomEvent.on
- removeListener(…)
+ removeListener(…)
this
Alias to L.DomEvent.off
@@ -19964,101 +20035,101 @@ Functions
- get(<String|HTMLElement> id)
+ get(<String|HTMLElement> id)
HTMLElement
Returns an element given its DOM id, or returns the element itself
if it was passed directly.
- getStyle(<HTMLElement> el, <String> styleAttrib)
+ getStyle(<HTMLElement> el, <String> styleAttrib)
String
Returns the value for a certain style attribute on an element,
including computed values or values set through CSS.
- create(<String> tagName, <String> className?, <HTMLElement> container?)
+ create(<String> tagName, <String> className?, <HTMLElement> container?)
HTMLElement
Creates an HTML element with tagName, sets its class to className, and optionally appends it to container element.
- remove(<HTMLElement> el)
+ remove(<HTMLElement> el)
Removes el from its parent element
- empty(<HTMLElement> el)
+ empty(<HTMLElement> el)
Removes all of el's children elements from el
- toFront(<HTMLElement> el)
+ toFront(<HTMLElement> el)
Makes el the last child of its parent, so it renders in front of the other children.
- toBack(<HTMLElement> el)
+ toBack(<HTMLElement> el)
Makes el the first child of its parent, so it renders behind the other children.
- hasClass(<HTMLElement> el, <String> name)
+ hasClass(<HTMLElement> el, <String> name)
Boolean
Returns true if the element's class attribute contains name.
- addClass(<HTMLElement> el, <String> name)
+ addClass(<HTMLElement> el, <String> name)
Adds name to the element's class attribute.
- removeClass(<HTMLElement> el, <String> name)
+ removeClass(<HTMLElement> el, <String> name)
Removes name from the element's class attribute.
- setClass(<HTMLElement> el, <String> name)
+ setClass(<HTMLElement> el, <String> name)
Sets the element's class.
- getClass(<HTMLElement> el)
+ getClass(<HTMLElement> el)
String
Returns the element's class.
- setOpacity(<HTMLElement> el, <Number> opacity)
+ setOpacity(<HTMLElement> el, <Number> opacity)
Set the opacity of an element (including old IE support).
opacity must be a number from 0 to 1.
- testProp(<String[]> props)
+ testProp(<String[]> props)
String|false
Goes through the array of style names and returns the first name
that is a valid style name for an element. If no such name is found,
it returns false. Useful for vendor-prefixed styles like transform.
- setTransform(<HTMLElement> el, <Point> offset, <Number> scale?)
+ setTransform(<HTMLElement> el, <Point> offset, <Number> scale?)
Resets the 3D CSS transform of el so it is translated by offset pixels
and optionally scaled by scale. Does not have an effect if the
browser doesn't support 3D CSS transforms.
- setPosition(<HTMLElement> el, <Point> position)
+ setPosition(<HTMLElement> el, <Point> position)
Sets the position of el to coordinates specified by position,
using CSS translate or top/left positioning depending on the browser
(used by Leaflet internally to position its layers).
- getPosition(<HTMLElement> el)
+ getPosition(<HTMLElement> el)
Point
Returns the coordinates of an element previously positioned with setPosition.
- disableTextSelection()
+ disableTextSelection()
Prevents the user from generating selectstart DOM events, usually generated
when the user drags the mouse through a page with text. Used internally
@@ -20066,23 +20137,23 @@ Functions
the map. Affects drag interactions on the whole document.
- enableTextSelection()
+ enableTextSelection()
Cancels the effects of a previous L.DomUtil.disableTextSelection.
- disableImageDrag()
+ disableImageDrag()
As L.DomUtil.disableTextSelection, but
for dragstart DOM events, usually generated when the user drags an image.
- enableImageDrag()
+ enableImageDrag()
Cancels the effects of a previous L.DomUtil.disableImageDrag.
- preventOutline(<HTMLElement> el)
+ preventOutline(<HTMLElement> el)
Makes the outline
of the element el invisible. Used internally by Leaflet to prevent
@@ -20090,17 +20161,17 @@ Functions
drag interaction on them.
- restoreOutline()
+ restoreOutline()
Cancels the effects of a previous L.DomUtil.preventOutline.
- getSizedParentNode(<HTMLElement> el)
+ getSizedParentNode(<HTMLElement> el)
HTMLElement
Finds the closest parent node which size (width and height) is not null.
- getScale(<HTMLElement> el)
+ getScale(<HTMLElement> el)
Object
Computes the CSS scale currently applied on the element.
Returns an object with x and y members as horizontal and vertical scales respectively,
@@ -20127,17 +20198,17 @@ Properties
- TRANSFORM
+ TRANSFORM
String
Vendor-prefixed transform style name (e.g. 'webkitTransform' for WebKit).
- TRANSITION
+ TRANSITION
String
Vendor-prefixed transition style name.
- TRANSITION_END
+ TRANSITION_END
String
Vendor-prefixed transitionend event name.
@@ -20181,7 +20252,7 @@ Constructor
- L.PosAnimation()
+ L.PosAnimation()
Creates a PosAnimation object.
@@ -20206,17 +20277,17 @@ Events
- start
+ start
Event
Fired when the animation starts
- step
+ step
Event
Fired continuously during the animation.
- end
+ end
Event
Fired when the animation ends.
@@ -20241,7 +20312,7 @@ Methods
- run(<HTMLElement> el, <Point> newPos, <Number> duration?, <Number> easeLinearity?)
+ run(<HTMLElement> el, <Point> newPos, <Number> duration?, <Number> easeLinearity?)
Run an animation of a given element to a new position, optionally setting
duration in seconds (0.25 by default) and easing linearity factor (3rd
@@ -20250,7 +20321,7 @@
Methods
- stop()
+ stop()
Stops the animation (if currently running).
@@ -20276,37 +20347,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -20314,61 +20385,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -20416,7 +20487,7 @@ Constructor
- L.Draggable(<HTMLElement> el, <HTMLElement> dragHandle?, <Boolean> preventOutline?, <Draggable options> options?)
+ L.Draggable(<HTMLElement> el, <HTMLElement> dragHandle?, <Boolean> preventOutline?, <Draggable options> options?)
Creates a Draggable object for moving el when you start dragging the dragHandle element (equals el itself by default).
@@ -20443,7 +20514,7 @@ Options
clickTolerance
- Number
+ Number
3
The max number of pixels a user can shift the mouse pointer during a click
for it to be considered a valid click (as opposed to a mouse drag).
@@ -20469,28 +20540,28 @@ Events
- down
+ down
Event
Fired when a drag is about to start.
- dragstart
+ dragstart
Event
Fired when a drag starts
- predrag
+ predrag
Event
Fired continuously during dragging before each corresponding
update of the element's position.
- drag
+ drag
Event
Fired continuously during dragging.
- dragend
+ dragend
DragEndEvent
Fired when the drag ends.
@@ -20515,13 +20586,13 @@ Methods
- enable()
+ enable()
Enables the dragging ability
- disable()
+ disable()
Disables the dragging ability
@@ -20547,37 +20618,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -20585,61 +20656,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -20849,23 +20920,23 @@ Functions
- extend(<Object> props)
+ extend(<Object> props)
Function
Extends the current class given the properties to be included.
Returns a Javascript function that is a class constructor (to be called with new).
- include(<Object> properties)
+ include(<Object> properties)
this
Includes a mixin into the current class.
- mergeOptions(<Object> options)
+ mergeOptions(<Object> options)
this
Merges options into the defaults of the class.
- addInitHook(<Function> fn)
+ addInitHook(<Function> fn)
this
Adds a constructor hook to the class.
@@ -20916,37 +20987,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -20954,61 +21025,61 @@
Methods
- listens(<String> type)
+ listens(<String> type, <Boolean> propagate?)
Boolean
- Returns true if a particular event type has any listeners attached to it.
+ Returns true if a particular event type has any listeners attached to it. The verification can optionally be propagated, it will return true if parents have the listener attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -21058,13 +21129,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -21089,12 +21160,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -21113,12 +21184,12 @@ Popup events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -21137,12 +21208,12 @@ Tooltip events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -21168,31 +21239,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -21213,31 +21284,31 @@ Extension methods
- onAdd(<Map> map)
+ onAdd(<Map> map)
this
Should contain code that creates DOM elements for the layer, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).
- onRemove(<Map> map)
+ onRemove(<Map> map)
this
Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- getEvents()
+ getEvents()
Object
This optional method should return an object like { viewreset: this._reset } for addEventListener. The event handlers in this object will be automatically added and removed from the map with your layer.
- getAttribution()
+ getAttribution()
String
This optional method should return a string containing HTML to be shown on the Attribution control whenever the layer is visible.
- beforeAdd(<Map> map)
+ beforeAdd(<Map> map)
this
Optional method. Called on map.addLayer(layer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
@@ -21263,7 +21334,7 @@ Popup methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -21271,43 +21342,43 @@
Popup methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -21332,7 +21403,7 @@ Tooltip methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -21340,43 +21411,43 @@
Tooltip methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -21402,37 +21473,37 @@ Tooltip methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -21440,61 +21511,61 @@
Tooltip methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -21527,13 +21598,13 @@ Options
interactive
- Boolean
+ Boolean
true
If false, the layer will not emit mouse events and will act as a part of the underlying map.
bubblingMouseEvents
- Boolean
+ Boolean
true
When true, a mouse event on this layer will trigger the same event on the map
(unless L.DomEvent.stopPropagation is used).
@@ -21561,13 +21632,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -21593,37 +21664,37 @@ Mouse events
- click
+ click
MouseEvent
Fired when the user clicks (or taps) the layer.
- dblclick
+ dblclick
MouseEvent
Fired when the user double-clicks (or double-taps) the layer.
- mousedown
+ mousedown
MouseEvent
Fired when the user pushes the mouse button on the layer.
- mouseup
+ mouseup
MouseEvent
Fired when the user releases the mouse button pushed on the layer.
- mouseover
+ mouseover
MouseEvent
Fired when the mouse enters the layer.
- mouseout
+ mouseout
MouseEvent
Fired when the mouse leaves the layer.
- contextmenu
+ contextmenu
MouseEvent
Fired when the user right-clicks on the layer, prevents
default browser context menu from showing if there are listeners on
@@ -21651,12 +21722,12 @@ Mouse events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -21682,12 +21753,12 @@ Mouse events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -21713,12 +21784,12 @@ Mouse events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -21750,31 +21821,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -21801,7 +21872,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -21809,43 +21880,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -21872,7 +21943,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -21880,43 +21951,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -21943,37 +22014,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -21981,61 +22052,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -22067,7 +22138,7 @@ Options
position
- String
+ String
'topright'
The position of the control (one of the map corners). Possible values are 'topleft',
'topright', 'bottomleft' or 'bottomright'
@@ -22094,31 +22165,31 @@ Methods
- getPosition()
+ getPosition()
string
Returns the position of the control.
- setPosition(<string> position)
+ setPosition(<string> position)
this
Sets the position of the control.
- getContainer()
+ getContainer()
HTMLElement
Returns the HTMLElement that contains the control.
- addTo(<Map> map)
+ addTo(<Map> map)
this
Adds the control to the given map.
- remove()
+ remove()
this
Removes the control from the map it is currently active on.
@@ -22139,13 +22210,13 @@ Extension methods
- onAdd(<Map> map)
+ onAdd(<Map> map)
HTMLElement
Should return the container DOM element for the control and add listeners on relevant map events. Called on control.addTo(map).
- onRemove(<Map> map)
+ onRemove(<Map> map)
Optional method. Should contain all clean up code that removes the listeners previously added in onAdd. Called on control.remove().
@@ -22173,19 +22244,19 @@ Methods
- enable()
+ enable()
this
Enables the handler
- disable()
+ disable()
this
Disables the handler
- enabled()
+ enabled()
Boolean
Returns true if the handler is enabled
@@ -22206,13 +22277,13 @@ Extension methods
- addHooks()
+ addHooks()
Called when the handler is enabled, should add event hooks.
- removeHooks()
+ removeHooks()
Called when the handler is disabled, should remove the event hooks added previously.
@@ -22238,7 +22309,7 @@
- addTo(<Map> map, <String> name)
+ addTo(<Map> map, <String> name)
this
Adds a new Handler to the given map with the given name.
@@ -22266,14 +22337,14 @@ Methods
- project(<LatLng> latlng)
+ project(<LatLng> latlng)
Point
Projects geographical coordinates into a 2D point.
Only accepts actual L.LatLng instances, not arrays.
- unproject(<Point> point)
+ unproject(<Point> point)
LatLng
The inverse of project. Projects a 2D point into a geographical location.
Only accepts actual L.Point instances, not arrays.
@@ -22303,7 +22374,7 @@
Properties
- bounds
+ bounds
Bounds
The bounds (specified in CRS units) where the projection is valid
@@ -22366,34 +22437,34 @@ Methods
- latLngToPoint(<LatLng> latlng, <Number> zoom)
+ latLngToPoint(<LatLng> latlng, <Number> zoom)
Point
Projects geographical coordinates into pixel coordinates for a given zoom.
- pointToLatLng(<Point> point, <Number> zoom)
+ pointToLatLng(<Point> point, <Number> zoom)
LatLng
The inverse of latLngToPoint. Projects pixel coordinates on a given
zoom into geographical coordinates.
- project(<LatLng> latlng)
+ project(<LatLng> latlng)
Point
Projects geographical coordinates into coordinates in units accepted for
this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
- unproject(<Point> point)
+ unproject(<Point> point)
LatLng
Given a projected coordinate returns the corresponding LatLng.
The inverse of project.
- scale(<Number> zoom)
+ scale(<Number> zoom)
Number
Returns the scale used when transforming projected coordinates into
pixel coordinates for a particular zoom. For example, it returns
@@ -22401,33 +22472,33 @@
Methods
- zoom(<Number> scale)
+ zoom(<Number> scale)
Number
Inverse of scale(), returns the zoom level corresponding to a scale
factor of scale.
- getProjectedBounds(<Number> zoom)
+ getProjectedBounds(<Number> zoom)
Bounds
Returns the projection's bounds scaled and transformed for the provided zoom.
- distance(<LatLng> latlng1, <LatLng> latlng2)
+ distance(<LatLng> latlng1, <LatLng> latlng2)
Number
Returns the distance between two geographical coordinates.
- wrapLatLng(<LatLng> latlng)
+ wrapLatLng(<LatLng> latlng)
LatLng
Returns a LatLng where lat and lng has been wrapped according to the
CRS's wrapLat and wrapLng properties, if they are outside the CRS's bounds.
- wrapLatLngBounds(<LatLngBounds> bounds)
+ wrapLatLngBounds(<LatLngBounds> bounds)
LatLngBounds
Returns a LatLngBounds with the same size as the given one, ensuring
that its center is within the CRS's bounds.
@@ -22455,24 +22526,24 @@
Properties
- code
+ code
String
Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857')
- wrapLng
+ wrapLng
Number[]
An array of two numbers defining whether the longitude (horizontal) coordinate
axis wraps around a given range and how. Defaults to [-180, 180] in most
geographical CRSs. If undefined, the longitude axis does not wrap around.
- wrapLat
+ wrapLat
Number[]
Like wrapLng, but for the latitude (vertical) axis.
- infinite
+ infinite
Boolean
If true, the coordinate space will be unbounded (infinite in both axes)
@@ -22572,14 +22643,14 @@ Options
padding
- Number
+ Number
0.1
How much to extend the clip area around the map view (relative to its size)
e.g. 0.1 would be 10% of map view in each direction
tolerance
- Number
+ Number
0
How much to extend click tolerance round a path/object on the map
@@ -22606,13 +22677,13 @@ Options
pane
- String
+ String
'overlayPane'
By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -22638,7 +22709,7 @@ Events
- update
+ update
Event
Fired when the renderer updates its bounds, center and zoom, for example when
its map has moved
@@ -22664,12 +22735,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -22695,12 +22766,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -22726,12 +22797,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -22763,31 +22834,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -22814,7 +22885,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -22822,43 +22893,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -22885,7 +22956,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -22893,43 +22964,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -22956,37 +23027,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -22994,61 +23065,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -23087,30 +23158,30 @@ Event
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23137,7 +23208,7 @@ KeyboardEvent
- originalEvent
+ originalEvent
DOMEvent
The original DOM KeyboardEvent that triggered this Leaflet event.
@@ -23162,30 +23233,30 @@ KeyboardEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23213,22 +23284,22 @@ MouseEvent
- latlng
+ latlng
LatLng
The geographical point where the mouse event occured.
- layerPoint
+ layerPoint
Point
Pixel coordinates of the point where the mouse event occured relative to the map layer.
- containerPoint
+ containerPoint
Point
Pixel coordinates of the point where the mouse event occured relative to the map сontainer.
- originalEvent
+ originalEvent
DOMEvent
The original DOM MouseEvent or DOM TouchEvent that triggered this Leaflet event.
@@ -23253,30 +23324,30 @@ MouseEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23304,42 +23375,42 @@ LocationEvent
- latlng
+ latlng
LatLng
Detected geographical location of the user.
- bounds
+ bounds
LatLngBounds
Geographical bounds of the area user is located in (with respect to the accuracy of location).
- accuracy
+ accuracy
Number
Accuracy of location in meters.
- altitude
+ altitude
Number
Height of the position above the WGS84 ellipsoid in meters.
- altitudeAccuracy
+ altitudeAccuracy
Number
Accuracy of altitude in meters.
- heading
+ heading
Number
The direction of travel in degrees counting clockwise from true North.
- speed
+ speed
Number
Current velocity in meters per second.
- timestamp
+ timestamp
Number
The time when the position was acquired.
@@ -23364,30 +23435,30 @@ LocationEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23415,12 +23486,12 @@ ErrorEvent
- message
+ message
String
Error message.
- code
+ code
Number
Error code (if applicable).
@@ -23445,30 +23516,30 @@ ErrorEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23496,7 +23567,7 @@ LayerEvent
- layer
+ layer
Layer
The layer that was added or removed.
@@ -23521,24 +23592,24 @@ LayerEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
@@ -23567,12 +23638,12 @@ LayersControlEvent
- layer
+ layer
Layer
The layer that was added or removed.
- name
+ name
String
The name of the layer that was added or removed.
@@ -23597,24 +23668,24 @@ LayersControlEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
@@ -23643,12 +23714,12 @@ TileEvent
- tile
+ tile
HTMLElement
The tile element (image).
- coords
+ coords
Point
Point object with the tile's x, y, and z (zoom level) coordinates.
@@ -23673,30 +23744,30 @@ TileEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23724,17 +23795,17 @@ TileErrorEvent
- tile
+ tile
HTMLElement
The tile element (image).
- coords
+ coords
Point
Point object with the tile's x, y, and z (zoom level) coordinates.
- error
+ error
*
Error passed to the tile's done() callback.
@@ -23759,30 +23830,30 @@ TileErrorEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23810,12 +23881,12 @@ ResizeEvent
- oldSize
+ oldSize
Point
The old size before resize event.
- newSize
+ newSize
Point
The new size after the resize event.
@@ -23840,30 +23911,30 @@ ResizeEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -23891,22 +23962,22 @@ GeoJSONEvent
- layer
+ layer
Layer
The layer for the GeoJSON feature that is being added to the map.
- properties
+ properties
Object
GeoJSON properties of the feature.
- geometryType
+ geometryType
String
GeoJSON geometry type of the feature.
- id
+ id
String
GeoJSON ID of the feature (if present).
@@ -23931,24 +24002,24 @@ GeoJSONEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
@@ -23977,7 +24048,7 @@ PopupEvent
- popup
+ popup
Popup
The popup that was opened or closed.
@@ -24002,30 +24073,30 @@ PopupEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -24053,7 +24124,7 @@ TooltipEvent
- tooltip
+ tooltip
Tooltip
The tooltip that was opened or closed.
@@ -24078,30 +24149,30 @@ TooltipEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -24129,7 +24200,7 @@ DragEndEvent
- distance
+ distance
Number
The distance in pixels the draggable element was moved by.
@@ -24154,30 +24225,30 @@ DragEndEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -24205,17 +24276,17 @@ ZoomAnimEvent
- center
+ center
LatLng
The current center of the map
- zoom
+ zoom
Number
The current zoom level of the map
- noUpdate
+ noUpdate
Boolean
Whether layers should update their contents due to this event
@@ -24240,30 +24311,30 @@ ZoomAnimEvent
- type
+ type
String
The event type (e.g. 'click').
- target
+ target
Object
The object that fired the event. For propagated events, the last object in
the propagation chain that fired the event.
- sourceTarget
+ sourceTarget
Object
The object that originally fired the event. For non-propagated events, this will
be the same as the target.
- propagatedFrom
+ propagatedFrom
Object
For propagated events, the last object that propagated the event to its
event parent.
- layer
+ layer
Object
Deprecated. The same as propagatedFrom.
@@ -24293,20 +24364,20 @@ Options
offset
- Point
+ Point
Point(0, 7)
The offset of the popup position. Useful to control the anchor
of the popup when opening it on some overlays.
className
- String
+ String
''
A custom CSS class name to assign to the popup.
pane
- String
+ String
'popupPane'
Map pane where the popup will be added.
@@ -24333,7 +24404,7 @@ Options
attribution
- String
+ String
null
String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
@@ -24365,12 +24436,12 @@ Events
- add
+ add
Event
Fired after the layer is added to a map
- remove
+ remove
Event
Fired after the layer is removed from a map
@@ -24396,12 +24467,12 @@ Events
- popupopen
+ popupopen
PopupEvent
Fired when a popup bound to this layer is opened
- popupclose
+ popupclose
PopupEvent
Fired when a popup bound to this layer is closed
@@ -24427,12 +24498,12 @@ Events
- tooltipopen
+ tooltipopen
TooltipEvent
Fired when a tooltip bound to this layer is opened.
- tooltipclose
+ tooltipclose
TooltipEvent
Fired when a tooltip bound to this layer is closed.
@@ -24464,31 +24535,31 @@ Methods
- addTo(<Map|LayerGroup> map)
+ addTo(<Map|LayerGroup> map)
this
Adds the layer to the given map or layer group.
- remove()
+ remove()
this
Removes the layer from the map it is currently active on.
- removeFrom(<Map> map)
+ removeFrom(<Map> map)
this
Removes the layer from the given map
- getPane(<String> name?)
+ getPane(<String> name?)
HTMLElement
Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
- getAttribution()
+ getAttribution()
String
Used by the attribution control, returns the attribution option.
@@ -24515,7 +24586,7 @@ Methods
- bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
this
Binds a popup to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -24523,43 +24594,43 @@
Methods
- unbindPopup()
+ unbindPopup()
this
Removes the popup previously bound with bindPopup.
- openPopup(<LatLng> latlng?)
+ openPopup(<LatLng> latlng?)
this
Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
- closePopup()
+ closePopup()
this
Closes the popup bound to this layer if it is open.
- togglePopup()
+ togglePopup()
this
Opens or closes the popup bound to this layer depending on its current state.
- isPopupOpen()
+ isPopupOpen()
boolean
Returns true if the popup bound to this layer is currently open.
- setPopupContent(<String|HTMLElement|Popup> content)
+ setPopupContent(<String|HTMLElement|Popup> content)
this
Sets the content of the popup bound to this layer.
- getPopup()
+ getPopup()
Popup
Returns the popup bound to this layer.
@@ -24586,7 +24657,7 @@ Methods
- bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
this
Binds a tooltip to the layer with the passed content and sets up the
necessary event listeners. If a Function is passed it will receive
@@ -24594,43 +24665,43 @@
Methods
- unbindTooltip()
+ unbindTooltip()
this
Removes the tooltip previously bound with bindTooltip.
- openTooltip(<LatLng> latlng?)
+ openTooltip(<LatLng> latlng?)
this
Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
- closeTooltip()
+ closeTooltip()
this
Closes the tooltip bound to this layer if it is open.
- toggleTooltip()
+ toggleTooltip()
this
Opens or closes the tooltip bound to this layer depending on its current state.
- isTooltipOpen()
+ isTooltipOpen()
boolean
Returns true if the tooltip bound to this layer is currently open.
- setTooltipContent(<String|HTMLElement|Tooltip> content)
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
this
Sets the content of the tooltip bound to this layer.
- getTooltip()
+ getTooltip()
Tooltip
Returns the tooltip bound to this layer.
@@ -24657,37 +24728,37 @@ Methods
- on(<String> type, <Function> fn, <Object> context?)
+ on(<String> type, <Function> fn, <Object> context?)
this
Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
- on(<Object> eventMap)
+ on(<Object> eventMap)
this
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- off(<String> type, <Function> fn?, <Object> context?)
+ off(<String> type, <Function> fn?, <Object> context?)
this
Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
- off(<Object> eventMap)
+ off(<Object> eventMap)
this
Removes a set of type/listener pairs.
- off()
+ off()
this
Removes all listeners to all events on the object. This includes implicitly attached events.
- fire(<String> type, <Object> data?, <Boolean> propagate?)
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
this
Fires an event of the specified type. You can optionally provide an data
object — the first argument of the listener function will contain its
@@ -24695,61 +24766,61 @@
Methods
- listens(<String> type)
+ listens(<String> type)
Boolean
Returns true if a particular event type has any listeners attached to it.
- once(…)
+ once(…)
this
Behaves as on(…), except the listener will only get fired once and then removed.
- addEventParent(<Evented> obj)
+ addEventParent(<Evented> obj)
this
Adds an event parent - an Evented that will receive propagated events
- removeEventParent(<Evented> obj)
+ removeEventParent(<Evented> obj)
this
Removes an event parent, so it will stop receiving propagated events
- addEventListener(…)
+ addEventListener(…)
this
Alias to on(…)
- removeEventListener(…)
+ removeEventListener(…)
this
Alias to off(…)
- clearAllEventListeners(…)
+ clearAllEventListeners(…)
this
Alias to off()
- addOneTimeEventListener(…)
+ addOneTimeEventListener(…)
this
Alias to once(…)
- fireEvent(…)
+ fireEvent(…)
this
Alias to fire(…)
- hasEventListeners(…)
+ hasEventListeners(…)
Boolean
Alias to listens(…)
@@ -24802,3 +24873,14 @@ noConflict
This method restores the L gl
version
A constant that represents the Leaflet version in use.
L.version; // contains "1.0.0" (or whatever version is currently in use)
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/reference-1.7.1.html b/docs/reference-1.7.1.html
new file mode 100644
index 00000000000..87fbc08f2ba
--- /dev/null
+++ b/docs/reference-1.7.1.html
@@ -0,0 +1,4 @@
+---
+layout: redirected
+redirect_to: reference.html
+---
diff --git a/docs/reference-versions.html b/docs/reference-versions.html
index ccb298147b3..a99a7833adc 100644
--- a/docs/reference-versions.html
+++ b/docs/reference-versions.html
@@ -10,14 +10,12 @@ Available API References
- API reference for 0.7.x
-
- API reference for 1.0.0 and 1.0.1
-
- API reference for 1.0.2
- API reference for 1.0.3
- API reference for 1.1.0
- API reference for 1.2.0
-
- API reference for 1.3.0 and 1.3.1
-
- API reference for 1.3.2 and 1.3.3
- API reference for 1.3.4
- API reference for 1.4.0
-
- API reference for 1.5.0 and 1.5.1
+
- API reference for 1.5.1
+
- API reference for 1.6.0
+
- API reference for 1.7.1
diff --git a/docs/reference.html b/docs/reference.html
index e04f2807c03..b83b5efce2c 100644
--- a/docs/reference.html
+++ b/docs/reference.html
@@ -1,4 +1,25068 @@
---
-layout: redirected
-redirect_to: reference-1.5.0.html
----
\ No newline at end of file
+layout: v2
+title: Documentation
+bodyclass: api-page
+---
+
+Leaflet API reference
+
+This reference reflects Leaflet 1.7.1. Check this list if you are using a different version of Leaflet.
+
+
+
+ Map
+
+ - Usage example
+ - Creation
+ - Options
+ - Events
+
+ Map Methods
+
+ - Modifying map state
+ - Getting map state
+ - Layers and controls
+ - Conversion methods
+ - Other methods
+
+ Map Misc
+
+ - Properties
+ - Panes
+
+
+
+ UI Layers
+
+ Raster Layers
+
+ - TileLayer
+ - TileLayer.WMS
+ - ImageOverlay
+ - VideoOverlay
+
+ Vector Layers
+
+ - Path
+ - Polyline
+ - Polygon
+ - Rectangle
+ - Circle
+ - CircleMarker
+ - SVGOverlay
+ - SVG
+ - Canvas
+
+
+
+ Other Layers
+
+ - LayerGroup
+ - FeatureGroup
+ - GeoJSON
+ - GridLayer
+
+ Basic Types
+
+ Controls
+
+ - Zoom
+ - Attribution
+ - Layers
+ - Scale
+
+
+
+
+
+
+
+
+
+ Utility
+
+ - Browser
+ - Util
+ - Transformation
+ - LineUtil
+ - PolyUtil
+
+ DOM Utility
+
+ - DomEvent
+ - DomUtil
+ - PosAnimation
+ - Draggable
+
+
+
+ Base Classes
+
+ - Class
+ - Evented
+ - Layer
+ - Interactive layer
+ - Control
+ - Handler
+
+ - Projection
+ - CRS
+ - Renderer
+
+
+ Misc
+
+ - Event objects
+ - global switches
+ - noConflict
+ - version
+
+
+
+
+ Map
The central class of the API — it is used to create a map on a page and manipulate it.
+
+
+Usage example
+
+
+
+
+
+
+
+// initialize the map on the "map" div with a given center and zoom
+var map = L.map('map', {
+ center: [51.505, -0.09],
+ zoom: 13
+});
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.map(<String> id, <Map options> options?)
+ Instantiates a map object given the DOM ID of a <div> element
+and optionally an object literal with Map options.
+
+
+ L.map(<HTMLElement> el, <Map options> options?)
+ Instantiates a map object given an instance of a <div> HTML element
+and optionally an object literal with Map options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ preferCanvas
+ Boolean
+ false
+ Whether Paths should be rendered on a Canvas renderer.
+By default, all Paths are rendered in a SVG renderer.
+
+
+
+
+
+Control options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attributionControl
+ Boolean
+ true
+ Whether a attribution control is added to the map by default.
+
+
+ zoomControl
+ Boolean
+ true
+ Whether a zoom control is added to the map by default.
+
+
+
+
+
+Interaction Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ closePopupOnClick
+ Boolean
+ true
+ Set it to false if you don't want popups to close when user clicks the map.
+
+
+ zoomSnap
+ Number
+ 1
+ Forces the map's zoom level to always be a multiple of this, particularly
+right after a fitBounds() or a pinch-zoom.
+By default, the zoom level snaps to the nearest integer; lower values
+(e.g. 0.5 or 0.1) allow for greater granularity. A value of 0
+means the zoom level will not be snapped after fitBounds or a pinch-zoom.
+
+
+ zoomDelta
+ Number
+ 1
+ Controls how much the map's zoom level will change after a
+zoomIn(), zoomOut(), pressing +
+or - on the keyboard, or using the zoom controls.
+Values smaller than 1 (e.g. 0.5) allow for greater granularity.
+
+
+ trackResize
+ Boolean
+ true
+ Whether the map automatically handles browser window resize to update itself.
+
+
+ boxZoom
+ Boolean
+ true
+ Whether the map can be zoomed to a rectangular area specified by
+dragging the mouse while pressing the shift key.
+
+
+ doubleClickZoom
+ Boolean|String
+ true
+ Whether the map can be zoomed in by double clicking on it and
+zoomed out by double clicking while holding shift. If passed
+'center', double-click zoom will zoom to the center of the
+view regardless of where the mouse was.
+
+
+ dragging
+ Boolean
+ true
+ Whether the map be draggable with mouse/touch or not.
+
+
+
+
+
+Map State Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ crs
+ CRS
+ L.CRS.EPSG3857
+ The Coordinate Reference System to use. Don't change this if you're not
+sure what it means.
+
+
+ center
+ LatLng
+ undefined
+ Initial geographic center of the map
+
+
+ zoom
+ Number
+ undefined
+ Initial map zoom level
+
+
+ minZoom
+ Number
+ *
+ Minimum zoom level of the map.
+If not specified and at least one GridLayer or TileLayer is in the map,
+the lowest of their minZoom options will be used instead.
+
+
+ maxZoom
+ Number
+ *
+ Maximum zoom level of the map.
+If not specified and at least one GridLayer or TileLayer is in the map,
+the highest of their maxZoom options will be used instead.
+
+
+ layers
+ Layer[]
+ []
+ Array of layers that will be added to the map initially
+
+
+ maxBounds
+ LatLngBounds
+ null
+ When this option is set, the map restricts the view to the given
+geographical bounds, bouncing the user back if the user tries to pan
+outside the view. To set the restriction dynamically, use
+setMaxBounds method.
+
+
+ renderer
+ Renderer
+ *
+ The default method for drawing vector layers on the map. L.SVG
+or L.Canvas by default depending on browser support.
+
+
+
+
+
+Animation Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ zoomAnimation
+ Boolean
+ true
+ Whether the map zoom animation is enabled. By default it's enabled
+in all browsers that support CSS3 Transitions except Android.
+
+
+ zoomAnimationThreshold
+ Number
+ 4
+ Won't animate zoom if the zoom difference exceeds this value.
+
+
+ fadeAnimation
+ Boolean
+ true
+ Whether the tile fade animation is enabled. By default it's enabled
+in all browsers that support CSS3 Transitions except Android.
+
+
+ markerZoomAnimation
+ Boolean
+ true
+ Whether markers animate their zoom with the zoom animation, if disabled
+they will disappear for the length of the animation. By default it's
+enabled in all browsers that support CSS3 Transitions except Android.
+
+
+ transform3DLimit
+ Number
+ 2^23
+ Defines the maximum size of a CSS translation transform. The default
+value should not be changed unless a web browser positions layers in
+the wrong place after doing a large panBy.
+
+
+
+
+
+Panning Inertia Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ inertia
+ Boolean
+ *
+ If enabled, panning of the map will have an inertia effect where
+the map builds momentum while dragging and continues moving in
+the same direction for some time. Feels especially nice on touch
+devices. Enabled by default unless running on old Android devices.
+
+
+ inertiaDeceleration
+ Number
+ 3000
+ The rate with which the inertial movement slows down, in pixels/second².
+
+
+ inertiaMaxSpeed
+ Number
+ Infinity
+ Max speed of the inertial movement, in pixels/second.
+
+
+ easeLinearity
+ Number
+ 0.2
+
+
+
+ worldCopyJump
+ Boolean
+ false
+ With this option enabled, the map tracks when you pan to another "copy"
+of the world and seamlessly jumps to the original one so that all overlays
+like markers and vector layers are still visible.
+
+
+ maxBoundsViscosity
+ Number
+ 0.0
+ If maxBounds is set, this option will control how solid the bounds
+are when dragging the map around. The default value of 0.0 allows the
+user to drag outside the bounds at normal speed, higher values will
+slow down map dragging outside bounds, and 1.0 makes the bounds fully
+solid, preventing the user from dragging outside the bounds.
+
+
+
+
+
+Keyboard Navigation Options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ keyboard
+ Boolean
+ true
+ Makes the map focusable and allows users to navigate the map with keyboard
+arrows and +/- keys.
+
+
+ keyboardPanDelta
+ Number
+ 80
+ Amount of pixels to pan when pressing an arrow key.
+
+
+
+
+
+Mouse wheel options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ scrollWheelZoom
+ Boolean|String
+ true
+ Whether the map can be zoomed by using the mouse wheel. If passed 'center',
+it will zoom to the center of the view regardless of where the mouse was.
+
+
+ wheelDebounceTime
+ Number
+ 40
+ Limits the rate at which a wheel can fire (in milliseconds). By default
+user can't zoom via wheel more often than once per 40 ms.
+
+
+ wheelPxPerZoomLevel
+ Number
+ 60
+ How many scroll pixels (as reported by L.DomEvent.getWheelDelta)
+mean a change of one full zoom level. Smaller values will make wheel-zooming
+faster (and vice versa).
+
+
+
+
+
+Touch interaction options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tap
+ Boolean
+ true
+ Enables mobile hacks for supporting instant taps (fixing 200ms click
+delay on iOS/Android) and touch holds (fired as contextmenu events).
+
+
+ tapTolerance
+ Number
+ 15
+ The max number of pixels a user can shift his finger during touch
+for it to be considered a valid tap.
+
+
+ touchZoom
+ Boolean|String
+ *
+ Whether the map can be zoomed by touch-dragging with two fingers. If
+passed 'center', it will zoom to the center of the view regardless of
+where the touch events (fingers) were. Enabled for touch-capable web
+browsers except for old Androids.
+
+
+ bounceAtZoomLimits
+ Boolean
+ true
+ Set it to false if you don't want the map to zoom beyond min/max zoom
+and then bounce back when pinch-zooming.
+
+
+
+
+
+
+
+Events
+
+
+
+Layer events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ baselayerchange
+ LayersControlEvent
+ Fired when the base layer is changed through the layers control.
+
+
+ overlayadd
+ LayersControlEvent
+ Fired when an overlay is selected through the layers control.
+
+
+ overlayremove
+ LayersControlEvent
+ Fired when an overlay is deselected through the layers control.
+
+
+ layeradd
+ LayerEvent
+ Fired when a new layer is added to the map.
+
+
+ layerremove
+ LayerEvent
+ Fired when some layer is removed from the map
+
+
+
+
+
+Map state change events
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ zoomlevelschange
+ Event
+ Fired when the number of zoomlevels on the map is changed due
+to adding or removing a layer.
+
+
+ resize
+ ResizeEvent
+ Fired when the map is resized.
+
+
+ unload
+ Event
+ Fired when the map is destroyed with remove method.
+
+
+ viewreset
+ Event
+ Fired when the map needs to redraw its content (this usually happens
+on map zoom or load). Very useful for creating custom overlays.
+
+
+ load
+ Event
+ Fired when the map is initialized (when its center and zoom are set
+for the first time).
+
+
+ zoomstart
+ Event
+ Fired when the map zoom is about to change (e.g. before zoom animation).
+
+
+ movestart
+ Event
+ Fired when the view of the map starts changing (e.g. user starts dragging the map).
+
+
+ zoom
+ Event
+ Fired repeatedly during any change in zoom level, including zoom
+and fly animations.
+
+
+ move
+ Event
+ Fired repeatedly during any movement of the map, including pan and
+fly animations.
+
+
+ zoomend
+ Event
+ Fired when the map zoom has changed, after any animations.
+
+
+ moveend
+ Event
+ Fired when the center of the map stops changing (e.g. user stopped dragging the map or when a non-centered zoom ends).
+
+
+
+
+
+Popup events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup is opened in the map
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup in the map is closed
+
+
+ autopanstart
+ Event
+ Fired when the map starts autopanning when opening a popup.
+
+
+
+
+
+Tooltip events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip is opened in the map.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip in the map is closed.
+
+
+
+
+
+Location events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ locationerror
+ ErrorEvent
+ Fired when geolocation (using the locate method) failed.
+
+
+ locationfound
+ LocationEvent
+ Fired when geolocation (using the locate method)
+went successfully.
+
+
+
+
+
+Interaction events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the map.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the map.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the map.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button on the map.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the map.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the map.
+
+
+ mousemove
+ MouseEvent
+ Fired while the mouse moves over the map.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user pushes the right mouse button on the map, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+ keypress
+ KeyboardEvent
+ Fired when the user presses a key from the keyboard that produces a character value while the map is focused.
+
+
+ keydown
+ KeyboardEvent
+ Fired when the user presses a key from the keyboard while the map is focused. Unlike the keypress event,
+the keydown event is fired for keys that produce a character value and for keys
+that do not produce a character value.
+
+
+ keyup
+ KeyboardEvent
+ Fired when the user releases a key from the keyboard while the map is focused.
+
+
+ preclick
+ MouseEvent
+ Fired before mouse click on the map (sometimes useful when you
+want something to happen on click before any existing click
+handlers start running).
+
+
+
+
+
+Other Events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ zoomanim
+ ZoomAnimEvent
+ Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getRenderer(<Path> layer)
+ Renderer
+ Returns the instance of Renderer that should be used to render the given
+Path. It will ensure that the renderer options of the map and paths
+are respected, and that the renderers do exist on the map.
+
+
+
+
+
+
+Methods for Layers and Controls
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addControl(<Control> control)
+ this
+ Adds the given control to the map
+
+
+
+ removeControl(<Control> control)
+ this
+ Removes the given control from the map
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the map
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the map.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the map
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the map, optionally specifying context of the iterator function.
+map.eachLayer(function(layer){
+ layer.bindPopup('Hello');
+});
+
+
+
+
+ openPopup(<Popup> popup)
+ this
+ Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
+
+
+
+ openPopup(<String|HTMLElement> content, <LatLng> latlng, <Popup options> options?)
+ this
+ Creates a popup with the specified content and options and opens it in the given point on a map.
+
+
+
+ closePopup(<Popup> popup?)
+ this
+ Closes the popup previously opened with openPopup (or the given one).
+
+
+
+ openTooltip(<Tooltip> tooltip)
+ this
+ Opens the specified tooltip.
+
+
+
+ openTooltip(<String|HTMLElement> content, <LatLng> latlng, <Tooltip options> options?)
+ this
+ Creates a tooltip with the specified content and options and open it.
+
+
+
+ closeTooltip(<Tooltip> tooltip?)
+ this
+ Closes the tooltip given as parameter.
+
+
+
+
+
+
+Methods for modifying map state
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setView(<LatLng> center, <Number> zoom, <Zoom/pan options> options?)
+ this
+ Sets the view of the map (geographical center and zoom) with the given
+animation options.
+
+
+
+ setZoom(<Number> zoom, <Zoom/pan options> options?)
+ this
+ Sets the zoom of the map.
+
+
+
+ zoomIn(<Number> delta?, <Zoom options> options?)
+ this
+ Increases the zoom of the map by delta (zoomDelta by default).
+
+
+
+ zoomOut(<Number> delta?, <Zoom options> options?)
+ this
+ Decreases the zoom of the map by delta (zoomDelta by default).
+
+
+
+ setZoomAround(<LatLng> latlng, <Number> zoom, <Zoom options> options)
+ this
+ Zooms the map while keeping a specified geographical point on the map
+stationary (e.g. used internally for scroll zoom and double-click zoom).
+
+
+
+ setZoomAround(<Point> offset, <Number> zoom, <Zoom options> options)
+ this
+ Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
+
+
+
+ fitBounds(<LatLngBounds> bounds, <fitBounds options> options?)
+ this
+ Sets a map view that contains the given geographical bounds with the
+maximum zoom level possible.
+
+
+
+ fitWorld(<fitBounds options> options?)
+ this
+ Sets a map view that mostly contains the whole world with the maximum
+zoom level possible.
+
+
+
+ panTo(<LatLng> latlng, <Pan options> options?)
+ this
+ Pans the map to a given center.
+
+
+
+ panBy(<Point> offset, <Pan options> options?)
+ this
+ Pans the map by a given number of pixels (animated).
+
+
+
+ flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?)
+ this
+ Sets the view of the map (geographical center and zoom) performing a smooth
+pan-zoom animation.
+
+
+
+ flyToBounds(<LatLngBounds> bounds, <fitBounds options> options?)
+ this
+ Sets the view of the map with a smooth animation like flyTo,
+but takes a bounds parameter like fitBounds.
+
+
+
+ setMaxBounds(<LatLngBounds> bounds)
+ this
+ Restricts the map view to the given bounds (see the maxBounds option).
+
+
+
+ setMinZoom(<Number> zoom)
+ this
+ Sets the lower limit for the available zoom levels (see the minZoom option).
+
+
+
+ setMaxZoom(<Number> zoom)
+ this
+ Sets the upper limit for the available zoom levels (see the maxZoom option).
+
+
+
+ panInsideBounds(<LatLngBounds> bounds, <Pan options> options?)
+ this
+ Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
+
+
+
+ panInside(<LatLng> latlng, <options> options?)
+ this
+ Pans the map the minimum amount to make the latlng visible. Use
+padding, paddingTopLeft and paddingTopRight options to fit
+the display to more restricted bounds, like fitBounds.
+If latlng is already within the (optionally padded) display bounds,
+the map will not be panned.
+
+
+
+ invalidateSize(<Zoom/pan options> options)
+ this
+ Checks if the map container size changed and updates the map if so —
+call it after you've changed the map size dynamically, also animating
+pan by default. If options.pan is false, panning will not occur.
+If options.debounceMoveend is true, it will delay moveend event so
+that it doesn't happen often even if the method is called many
+times in a row.
+
+
+
+ invalidateSize(<Boolean> animate)
+ this
+ Checks if the map container size changed and updates the map if so —
+call it after you've changed the map size dynamically, also animating
+pan by default.
+
+
+
+ stop()
+ this
+ Stops the currently running panTo or flyTo animation, if any.
+
+
+
+
+
+
+Geolocation methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ locate(<Locate options> options?)
+ this
+ Tries to locate the user using the Geolocation API, firing a locationfound
+event with location data on success or a locationerror event on failure,
+and optionally sets the map view to the user's location with respect to
+detection accuracy (or to the world view if geolocation failed).
+Note that, if your page doesn't use HTTPS, this method will fail in
+modern browsers (Chrome 50 and newer)
+See Locate options for more details.
+
+
+
+ stopLocate()
+ this
+ Stops watching location previously initiated by map.locate({watch: true})
+and aborts resetting the map view if map.locate was called with
+{setView: true}.
+
+
+
+
+
+
+Other Methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addHandler(<String> name, <Function> HandlerClass)
+ this
+ Adds a new Handler to the map, given its name and constructor function.
+
+
+
+ remove()
+ this
+ Destroys the map and clears all related event listeners.
+
+
+
+ createPane(<String> name, <HTMLElement> container?)
+ HTMLElement
+ Creates a new map pane with the given name if it doesn't exist already,
+then returns it. The pane is created as a child of container, or
+as a child of the main map pane if not set.
+
+
+
+ getPane(<String|HTMLElement> pane)
+ HTMLElement
+ Returns a map pane, given its name or its HTML element (its identity).
+
+
+
+ getPanes()
+ Object
+ Returns a plain object containing the names of all panes as keys and
+the panes as values.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the map.
+
+
+
+ whenReady(<Function> fn, <Object> context?)
+ this
+ Runs the given function fn when the map gets initialized with
+a view (center and zoom) and at least one layer, or immediately
+if it's already initialized, optionally passing a function context.
+
+
+
+
+
+
+Methods for Getting Map State
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getCenter()
+ LatLng
+ Returns the geographical center of the map view
+
+
+
+ getZoom()
+ Number
+ Returns the current zoom level of the map view
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the geographical bounds visible in the current map view
+
+
+
+ getMinZoom()
+ Number
+ Returns the minimum zoom level of the map (if set in the minZoom option of the map or of any layers), or 0 by default.
+
+
+
+ getMaxZoom()
+ Number
+ Returns the maximum zoom level of the map (if set in the maxZoom option of the map or of any layers).
+
+
+
+ getBoundsZoom(<LatLngBounds> bounds, <Boolean> inside?, <Point> padding?)
+ Number
+ Returns the maximum zoom level on which the given bounds fit to the map
+view in its entirety. If inside (optional) is set to true, the method
+instead returns the minimum zoom level on which the map view fits into
+the given bounds in its entirety.
+
+
+
+ getSize()
+ Point
+ Returns the current size of the map container (in pixels).
+
+
+
+ getPixelBounds()
+ Bounds
+ Returns the bounds of the current map view in projected pixel
+coordinates (sometimes useful in layer and overlay implementations).
+
+
+
+ getPixelOrigin()
+ Point
+ Returns the projected pixel coordinates of the top left point of
+the map layer (useful in custom layer and overlay implementations).
+
+
+
+ getPixelWorldBounds(<Number> zoom?)
+ Bounds
+ Returns the world's bounds in pixel coordinates for zoom level zoom.
+If zoom is omitted, the map's current zoom level is used.
+
+
+
+
+
+
+Conversion Methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getZoomScale(<Number> toZoom, <Number> fromZoom)
+ Number
+ Returns the scale factor to be applied to a map transition from zoom level
+fromZoom to toZoom. Used internally to help with zoom animations.
+
+
+
+ getScaleZoom(<Number> scale, <Number> fromZoom)
+ Number
+ Returns the zoom level that the map would end up at, if it is at fromZoom
+level and everything is scaled by a factor of scale. Inverse of
+getZoomScale.
+
+
+
+ project(<LatLng> latlng, <Number> zoom)
+ Point
+ Projects a geographical coordinate LatLng according to the projection
+of the map's CRS, then scales it according to zoom and the CRS's
+Transformation. The result is pixel coordinate relative to
+the CRS origin.
+
+
+
+ unproject(<Point> point, <Number> zoom)
+ LatLng
+ Inverse of project.
+
+
+
+ layerPointToLatLng(<Point> point)
+ LatLng
+ Given a pixel coordinate relative to the origin pixel,
+returns the corresponding geographical coordinate (for the current zoom level).
+
+
+
+ latLngToLayerPoint(<LatLng> latlng)
+ Point
+ Given a geographical coordinate, returns the corresponding pixel coordinate
+relative to the origin pixel.
+
+
+
+ wrapLatLng(<LatLng> latlng)
+ LatLng
+ Returns a LatLng where lat and lng has been wrapped according to the
+map's CRS's wrapLat and wrapLng properties, if they are outside the
+CRS's bounds.
+By default this means longitude is wrapped around the dateline so its
+value is between -180 and +180 degrees.
+
+
+
+ wrapLatLngBounds(<LatLngBounds> bounds)
+ LatLngBounds
+ Returns a LatLngBounds with the same size as the given one, ensuring that
+its center is within the CRS's bounds.
+By default this means the center longitude is wrapped around the dateline so its
+value is between -180 and +180 degrees, and the majority of the bounds
+overlaps the CRS's bounds.
+
+
+
+ distance(<LatLng> latlng1, <LatLng> latlng2)
+ Number
+ Returns the distance between two geographical coordinates according to
+the map's CRS. By default this measures distance in meters.
+
+
+
+ containerPointToLayerPoint(<Point> point)
+ Point
+ Given a pixel coordinate relative to the map container, returns the corresponding
+pixel coordinate relative to the origin pixel.
+
+
+
+ layerPointToContainerPoint(<Point> point)
+ Point
+ Given a pixel coordinate relative to the origin pixel,
+returns the corresponding pixel coordinate relative to the map container.
+
+
+
+ containerPointToLatLng(<Point> point)
+ LatLng
+ Given a pixel coordinate relative to the map container, returns
+the corresponding geographical coordinate (for the current zoom level).
+
+
+
+ latLngToContainerPoint(<LatLng> latlng)
+ Point
+ Given a geographical coordinate, returns the corresponding pixel coordinate
+relative to the map container.
+
+
+
+ mouseEventToContainerPoint(<MouseEvent> ev)
+ Point
+ Given a MouseEvent object, returns the pixel coordinate relative to the
+map container where the event took place.
+
+
+
+ mouseEventToLayerPoint(<MouseEvent> ev)
+ Point
+ Given a MouseEvent object, returns the pixel coordinate relative to
+the origin pixel where the event took place.
+
+
+
+ mouseEventToLatLng(<MouseEvent> ev)
+ LatLng
+ Given a MouseEvent object, returns geographical coordinate where the
+event took place.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Properties
+
+
+
+Controls
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ zoomControl
+ Control.Zoom
+ The default zoom control (only available if the
+zoomControl option was true when creating the map).
+
+
+
+
+
+Handlers
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ boxZoom
+ Handler
+ Box (shift-drag with mouse) zoom handler.
+
+
+ doubleClickZoom
+ Handler
+ Double click zoom handler.
+
+
+ dragging
+ Handler
+ Map dragging handler (by both mouse and touch).
+
+
+ keyboard
+ Handler
+ Keyboard navigation handler.
+
+
+ scrollWheelZoom
+ Handler
+ Scroll wheel zoom handler.
+
+
+ tap
+ Handler
+ Mobile touch hacks (quick tap and touch hold) handler.
+
+
+ touchZoom
+ Handler
+ Touch zoom handler.
+
+
+
+
+
+
+
+Map panes
+
+
+
+
+
+Panes are DOM elements used to control the ordering of layers on the map. You
+can access panes with map.getPane or
+map.getPanes methods. New panes can be created with the
+map.createPane method.
+Every map has the following default panes that differ only in zIndex.
+
+
+
+ Pane
+ Type
+ Z-index
+ Description
+
+
+
+ mapPane
+ HTMLElement
+ 'auto'
+ Pane that contains all other map panes
+
+
+ tilePane
+ HTMLElement
+ 200
+ Pane for GridLayers and TileLayers
+
+
+ overlayPane
+ HTMLElement
+ 400
+ Pane for overlay shadows (e.g. Marker shadows)
+
+
+ shadowPane
+ HTMLElement
+ 500
+ Pane for vectors (Paths, like Polylines and Polygons), ImageOverlays and VideoOverlays
+
+
+ markerPane
+ HTMLElement
+ 600
+ Pane for Icons of Markers
+
+
+ tooltipPane
+ HTMLElement
+ 650
+ Pane for Tooltips.
+
+
+ popupPane
+ HTMLElement
+ 700
+ Pane for Popups.
+
+
+
+
+
+
+
+
+
+Locate options
+
+
+
+
+
+Some of the geolocation methods for Map take in an options parameter. This
+is a plain javascript object with the following optional components:
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ watch
+ Boolean
+ false
+ If true, starts continuous watching of location changes (instead of detecting it
+once) using W3C watchPosition method. You can later stop watching using
+map.stopLocate() method.
+
+
+ setView
+ Boolean
+ false
+ If true, automatically sets the map view to the user location with respect to
+detection accuracy, or to world view if geolocation failed.
+
+
+ maxZoom
+ Number
+ Infinity
+ The maximum zoom for automatic view setting when using setView option.
+
+
+ timeout
+ Number
+ 10000
+ Number of milliseconds to wait for a response from geolocation before firing a
+locationerror event.
+
+
+ maximumAge
+ Number
+ 0
+ Maximum age of detected location. If less than this amount of milliseconds
+passed since last geolocation response, locate will return a cached location.
+
+
+ enableHighAccuracy
+ Boolean
+ false
+ Enables high accuracy, see description in the W3C spec.
+
+
+
+
+
+
+
+
+
+Zoom options
+
+
+
+
+
+Some of the Map methods which modify the zoom level take in an options
+parameter. This is a plain javascript object with the following optional
+components:
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If not specified, zoom animation will happen if the zoom origin is inside the
+current view. If true, the map will attempt animating zoom disregarding where
+zoom origin is. Setting false will make it always reset the view completely
+without animation.
+
+
+
+
+
+
+
+
+
+Pan options
+
+
+
+
+
+Some of the Map methods which modify the center of the map take in an options
+parameter. This is a plain javascript object with the following optional
+components:
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If true, panning will always be animated if possible. If false, it will
+not animate panning, either resetting the map view if panning more than a
+screen away, or just setting a new offset for the map pane (except for panBy
+which always does the latter).
+
+
+ duration
+ Number
+ 0.25
+ Duration of animated panning, in seconds.
+
+
+ easeLinearity
+ Number
+ 0.25
+ The curvature factor of panning animation easing (third parameter of the
+Cubic Bezier curve). 1.0 means linear animation,
+and the smaller this number, the more bowed the curve.
+
+
+ noMoveStart
+ Boolean
+ false
+ If true, panning won't fire movestart event on start (used internally for
+panning inertia).
+
+
+
+
+
+
+
+
+
+Zoom/pan options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If not specified, zoom animation will happen if the zoom origin is inside the
+current view. If true, the map will attempt animating zoom disregarding where
+zoom origin is. Setting false will make it always reset the view completely
+without animation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ duration
+ Number
+ 0.25
+ Duration of animated panning, in seconds.
+
+
+ easeLinearity
+ Number
+ 0.25
+ The curvature factor of panning animation easing (third parameter of the
+Cubic Bezier curve). 1.0 means linear animation,
+and the smaller this number, the more bowed the curve.
+
+
+ noMoveStart
+ Boolean
+ false
+ If true, panning won't fire movestart event on start (used internally for
+panning inertia).
+
+
+
+
+
+
+
+
+
+
+FitBounds options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ paddingTopLeft
+ Point
+ [0, 0]
+ Sets the amount of padding in the top left corner of a map container that
+shouldn't be accounted for when setting the view to fit bounds. Useful if you
+have some control overlays on the map like a sidebar and you don't want them
+to obscure objects you're zooming to.
+
+
+ paddingBottomRight
+ Point
+ [0, 0]
+ The same for the bottom right corner of the map.
+
+
+ padding
+ Point
+ [0, 0]
+ Equivalent of setting both top left and bottom right padding to the same value.
+
+
+ maxZoom
+ Number
+ null
+ The maximum possible zoom to use.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ animate
+ Boolean
+
+ If not specified, zoom animation will happen if the zoom origin is inside the
+current view. If true, the map will attempt animating zoom disregarding where
+zoom origin is. Setting false will make it always reset the view completely
+without animation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ duration
+ Number
+ 0.25
+ Duration of animated panning, in seconds.
+
+
+ easeLinearity
+ Number
+ 0.25
+ The curvature factor of panning animation easing (third parameter of the
+Cubic Bezier curve). 1.0 means linear animation,
+and the smaller this number, the more bowed the curve.
+
+
+ noMoveStart
+ Boolean
+ false
+ If true, panning won't fire movestart event on start (used internally for
+panning inertia).
+
+
+
+
+
+
+
+ Marker
L.Marker is used to display clickable/draggable icons on the map. Extends Layer.
+
+
+Usage example
+
+
+
+
+
+
+
+L.marker([50.5, 30.5]).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.marker(<LatLng> latlng, <Marker options> options?)
+ Instantiates a Marker object given a geographical point and optionally an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ icon
+ Icon
+ *
+ Icon instance to use for rendering the marker.
+See Icon documentation for details on how to customize the marker icon.
+If not specified, a common instance of L.Icon.Default is used.
+
+
+ keyboard
+ Boolean
+ true
+ Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
+
+
+ title
+ String
+ ''
+ Text for the browser tooltip that appear on marker hover (no tooltip by default).
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the icon image (useful for accessibility).
+
+
+ zIndexOffset
+ Number
+ 0
+ By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the marker.
+
+
+ riseOnHover
+ Boolean
+ false
+ If true, the marker will get on top of others when you hover the mouse over it.
+
+
+ riseOffset
+ Number
+ 250
+ The z-index offset used for the riseOnHover feature.
+
+
+ pane
+ String
+ 'markerPane'
+ Map pane where the markers icon will be added.
+
+
+ shadowPane
+ String
+ 'shadowPane'
+ Map pane where the markers shadow will be added.
+
+
+ bubblingMouseEvents
+ Boolean
+ false
+ When true, a mouse event on this marker will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+Draggable marker options
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ draggable
+ Boolean
+ false
+ Whether the marker is draggable with mouse/touch or not.
+
+
+ autoPan
+ Boolean
+ false
+ Whether to pan the map when dragging this marker near its edge or not.
+
+
+ autoPanPadding
+ Point
+ Point(50, 50)
+ Distance (in pixels to the left/right and to the top/bottom) of the
+map edge to start panning the map.
+
+
+ autoPanSpeed
+ Number
+ 10
+ Number of pixels the map should pan by.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ move
+ Event
+ Fired when the marker is moved via setLatLng or by dragging. Old and new coordinates are included in event arguments as oldLatLng, latlng.
+
+
+
+
+
+Dragging events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ dragstart
+ Event
+ Fired when the user starts dragging the marker.
+
+
+ movestart
+ Event
+ Fired when the marker starts moving (because of dragging).
+
+
+ drag
+ Event
+ Fired repeatedly while the user drags the marker.
+
+
+ dragend
+ DragEndEvent
+ Fired when the user stops dragging the marker.
+
+
+ moveend
+ Event
+ Fired when the marker stops moving (because of dragging).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+In addition to shared layer methods like addTo() and remove() and popup methods like bindPopup() you can also use the following methods:
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getLatLng()
+ LatLng
+ Returns the current geographical position of the marker.
+
+
+
+ setLatLng(<LatLng> latlng)
+ this
+ Changes the marker position to the given point.
+
+
+
+ setZIndexOffset(<Number> offset)
+ this
+ Changes the zIndex offset of the marker.
+
+
+
+ getIcon()
+ Icon
+ Returns the current icon used by the marker
+
+
+
+ setIcon(<Icon> icon)
+ this
+ Changes the marker icon.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the marker.
+
+
+
+
+
+
+Other methods
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the marker (as a GeoJSON Point Feature).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Properties
+
+
+
+Interaction handlers
+
+Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see Handler methods). Example:
+marker.dragging.disable();
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ dragging
+ Handler
+ Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set marker.options.draggable).
+
+
+
+
+
+
+ Popup
Used to open popups in certain places of the map. Use Map.openPopup to
+open popups while making sure that only one popup is open at one time
+(recommended for usability), or use Map.addLayer to open as many as you want.
+
+
+Usage example
+
+
+
+
+
+
+
+If you want to just bind a popup to marker click and then open it, it's really easy:
+marker.bindPopup(popupContent).openPopup();
+
+Path overlays like polylines also have a bindPopup method.
+Here's a more complicated way to open a popup on a map:
+var popup = L.popup()
+ .setLatLng(latlng)
+ .setContent('<p>Hello world!<br />This is a nice popup.</p>')
+ .openOn(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.popup(<Popup options> options?, <Layer> source?)
+ Instantiates a Popup object given an optional options object that describes its appearance and location and an optional source object that is used to tag the popup with a reference to the Layer to which it refers.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ maxWidth
+ Number
+ 300
+ Max width of the popup, in pixels.
+
+
+ minWidth
+ Number
+ 50
+ Min width of the popup, in pixels.
+
+
+ maxHeight
+ Number
+ null
+ If set, creates a scrollable container of the given height
+inside a popup if its content exceeds it.
+
+
+ autoPan
+ Boolean
+ true
+ Set it to false if you don't want the map to do panning animation
+to fit the opened popup.
+
+
+ autoPanPaddingTopLeft
+ Point
+ null
+ The margin between the popup and the top left corner of the map
+view after autopanning was performed.
+
+
+ autoPanPaddingBottomRight
+ Point
+ null
+ The margin between the popup and the bottom right corner of the map
+view after autopanning was performed.
+
+
+ autoPanPadding
+ Point
+ Point(5, 5)
+ Equivalent of setting both top left and bottom right autopan padding to the same value.
+
+
+ keepInView
+ Boolean
+ false
+ Set it to true if you want to prevent users from panning the popup
+off of the screen while it is open.
+
+
+ closeButton
+ Boolean
+ true
+ Controls the presence of a close button in the popup.
+
+
+ autoClose
+ Boolean
+ true
+ Set it to false if you want to override the default behavior of
+the popup closing when another popup is opened.
+
+
+ closeOnEscapeKey
+ Boolean
+ true
+ Set it to false if you want to override the default behavior of
+the ESC key for closing of the popup.
+
+
+ closeOnClick
+ Boolean
+ *
+ Set it if you want to override the default behavior of the popup closing when user clicks
+on the map. Defaults to the map's closePopupOnClick option.
+
+
+ className
+ String
+ ''
+ A custom CSS class name to assign to the popup.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ offset
+ Point
+ Point(0, 7)
+ The offset of the popup position. Useful to control the anchor
+of the popup when opening it on some overlays.
+
+
+ pane
+ String
+ 'popupPane'
+ Map pane where the popup will be added.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getLatLng()
+ LatLng
+ Returns the geographical point of popup.
+
+
+
+ setLatLng(<LatLng> latlng)
+ this
+ Sets the geographical point where the popup will open.
+
+
+
+ getContent()
+ String|HTMLElement
+ Returns the content of the popup.
+
+
+
+ setContent(<String|HTMLElement|Function> htmlContent)
+ this
+ Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a String or HTMLElement to be used in the popup.
+
+
+
+ getElement()
+ String|HTMLElement
+ Returns the HTML container of the popup.
+
+
+
+ update()
+ null
+ Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
+
+
+
+ isOpen()
+ Boolean
+ Returns true when the popup is visible on the map.
+
+
+
+ bringToFront()
+ this
+ Brings this popup in front of other popups (in the same map pane).
+
+
+
+ bringToBack()
+ this
+ Brings this popup to the back of other popups (in the same map pane).
+
+
+
+ openOn(<Map> map)
+ this
+ Adds the popup to the map and closes the previous one. The same as map.openPopup(popup).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Tooltip
Used to display small texts on top of map layers.
+
+
+Usage example
+
+
+
+
+
+
+
+marker.bindTooltip("my tooltip text").openTooltip();
+
+Note about tooltip offset. Leaflet takes two options in consideration
+for computing tooltip offsetting:
+
+- the
offset Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
+Add a positive x offset to move the tooltip to the right, and a positive y offset to
+move it to the bottom. Negatives will move to the left and top.
+- the
tooltipAnchor Icon option: this will only be considered for Marker. You
+should adapt this value if you use a custom icon.
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.tooltip(<Tooltip options> options?, <Layer> source?)
+ Instantiates a Tooltip object given an optional options object that describes its appearance and location and an optional source object that is used to tag the tooltip with a reference to the Layer to which it refers.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'tooltipPane'
+ Map pane where the tooltip will be added.
+
+
+ offset
+ Point
+ Point(0, 0)
+ Optional offset of the tooltip position.
+
+
+ direction
+ String
+ 'auto'
+ Direction where to open the tooltip. Possible values are: right, left,
+top, bottom, center, auto.
+auto will dynamically switch between right and left according to the tooltip
+position on the map.
+
+
+ permanent
+ Boolean
+ false
+ Whether to open the tooltip permanently or only on mouseover.
+
+
+ sticky
+ Boolean
+ false
+ If true, the tooltip will follow the mouse instead of being fixed at the feature center.
+
+
+ interactive
+ Boolean
+ false
+ If true, the tooltip will listen to the feature events.
+
+
+ opacity
+ Number
+ 0.9
+ Tooltip container opacity.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ className
+ String
+ ''
+ A custom CSS class name to assign to the popup.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ TileLayer
Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under Layer. Extends GridLayer.
+
+
+Usage example
+
+
+
+
+
+
+
+L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
+
+
+
+
+
+
+URL template
+
+
+
+A string of the following form:
+'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'
+
+{s} means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; a, b or c by default, can be omitted), {z} — zoom level, {x} and {y} — tile coordinates. {r} can be used to add "@2x" to the URL to load retina tiles.
+You can use custom keys in the template, which will be evaluated from TileLayer options, like this:
+L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});
+
+
+
+
+
+
+
+
+Creation
+
+
+
+Extension methods
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.tilelayer(<String> urlTemplate, <TileLayer options> options?)
+ Instantiates a tile layer object given a URL template and optionally an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ minZoom
+ Number
+ 0
+ The minimum zoom level down to which this layer will be displayed (inclusive).
+
+
+ maxZoom
+ Number
+ 18
+ The maximum zoom level up to which this layer will be displayed (inclusive).
+
+
+ subdomains
+ String|String[]
+ 'abc'
+ Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
+
+
+ errorTileUrl
+ String
+ ''
+ URL to the tile image to show in place of the tile that failed to load.
+
+
+ zoomOffset
+ Number
+ 0
+ The zoom number used in tile URLs will be offset with this value.
+
+
+ tms
+ Boolean
+ false
+ If true, inverses Y axis numbering for tiles (turn this on for TMS services).
+
+
+ zoomReverse
+ Boolean
+ false
+ If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
+
+
+ detectRetina
+ Boolean
+ false
+ If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the tiles.
+If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
+Refer to CORS Settings for valid String values.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tileSize
+ Number|Point
+ 256
+ Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
+
+
+ opacity
+ Number
+ 1.0
+ Opacity of the tiles. Can be used in the createTile() function.
+
+
+ updateWhenIdle
+ Boolean
+ (depends)
+ Load new tiles only when panning ends.
+true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
+false otherwise in order to display new tiles during panning, since it is easy to pan outside the
+keepBuffer option in desktop browsers.
+
+
+ updateWhenZooming
+ Boolean
+ true
+ By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
+
+
+ updateInterval
+ Number
+ 200
+ Tiles will not update more than once every updateInterval milliseconds when panning.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the tile layer.
+
+
+ bounds
+ LatLngBounds
+ undefined
+ If set, tiles will only be loaded inside the set LatLngBounds.
+
+
+ maxNativeZoom
+ Number
+ undefined
+ Maximum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels higher than maxNativeZoom will be loaded
+from maxNativeZoom level and auto-scaled.
+
+
+ minNativeZoom
+ Number
+ undefined
+ Minimum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels lower than minNativeZoom will be loaded
+from minNativeZoom level and auto-scaled.
+
+
+ noWrap
+ Boolean
+ false
+ Whether the layer is wrapped around the antimeridian. If true, the
+GridLayer will only be displayed once at low zoom levels. Has no
+effect when the map CRS doesn't wrap around. Can be used
+in combination with bounds to prevent requesting
+tiles outside the CRS limits.
+
+
+ pane
+ String
+ 'tilePane'
+ Map pane where the grid layer will be added.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the tile layer. Empty by default.
+
+
+ keepBuffer
+ Number
+ 2
+ When panning the map, keep this many rows and columns of tiles before unloading them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ loading
+ Event
+ Fired when the grid layer starts loading tiles.
+
+
+ tileunload
+ TileEvent
+ Fired when a tile is removed (e.g. when a tile goes off the screen).
+
+
+ tileloadstart
+ TileEvent
+ Fired when a tile is requested and starts loading.
+
+
+ tileerror
+ TileErrorEvent
+ Fired when there is an error loading a tile.
+
+
+ tileload
+ TileEvent
+ Fired when a tile loads.
+
+
+ load
+ Event
+ Fired when the grid layer loaded all visible tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setUrl(<String> url, <Boolean> noRedraw?)
+ this
+ Updates the layer's URL template and redraws it (unless noRedraw is set to true).
+If the URL does not change, the layer will not be redrawn unless
+the noRedraw parameter is set to false.
+
+
+
+ createTile(<Object> coords, <Function> done?)
+ HTMLElement
+ Called only internally, overrides GridLayer's createTile()
+to return an <img> HTML element with the appropriate image URL given coords. The done
+callback is called when the tile has been loaded.
+
+
+
+
+
+
+Extension methods
+
+Layers extending TileLayer might reimplement the following method.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getTileUrl(<Object> coords)
+ String
+ Called only internally, returns the URL for a tile given its coordinates.
+Classes extending TileLayer can override this function to provide custom tile URL naming schemes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the tile layer to the top of all tile layers.
+
+
+
+ bringToBack()
+ this
+ Brings the tile layer to the bottom of all tile layers.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the tiles for this layer.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the grid layer.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Changes the zIndex of the grid layer.
+
+
+
+ isLoading()
+ Boolean
+ Returns true if any tile in the grid layer has not finished loading.
+
+
+
+ redraw()
+ this
+ Causes the layer to clear all the tiles and request them again.
+
+
+
+ getTileSize()
+ Point
+ Normalizes the tileSize option into a point. Used by the createTile() method.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ TileLayer.WMS
Used to display WMS services as tile layers on the map. Extends TileLayer.
+
+
+Usage example
+
+
+
+
+
+
+
+var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", {
+ layers: 'nexrad-n0r-900913',
+ format: 'image/png',
+ transparent: true,
+ attribution: "Weather data © 2012 IEM Nexrad"
+});
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.tileLayer.wms(<String> baseUrl, <TileLayer.WMS options> options)
+ Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+If any custom options not documented here are used, they will be sent to the
+WMS server as extra parameters in each request URL. This can be useful for
+non-standard vendor WMS parameters.
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ layers
+ String
+ ''
+ (required) Comma-separated list of WMS layers to show.
+
+
+ styles
+ String
+ ''
+ Comma-separated list of WMS styles.
+
+
+ format
+ String
+ 'image/jpeg'
+ WMS image format (use 'image/png' for layers with transparency).
+
+
+ transparent
+ Boolean
+ false
+ If true, the WMS service will return images with transparency.
+
+
+ version
+ String
+ '1.1.1'
+ Version of the WMS service to use
+
+
+ crs
+ CRS
+ null
+ Coordinate Reference System to use for the WMS requests, defaults to
+map CRS. Don't change this if you're not sure what it means.
+
+
+ uppercase
+ Boolean
+ false
+ If true, WMS request parameter keys will be uppercase.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ minZoom
+ Number
+ 0
+ The minimum zoom level down to which this layer will be displayed (inclusive).
+
+
+ maxZoom
+ Number
+ 18
+ The maximum zoom level up to which this layer will be displayed (inclusive).
+
+
+ subdomains
+ String|String[]
+ 'abc'
+ Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
+
+
+ errorTileUrl
+ String
+ ''
+ URL to the tile image to show in place of the tile that failed to load.
+
+
+ zoomOffset
+ Number
+ 0
+ The zoom number used in tile URLs will be offset with this value.
+
+
+ tms
+ Boolean
+ false
+ If true, inverses Y axis numbering for tiles (turn this on for TMS services).
+
+
+ zoomReverse
+ Boolean
+ false
+ If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
+
+
+ detectRetina
+ Boolean
+ false
+ If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the tiles.
+If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
+Refer to CORS Settings for valid String values.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tileSize
+ Number|Point
+ 256
+ Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
+
+
+ opacity
+ Number
+ 1.0
+ Opacity of the tiles. Can be used in the createTile() function.
+
+
+ updateWhenIdle
+ Boolean
+ (depends)
+ Load new tiles only when panning ends.
+true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
+false otherwise in order to display new tiles during panning, since it is easy to pan outside the
+keepBuffer option in desktop browsers.
+
+
+ updateWhenZooming
+ Boolean
+ true
+ By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
+
+
+ updateInterval
+ Number
+ 200
+ Tiles will not update more than once every updateInterval milliseconds when panning.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the tile layer.
+
+
+ bounds
+ LatLngBounds
+ undefined
+ If set, tiles will only be loaded inside the set LatLngBounds.
+
+
+ maxNativeZoom
+ Number
+ undefined
+ Maximum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels higher than maxNativeZoom will be loaded
+from maxNativeZoom level and auto-scaled.
+
+
+ minNativeZoom
+ Number
+ undefined
+ Minimum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels lower than minNativeZoom will be loaded
+from minNativeZoom level and auto-scaled.
+
+
+ noWrap
+ Boolean
+ false
+ Whether the layer is wrapped around the antimeridian. If true, the
+GridLayer will only be displayed once at low zoom levels. Has no
+effect when the map CRS doesn't wrap around. Can be used
+in combination with bounds to prevent requesting
+tiles outside the CRS limits.
+
+
+ pane
+ String
+ 'tilePane'
+ Map pane where the grid layer will be added.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the tile layer. Empty by default.
+
+
+ keepBuffer
+ Number
+ 2
+ When panning the map, keep this many rows and columns of tiles before unloading them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ loading
+ Event
+ Fired when the grid layer starts loading tiles.
+
+
+ tileunload
+ TileEvent
+ Fired when a tile is removed (e.g. when a tile goes off the screen).
+
+
+ tileloadstart
+ TileEvent
+ Fired when a tile is requested and starts loading.
+
+
+ tileerror
+ TileErrorEvent
+ Fired when there is an error loading a tile.
+
+
+ tileload
+ TileEvent
+ Fired when a tile loads.
+
+
+ load
+ Event
+ Fired when the grid layer loaded all visible tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setParams(<Object> params, <Boolean> noRedraw?)
+ this
+ Merges an object with the new parameters and re-requests tiles on the current screen (unless noRedraw was set to true).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setUrl(<String> url, <Boolean> noRedraw?)
+ this
+ Updates the layer's URL template and redraws it (unless noRedraw is set to true).
+If the URL does not change, the layer will not be redrawn unless
+the noRedraw parameter is set to false.
+
+
+
+ createTile(<Object> coords, <Function> done?)
+ HTMLElement
+ Called only internally, overrides GridLayer's createTile()
+to return an <img> HTML element with the appropriate image URL given coords. The done
+callback is called when the tile has been loaded.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the tile layer to the top of all tile layers.
+
+
+
+ bringToBack()
+ this
+ Brings the tile layer to the bottom of all tile layers.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the tiles for this layer.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the grid layer.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Changes the zIndex of the grid layer.
+
+
+
+ isLoading()
+ Boolean
+ Returns true if any tile in the grid layer has not finished loading.
+
+
+
+ redraw()
+ this
+ Causes the layer to clear all the tiles and request them again.
+
+
+
+ getTileSize()
+ Point
+ Normalizes the tileSize option into a point. Used by the createTile() method.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ ImageOverlay
Used to load and display a single image over specific bounds of the map. Extends Layer.
+
+
+Usage example
+
+
+
+
+
+
+
+var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
+ imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
+L.imageOverlay(imageUrl, imageBounds).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.imageOverlay(<String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options?)
+ Instantiates an image overlay object given the URL of the image and the
+geographical bounds it is tied to.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the image overlay.
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the image (useful for accessibility).
+
+
+ interactive
+ Boolean
+ false
+ If true, the image overlay will emit mouse events when clicked or hovered.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the image.
+If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
+Refer to CORS Settings for valid String values.
+
+
+ errorOverlayUrl
+ String
+ ''
+ URL to the overlay image to show in place of the overlay that failed to load.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the overlay layer.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the image. Empty by default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ load
+ Event
+ Fired when the ImageOverlay layer has loaded its image
+
+
+ error
+ Event
+ Fired when the ImageOverlay layer fails to load its image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Sets the opacity of the overlay.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all overlays.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all overlays.
+
+
+
+ setUrl(<String> url)
+ this
+ Changes the URL of the image.
+
+
+
+ setBounds(<LatLngBounds> bounds)
+ this
+ Update the bounds that this ImageOverlay covers
+
+
+
+ setZIndex(<Number> value)
+ this
+ Changes the zIndex of the image overlay.
+
+
+
+ getBounds()
+ LatLngBounds
+ Get the bounds that this ImageOverlay covers
+
+
+
+ getElement()
+ HTMLElement
+ Returns the instance of HTMLImageElement
+used by this overlay.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ VideoOverlay
Used to load and display a video player over specific bounds of the map. Extends ImageOverlay.
+A video overlay uses the <video>
+HTML5 element.
+
+
+Usage example
+
+
+
+
+
+
+
+var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
+ videoBounds = [[ 32, -130], [ 13, -100]];
+L.videoOverlay(videoUrl, videoBounds ).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.videoOverlay(<String|Array|HTMLVideoElement> video, <LatLngBounds> bounds, <VideoOverlay options> options?)
+ Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
+geographical bounds it is tied to.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ autoplay
+ Boolean
+ true
+ Whether the video starts playing automatically when loaded.
+
+
+ loop
+ Boolean
+ true
+ Whether the video will loop back to the beginning when played.
+
+
+ keepAspectRatio
+ Boolean
+ true
+ Whether the video will save aspect ratio after the projection.
+Relevant for supported browsers. See browser compatibility
+
+
+ muted
+ Boolean
+ false
+ Whether the video starts on mute when loaded.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the image overlay.
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the image (useful for accessibility).
+
+
+ interactive
+ Boolean
+ false
+ If true, the image overlay will emit mouse events when clicked or hovered.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the image.
+If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
+Refer to CORS Settings for valid String values.
+
+
+ errorOverlayUrl
+ String
+ ''
+ URL to the overlay image to show in place of the overlay that failed to load.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the overlay layer.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the image. Empty by default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ load
+ Event
+ Fired when the video has finished loading the first frame
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ error
+ Event
+ Fired when the ImageOverlay layer fails to load its image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getElement()
+ HTMLVideoElement
+ Returns the instance of HTMLVideoElement
+used by this overlay.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Sets the opacity of the overlay.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all overlays.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all overlays.
+
+
+
+ setUrl(<String> url)
+ this
+ Changes the URL of the image.
+
+
+
+ setBounds(<LatLngBounds> bounds)
+ this
+ Update the bounds that this ImageOverlay covers
+
+
+
+ setZIndex(<Number> value)
+ this
+ Changes the zIndex of the image overlay.
+
+
+
+ getBounds()
+ LatLngBounds
+ Get the bounds that this ImageOverlay covers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ SVGOverlay
Used to load, display and provide DOM access to an SVG file over specific bounds of the map. Extends ImageOverlay.
+An SVG overlay uses the <svg> element.
+
+
+Usage example
+
+
+
+
+
+
+
+var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg");
+svgElement.setAttribute('viewBox', "0 0 200 200");
+svgElement.innerHTML = '<rect width="200" height="200"/><rect x="75" y="23" width="50" height="50" style="fill:red"/><rect x="75" y="123" width="50" height="50" style="fill:#0013ff"/>';
+var svgElementBounds = [ [ 32, -130 ], [ 13, -100 ] ];
+L.svgOverlay(svgElement, svgElementBounds).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.svgOverlay(<String|SVGElement> svg, <LatLngBounds> bounds, <SVGOverlay options> options?)
+ Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to.
+A viewBox attribute is required on the SVG element to zoom in and out properly.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ opacity
+ Number
+ 1.0
+ The opacity of the image overlay.
+
+
+ alt
+ String
+ ''
+ Text for the alt attribute of the image (useful for accessibility).
+
+
+ interactive
+ Boolean
+ false
+ If true, the image overlay will emit mouse events when clicked or hovered.
+
+
+ crossOrigin
+ Boolean|String
+ false
+ Whether the crossOrigin attribute will be added to the image.
+If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
+Refer to CORS Settings for valid String values.
+
+
+ errorOverlayUrl
+ String
+ ''
+ URL to the overlay image to show in place of the overlay that failed to load.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the overlay layer.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the image. Empty by default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getElement()
+ SVGElement
+ Returns the instance of SVGElement
+used by this overlay.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Sets the opacity of the overlay.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all overlays.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all overlays.
+
+
+
+ setUrl(<String> url)
+ this
+ Changes the URL of the image.
+
+
+
+ setBounds(<LatLngBounds> bounds)
+ this
+ Update the bounds that this ImageOverlay covers
+
+
+
+ setZIndex(<Number> value)
+ this
+ Changes the zIndex of the image overlay.
+
+
+
+ getBounds()
+ LatLngBounds
+ Get the bounds that this ImageOverlay covers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Path
An abstract class that contains options and constants shared between vector
+overlays (Polygon, Polyline, Circle). Do not use it directly. Extends Layer.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Polyline
A class for drawing polyline overlays on a map. Extends Path.
+
+
+Usage example
+
+
+
+
+
+
+
+// create a red polyline from an array of LatLng points
+var latlngs = [
+ [45.51, -122.68],
+ [37.77, -122.43],
+ [34.04, -118.2]
+];
+
+var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
+
+// zoom the map to the polyline
+map.fitBounds(polyline.getBounds());
+
+You can also pass a multi-dimensional array to represent a MultiPolyline shape:
+// create a red polyline from an array of arrays of LatLng points
+var latlngs = [
+ [[45.51, -122.68],
+ [37.77, -122.43],
+ [34.04, -118.2]],
+ [[40.78, -73.91],
+ [41.83, -87.62],
+ [32.76, -96.72]]
+];
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.polyline(<LatLng[]> latlngs, <Polyline options> options?)
+ Instantiates a polyline object given an array of geographical points and
+optionally an options object. You can create a Polyline object with
+multiple separate lines (MultiPolyline) by passing an array of arrays
+of geographic points.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ smoothFactor
+ Number
+ 1.0
+ How much to simplify the polyline on each zoom level. More means
+better performance and smoother look, and less means more accurate representation.
+
+
+ noClip
+ Boolean
+ false
+ Disable polyline clipping.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the polyline (as a GeoJSON LineString or MultiLineString Feature).
+
+
+
+ getLatLngs()
+ LatLng[]
+ Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
+
+
+
+ setLatLngs(<LatLng[]> latlngs)
+ this
+ Replaces all the points in the polyline with the given array of geographical points.
+
+
+
+ isEmpty()
+ Boolean
+ Returns true if the Polyline has no LatLngs.
+
+
+
+ closestLayerPoint(<Point> p)
+ Point
+ Returns the point closest to p on the Polyline.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center (centroid) of the polyline.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+ addLatLng(<LatLng> latlng, <LatLng[]> latlngs?)
+ this
+ Adds a given point to the polyline. By default, adds to the first ring of
+the polyline in case of a multi-polyline, but can be overridden by passing
+a specific ring as a LatLng array (that you can earlier access with getLatLngs).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Polygon
A class for drawing polygon overlays on a map. Extends Polyline.
+Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
+
+
+Usage example
+
+
+
+
+
+
+
+// create a red polygon from an array of LatLng points
+var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
+
+var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
+
+// zoom the map to the polygon
+map.fitBounds(polygon.getBounds());
+
+You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
+var latlngs = [
+ [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
+ [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
+];
+
+Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
+var latlngs = [
+ [ // first polygon
+ [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
+ [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
+ ],
+ [ // second polygon
+ [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
+ ]
+];
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.polygon(<LatLng[]> latlngs, <Polyline options> options?)
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ smoothFactor
+ Number
+ 1.0
+ How much to simplify the polyline on each zoom level. More means
+better performance and smoother look, and less means more accurate representation.
+
+
+ noClip
+ Boolean
+ false
+ Disable polyline clipping.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the polygon (as a GeoJSON Polygon or MultiPolygon Feature).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getLatLngs()
+ LatLng[]
+ Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
+
+
+
+ setLatLngs(<LatLng[]> latlngs)
+ this
+ Replaces all the points in the polyline with the given array of geographical points.
+
+
+
+ isEmpty()
+ Boolean
+ Returns true if the Polyline has no LatLngs.
+
+
+
+ closestLayerPoint(<Point> p)
+ Point
+ Returns the point closest to p on the Polyline.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center (centroid) of the polyline.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+ addLatLng(<LatLng> latlng, <LatLng[]> latlngs?)
+ this
+ Adds a given point to the polyline. By default, adds to the first ring of
+the polyline in case of a multi-polyline, but can be overridden by passing
+a specific ring as a LatLng array (that you can earlier access with getLatLngs).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Rectangle
A class for drawing rectangle overlays on a map. Extends Polygon.
+
+
+Usage example
+
+
+
+
+
+
+
+// define rectangle geographical bounds
+var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
+
+// create an orange rectangle
+L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
+
+// zoom the map to the rectangle bounds
+map.fitBounds(bounds);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.rectangle(<LatLngBounds> latLngBounds, <Polyline options> options?)
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ smoothFactor
+ Number
+ 1.0
+ How much to simplify the polyline on each zoom level. More means
+better performance and smoother look, and less means more accurate representation.
+
+
+ noClip
+ Boolean
+ false
+ Disable polyline clipping.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setBounds(<LatLngBounds> latLngBounds)
+ this
+ Redraws the rectangle with the passed bounds.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getLatLngs()
+ LatLng[]
+ Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
+
+
+
+ setLatLngs(<LatLng[]> latlngs)
+ this
+ Replaces all the points in the polyline with the given array of geographical points.
+
+
+
+ isEmpty()
+ Boolean
+ Returns true if the Polyline has no LatLngs.
+
+
+
+ closestLayerPoint(<Point> p)
+ Point
+ Returns the point closest to p on the Polyline.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center (centroid) of the polyline.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+ addLatLng(<LatLng> latlng, <LatLng[]> latlngs?)
+ this
+ Adds a given point to the polyline. By default, adds to the first ring of
+the polyline in case of a multi-polyline, but can be overridden by passing
+a specific ring as a LatLng array (that you can earlier access with getLatLngs).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Circle
A class for drawing circle overlays on a map. Extends CircleMarker.
+It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).
+
+
+Usage example
+
+
+
+
+
+
+
+L.circle([50.5, 30.5], {radius: 200}).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.circle(<LatLng> latlng, <Circle options> options?)
+ Instantiates a circle object given a geographical point, and an options object
+which contains the circle radius.
+
+
+ L.circle(<LatLng> latlng, <Number> radius, <Circle options> options?)
+ Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
+Do not use in new applications or plugins.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ radius
+ Number
+
+ Radius of the circle, in meters.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setRadius(<Number> radius)
+ this
+ Sets the radius of a circle. Units are in meters.
+
+
+
+ getRadius()
+ Number
+ Returns the current radius of a circle. Units are in meters.
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the path.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
+
+
+
+ setLatLng(<LatLng> latLng)
+ this
+ Sets the position of a circle marker to a new location.
+
+
+
+ getLatLng()
+ LatLng
+ Returns the current geographical position of the circle marker
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ CircleMarker
A circle of a fixed size with radius specified in pixels. Extends Path.
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.circleMarker(<LatLng> latlng, <CircleMarker options> options?)
+ Instantiates a circle marker object given a geographical point, and an optional options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ radius
+ Number
+ 10
+ Radius of the circle marker, in pixels
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ stroke
+ Boolean
+ true
+ Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
+
+
+ color
+ String
+ '#3388ff'
+ Stroke color
+
+
+ weight
+ Number
+ 3
+ Stroke width in pixels
+
+
+ opacity
+ Number
+ 1.0
+ Stroke opacity
+
+
+ lineCap
+ String
+ 'round'
+ A string that defines shape to be used at the end of the stroke.
+
+
+ lineJoin
+ String
+ 'round'
+ A string that defines shape to be used at the corners of the stroke.
+
+
+ dashArray
+ String
+ null
+ A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ dashOffset
+ String
+ null
+ A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
+
+
+ fill
+ Boolean
+ depends
+ Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
+
+
+ fillColor
+ String
+ *
+ Fill color. Defaults to the value of the color option
+
+
+ fillOpacity
+ Number
+ 0.2
+ Fill opacity.
+
+
+ fillRule
+ String
+ 'evenodd'
+ A string that defines how the inside of a shape is determined.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this path will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+ renderer
+ Renderer
+
+ Use this specific instance of Renderer for this path. Takes
+precedence over the map's default renderer.
+
+
+ className
+ String
+ null
+ Custom class name set on an element. Only for SVG renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ move
+ Event
+ Fired when the marker is moved via setLatLng. Old and new coordinates are included in event arguments as oldLatLng, latlng.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
+
+
+
+ setLatLng(<LatLng> latLng)
+ this
+ Sets the position of a circle marker to a new location.
+
+
+
+ getLatLng()
+ LatLng
+ Returns the current geographical position of the circle marker
+
+
+
+ setRadius(<Number> radius)
+ this
+ Sets the radius of a circle marker. Units are in pixels.
+
+
+
+ getRadius()
+ Number
+ Returns the current radius of the circle
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ redraw()
+ this
+ Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
+
+
+
+ setStyle(<Path options> style)
+ this
+ Changes the appearance of a Path based on the options in the Path options object.
+
+
+
+ bringToFront()
+ this
+ Brings the layer to the top of all path layers.
+
+
+
+ bringToBack()
+ this
+ Brings the layer to the bottom of all path layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ SVG
VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
+with old versions of Internet Explorer.
+Allows vector layers to be displayed with SVG.
+Inherits Renderer.
+Due to technical limitations, SVG is not
+available in all web browsers, notably Android 2.x and 3.x.
+Although SVG is not available on IE7 and IE8, these browsers support
+VML
+(a now deprecated technology), and the SVG renderer will fall back to VML in
+this case.
+
+
+Usage example
+
+
+
+
+
+
+
+Use SVG by default for all paths in the map:
+var map = L.map('map', {
+ renderer: L.svg()
+});
+
+Use a SVG renderer with extra padding for specific vector geometries:
+var map = L.map('map');
+var myRenderer = L.svg({ padding: 0.5 });
+var line = L.polyline( coordinates, { renderer: myRenderer } );
+var circle = L.circle( center, { renderer: myRenderer } );
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.svg(<Renderer options> options?)
+ Creates a SVG renderer with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ padding
+ Number
+ 0.1
+ How much to extend the clip area around the map view (relative to its size)
+e.g. 0.1 would be 10% of map view in each direction
+
+
+ tolerance
+ Number
+ 0
+ How much to extend click tolerance round a path/object on the map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ update
+ Event
+ Fired when the renderer updates its bounds, center and zoom, for example when
+its map has moved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Functions
+
+
+
+
+
+There are several static functions which can be called without instantiating L.SVG:
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ create(<String> name)
+ SVGElement
+ Returns a instance of SVGElement,
+corresponding to the class name passed. For example, using 'line' will return
+an instance of SVGLineElement.
+
+
+ pointsToPath(<Point[]> rings, <Boolean> closed)
+ String
+ Generates a SVG path string for multiple rings, with each ring turning
+into "M..L..L.." instructions
+
+
+
+
+
+
+ Canvas
Allows vector layers to be displayed with <canvas>.
+Inherits Renderer.
+Due to technical limitations, Canvas is not
+available in all web browsers, notably IE8, and overlapping geometries might
+not display properly in some edge cases.
+
+
+Usage example
+
+
+
+
+
+
+
+Use Canvas by default for all paths in the map:
+var map = L.map('map', {
+ renderer: L.canvas()
+});
+
+Use a Canvas renderer with extra padding for specific vector geometries:
+var map = L.map('map');
+var myRenderer = L.canvas({ padding: 0.5 });
+var line = L.polyline( coordinates, { renderer: myRenderer } );
+var circle = L.circle( center, { renderer: myRenderer } );
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.canvas(<Renderer options> options?)
+ Creates a Canvas renderer with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ padding
+ Number
+ 0.1
+ How much to extend the clip area around the map view (relative to its size)
+e.g. 0.1 would be 10% of map view in each direction
+
+
+ tolerance
+ Number
+ 0
+ How much to extend click tolerance round a path/object on the map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ update
+ Event
+ Fired when the renderer updates its bounds, center and zoom, for example when
+its map has moved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ LayerGroup
Used to group several layers and handle them as one. If you add it to the map,
+any layers added or removed from the group will be added/removed on the map as
+well. Extends Layer.
+
+
+Usage example
+
+
+
+
+
+
+
+L.layerGroup([marker1, marker2])
+ .addLayer(polyline)
+ .addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.layerGroup(<Layer[]> layers?, <Object> options?)
+ Create a layer group, optionally given an initial set of layers and an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the group.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the group.
+
+
+
+ removeLayer(<Number> id)
+ this
+ Removes the layer with the given internal ID from the group.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the group.
+
+
+
+ hasLayer(<Number> id)
+ Boolean
+ Returns true if the given internal ID is currently added to the group.
+
+
+
+ clearLayers()
+ this
+ Removes all the layers from the group.
+
+
+
+ invoke(<String> methodName, …)
+ this
+ Calls methodName on every layer contained in this group, passing any
+additional parameters. Has no effect if the layers contained do not
+implement methodName.
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the group, optionally specifying context of the iterator function.
+group.eachLayer(function (layer) {
+ layer.bindPopup('Hello');
+});
+
+
+
+
+ getLayer(<Number> id)
+ Layer
+ Returns the layer with the given internal ID.
+
+
+
+ getLayers()
+ Layer[]
+ Returns an array of all the layers added to the group.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Calls setZIndex on every layer contained in this group, passing the z-index.
+
+
+
+ getLayerId(<Layer> layer)
+ Number
+ Returns the internal ID for a layer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ FeatureGroup
Extended LayerGroup that makes it easier to do the same thing to all its member layers:
+
+bindPopup binds a popup to all of the layers at once (likewise with bindTooltip)
+- Events are propagated to the
FeatureGroup, so if the group has an event
+handler, it will handle events from any of the layers. This includes mouse events
+and custom events.
+- Has
layeradd and layerremove events
+
+
+
+Usage example
+
+
+
+
+
+
+
+L.featureGroup([marker1, marker2, polyline])
+ .bindPopup('Hello world!')
+ .on('click', function() { alert('Clicked on a member of the group!'); })
+ .addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.featureGroup(<Layer[]> layers?, <Object> options?)
+ Create a feature group, optionally given an initial set of layers and an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ layeradd
+ LayerEvent
+ Fired when a layer is added to this FeatureGroup
+
+
+ layerremove
+ LayerEvent
+ Fired when a layer is removed from this FeatureGroup
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setStyle(<Path options> style)
+ this
+ Sets the given path options to each layer of the group that has a setStyle method.
+
+
+
+ bringToFront()
+ this
+ Brings the layer group to the top of all other layers
+
+
+
+ bringToBack()
+ this
+ Brings the layer group to the back of all other layers
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the group.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the group.
+
+
+
+ removeLayer(<Number> id)
+ this
+ Removes the layer with the given internal ID from the group.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the group.
+
+
+
+ hasLayer(<Number> id)
+ Boolean
+ Returns true if the given internal ID is currently added to the group.
+
+
+
+ clearLayers()
+ this
+ Removes all the layers from the group.
+
+
+
+ invoke(<String> methodName, …)
+ this
+ Calls methodName on every layer contained in this group, passing any
+additional parameters. Has no effect if the layers contained do not
+implement methodName.
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the group, optionally specifying context of the iterator function.
+group.eachLayer(function (layer) {
+ layer.bindPopup('Hello');
+});
+
+
+
+
+ getLayer(<Number> id)
+ Layer
+ Returns the layer with the given internal ID.
+
+
+
+ getLayers()
+ Layer[]
+ Returns an array of all the layers added to the group.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Calls setZIndex on every layer contained in this group, passing the z-index.
+
+
+
+ getLayerId(<Layer> layer)
+ Number
+ Returns the internal ID for a layer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ GeoJSON
Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse
+GeoJSON data and display it on the map. Extends FeatureGroup.
+
+
+Usage example
+
+
+
+
+
+
+
+L.geoJSON(data, {
+ style: function (feature) {
+ return {color: feature.properties.color};
+ }
+}).bindPopup(function (layer) {
+ return layer.feature.properties.description;
+}).addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.geoJSON(<Object> geojson?, <GeoJSON options> options?)
+ Creates a GeoJSON layer. Optionally accepts an object in
+GeoJSON format to display on the map
+(you can alternatively add it later with addData method) and an options object.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pointToLayer
+ Function
+ *
+ A Function defining how GeoJSON points spawn Leaflet layers. It is internally
+called when data is added, passing the GeoJSON point feature and its LatLng.
+The default is to spawn a default Marker:
+function(geoJsonPoint, latlng) {
+ return L.marker(latlng);
+}
+
+
+
+ style
+ Function
+ *
+ A Function defining the Path options for styling GeoJSON lines and polygons,
+called internally when data is added.
+The default value is to not override any defaults:
+function (geoJsonFeature) {
+ return {}
+}
+
+
+
+ onEachFeature
+ Function
+ *
+ A Function that will be called once for each created Feature, after it has
+been created and styled. Useful for attaching events and popups to features.
+The default is to do nothing with the newly created layers:
+function (feature, layer) {}
+
+
+
+ filter
+ Function
+ *
+ A Function that will be used to decide whether to include a feature or not.
+The default is to include all features:
+function (geoJsonFeature) {
+ return true;
+}
+
+Note: dynamically changing the filter option will have effect only on newly
+added data. It will not re-evaluate already included features.
+
+
+ coordsToLatLng
+ Function
+ *
+ A Function that will be used for converting GeoJSON coordinates to LatLngs.
+The default is the coordsToLatLng static method.
+
+
+ markersInheritOptions
+ Boolean
+ false
+ Whether default Markers for "Point" type Features inherit from group options.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ layeradd
+ LayerEvent
+ Fired when a layer is added to this FeatureGroup
+
+
+ layerremove
+ LayerEvent
+ Fired when a layer is removed from this FeatureGroup
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addData(data)
+ this
+ Adds a GeoJSON object to the layer.
+
+
+
+ resetStyle(layer?)
+ this
+ Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
+If layer is omitted, the style of all features in the current layer is reset.
+
+
+
+ setStyle(style)
+ this
+ Changes styles of GeoJSON vector layers with the given style function.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the layer group to the top of all other layers
+
+
+
+ bringToBack()
+ this
+ Brings the layer group to the back of all other layers
+
+
+
+ getBounds()
+ LatLngBounds
+ Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ toGeoJSON(<Number> precision?)
+ Object
+ precision is the number of decimal places for coordinates.
+The default value is 6 places.
+Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).
+
+
+
+ addLayer(<Layer> layer)
+ this
+ Adds the given layer to the group.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Removes the given layer from the group.
+
+
+
+ removeLayer(<Number> id)
+ this
+ Removes the layer with the given internal ID from the group.
+
+
+
+ hasLayer(<Layer> layer)
+ Boolean
+ Returns true if the given layer is currently added to the group.
+
+
+
+ hasLayer(<Number> id)
+ Boolean
+ Returns true if the given internal ID is currently added to the group.
+
+
+
+ clearLayers()
+ this
+ Removes all the layers from the group.
+
+
+
+ invoke(<String> methodName, …)
+ this
+ Calls methodName on every layer contained in this group, passing any
+additional parameters. Has no effect if the layers contained do not
+implement methodName.
+
+
+
+ eachLayer(<Function> fn, <Object> context?)
+ this
+ Iterates over the layers of the group, optionally specifying context of the iterator function.
+group.eachLayer(function (layer) {
+ layer.bindPopup('Hello');
+});
+
+
+
+
+ getLayer(<Number> id)
+ Layer
+ Returns the layer with the given internal ID.
+
+
+
+ getLayers()
+ Layer[]
+ Returns an array of all the layers added to the group.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Calls setZIndex on every layer contained in this group, passing the z-index.
+
+
+
+ getLayerId(<Layer> layer)
+ Number
+ Returns the internal ID for a layer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+
+Functions
+
+
+
+
+
+There are several static functions which can be called without instantiating L.GeoJSON:
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ geometryToLayer(<Object> featureData, <GeoJSON options> options?)
+ Layer
+ Creates a Layer from a given GeoJSON feature. Can use a custom
+pointToLayer and/or coordsToLatLng
+functions if provided as options.
+
+
+ coordsToLatLng(<Array> coords)
+ LatLng
+ Creates a LatLng object from an array of 2 numbers (longitude, latitude)
+or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
+
+
+ coordsToLatLngs(<Array> coords, <Number> levelsDeep?, <Function> coordsToLatLng?)
+ Array
+ Creates a multidimensional array of LatLngs from a GeoJSON coordinates array.
+levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).
+Can use a custom coordsToLatLng function.
+
+
+ latLngToCoords(<LatLng> latlng, <Number> precision?)
+ Array
+ Reverse of coordsToLatLng
+
+
+ latLngsToCoords(<Array> latlngs, <Number> levelsDeep?, <Boolean> closed?)
+ Array
+ Reverse of coordsToLatLngs
+closed determines whether the first point should be appended to the end of the array to close the feature, only used when levelsDeep is 0. False by default.
+
+
+ asFeature(<Object> geojson)
+ Object
+ Normalize GeoJSON geometries/features into GeoJSON features.
+
+
+
+
+
+
+ GridLayer
Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces TileLayer.Canvas.
+GridLayer can be extended to create a tiled grid of HTML elements like <canvas>, <img> or <div>. GridLayer will handle creating and animating these DOM elements for you.
+
+
+Usage example
+
+
+
+Synchronous usage
+
+
+
+To create a custom layer, extend GridLayer and implement the createTile() method, which will be passed a Point object with the x, y, and z (zoom level) coordinates to draw your tile.
+var CanvasLayer = L.GridLayer.extend({
+ createTile: function(coords){
+ // create a <canvas> element for drawing
+ var tile = L.DomUtil.create('canvas', 'leaflet-tile');
+
+ // setup tile width and height according to the options
+ var size = this.getTileSize();
+ tile.width = size.x;
+ tile.height = size.y;
+
+ // get a canvas context and draw something on it using coords.x, coords.y and coords.z
+ var ctx = tile.getContext('2d');
+
+ // return the tile so it can be rendered on screen
+ return tile;
+ }
+});
+
+
+
+
+
+
+Asynchronous usage
+
+
+
+Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the done() callback.
+var CanvasLayer = L.GridLayer.extend({
+ createTile: function(coords, done){
+ var error;
+
+ // create a <canvas> element for drawing
+ var tile = L.DomUtil.create('canvas', 'leaflet-tile');
+
+ // setup tile width and height according to the options
+ var size = this.getTileSize();
+ tile.width = size.x;
+ tile.height = size.y;
+
+ // draw something asynchronously and pass the tile to the done() callback
+ setTimeout(function() {
+ done(error, tile);
+ }, 1000);
+
+ return tile;
+ }
+});
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.gridLayer(<GridLayer options> options?)
+ Creates a new instance of GridLayer with the supplied options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ tileSize
+ Number|Point
+ 256
+ Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
+
+
+ opacity
+ Number
+ 1.0
+ Opacity of the tiles. Can be used in the createTile() function.
+
+
+ updateWhenIdle
+ Boolean
+ (depends)
+ Load new tiles only when panning ends.
+true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
+false otherwise in order to display new tiles during panning, since it is easy to pan outside the
+keepBuffer option in desktop browsers.
+
+
+ updateWhenZooming
+ Boolean
+ true
+ By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
+
+
+ updateInterval
+ Number
+ 200
+ Tiles will not update more than once every updateInterval milliseconds when panning.
+
+
+ zIndex
+ Number
+ 1
+ The explicit zIndex of the tile layer.
+
+
+ bounds
+ LatLngBounds
+ undefined
+ If set, tiles will only be loaded inside the set LatLngBounds.
+
+
+ minZoom
+ Number
+ 0
+ The minimum zoom level down to which this layer will be displayed (inclusive).
+
+
+ maxZoom
+ Number
+ undefined
+ The maximum zoom level up to which this layer will be displayed (inclusive).
+
+
+ maxNativeZoom
+ Number
+ undefined
+ Maximum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels higher than maxNativeZoom will be loaded
+from maxNativeZoom level and auto-scaled.
+
+
+ minNativeZoom
+ Number
+ undefined
+ Minimum zoom number the tile source has available. If it is specified,
+the tiles on all zoom levels lower than minNativeZoom will be loaded
+from minNativeZoom level and auto-scaled.
+
+
+ noWrap
+ Boolean
+ false
+ Whether the layer is wrapped around the antimeridian. If true, the
+GridLayer will only be displayed once at low zoom levels. Has no
+effect when the map CRS doesn't wrap around. Can be used
+in combination with bounds to prevent requesting
+tiles outside the CRS limits.
+
+
+ pane
+ String
+ 'tilePane'
+ Map pane where the grid layer will be added.
+
+
+ className
+ String
+ ''
+ A custom class name to assign to the tile layer. Empty by default.
+
+
+ keepBuffer
+ Number
+ 2
+ When panning the map, keep this many rows and columns of tiles before unloading them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ loading
+ Event
+ Fired when the grid layer starts loading tiles.
+
+
+ tileunload
+ TileEvent
+ Fired when a tile is removed (e.g. when a tile goes off the screen).
+
+
+ tileloadstart
+ TileEvent
+ Fired when a tile is requested and starts loading.
+
+
+ tileerror
+ TileErrorEvent
+ Fired when there is an error loading a tile.
+
+
+ tileload
+ TileEvent
+ Fired when a tile loads.
+
+
+ load
+ Event
+ Fired when the grid layer loaded all visible tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bringToFront()
+ this
+ Brings the tile layer to the top of all tile layers.
+
+
+
+ bringToBack()
+ this
+ Brings the tile layer to the bottom of all tile layers.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTML element that contains the tiles for this layer.
+
+
+
+ setOpacity(<Number> opacity)
+ this
+ Changes the opacity of the grid layer.
+
+
+
+ setZIndex(<Number> zIndex)
+ this
+ Changes the zIndex of the grid layer.
+
+
+
+ isLoading()
+ Boolean
+ Returns true if any tile in the grid layer has not finished loading.
+
+
+
+ redraw()
+ this
+ Causes the layer to clear all the tiles and request them again.
+
+
+
+ getTileSize()
+ Point
+ Normalizes the tileSize option into a point. Used by the createTile() method.
+
+
+
+
+
+
+Extension methods
+
+Layers extending GridLayer shall reimplement the following method.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ createTile(<Object> coords, <Function> done?)
+ HTMLElement
+ Called only internally, must be overridden by classes extending GridLayer.
+Returns the HTMLElement corresponding to the given coords. If the done callback
+is specified, it must be called when the tile has finished loading and drawing.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ LatLng
Represents a geographical point with a certain latitude and longitude.
+
+
+Usage example
+
+
+
+
+
+
+
+var latlng = L.latLng(50.5, 30.5);
+
+All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:
+map.panTo([50, 30]);
+map.panTo({lon: 30, lat: 50});
+map.panTo({lat: 50, lng: 30});
+map.panTo(L.latLng(50, 30));
+
+Note that LatLng does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.latLng(<Number> latitude, <Number> longitude, <Number> altitude?)
+ Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).
+
+
+ L.latLng(<Array> coords)
+ Expects an array of the form [Number, Number] or [Number, Number, Number] instead.
+
+
+ L.latLng(<Object> coords)
+ Expects an plain object of the form {lat: Number, lng: Number} or {lat: Number, lng: Number, alt: Number} instead.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ equals(<LatLng> otherLatLng, <Number> maxMargin?)
+ Boolean
+ Returns true if the given LatLng point is at the same position (within a small margin of error). The margin of error can be overridden by setting maxMargin to a small number.
+
+
+
+ toString()
+ String
+ Returns a string representation of the point (for debugging purposes).
+
+
+
+ distanceTo(<LatLng> otherLatLng)
+ Number
+ Returns the distance (in meters) to the given LatLng calculated using the Spherical Law of Cosines.
+
+
+
+ wrap()
+ LatLng
+ Returns a new LatLng object with the longitude wrapped so it's always between -180 and +180 degrees.
+
+
+
+ toBounds(<Number> sizeInMeters)
+ LatLngBounds
+ Returns a new LatLngBounds object in which each boundary is sizeInMeters/2 meters apart from the LatLng.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ lat
+ Number
+ Latitude in degrees
+
+
+ lng
+ Number
+ Longitude in degrees
+
+
+ alt
+ Number
+ Altitude in meters (optional)
+
+
+
+
+
+
+ LatLngBounds
Represents a rectangular geographical area on a map.
+
+
+Usage example
+
+
+
+
+
+
+
+var corner1 = L.latLng(40.712, -74.227),
+corner2 = L.latLng(40.774, -74.125),
+bounds = L.latLngBounds(corner1, corner2);
+
+All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
+map.fitBounds([
+ [40.712, -74.227],
+ [40.774, -74.125]
+]);
+
+Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners outside the [-180, 180] degrees longitude range.
+Note that LatLngBounds does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.latLngBounds(<LatLng> corner1, <LatLng> corner2)
+ Creates a LatLngBounds object by defining two diagonally opposite corners of the rectangle.
+
+
+ L.latLngBounds(<LatLng[]> latlngs)
+ Creates a LatLngBounds object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with fitBounds.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ extend(<LatLng> latlng)
+ this
+ Extend the bounds to contain the given point
+
+
+
+ extend(<LatLngBounds> otherBounds)
+ this
+ Extend the bounds to contain the given bounds
+
+
+
+ pad(<Number> bufferRatio)
+ LatLngBounds
+ Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
+For example, a ratio of 0.5 extends the bounds by 50% in each direction.
+Negative values will retract the bounds.
+
+
+
+ getCenter()
+ LatLng
+ Returns the center point of the bounds.
+
+
+
+ getSouthWest()
+ LatLng
+ Returns the south-west point of the bounds.
+
+
+
+ getNorthEast()
+ LatLng
+ Returns the north-east point of the bounds.
+
+
+
+ getNorthWest()
+ LatLng
+ Returns the north-west point of the bounds.
+
+
+
+ getSouthEast()
+ LatLng
+ Returns the south-east point of the bounds.
+
+
+
+ getWest()
+ Number
+ Returns the west longitude of the bounds
+
+
+
+ getSouth()
+ Number
+ Returns the south latitude of the bounds
+
+
+
+ getEast()
+ Number
+ Returns the east longitude of the bounds
+
+
+
+ getNorth()
+ Number
+ Returns the north latitude of the bounds
+
+
+
+ contains(<LatLngBounds> otherBounds)
+ Boolean
+ Returns true if the rectangle contains the given one.
+
+
+
+ contains(<LatLng> latlng)
+ Boolean
+ Returns true if the rectangle contains the given point.
+
+
+
+ intersects(<LatLngBounds> otherBounds)
+ Boolean
+ Returns true if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
+
+
+
+ overlaps(<LatLngBounds> otherBounds)
+ Boolean
+ Returns true if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
+
+
+
+ toBBoxString()
+ String
+ Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
+
+
+
+ equals(<LatLngBounds> otherBounds, <Number> maxMargin?)
+ Boolean
+ Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting maxMargin to a small number.
+
+
+
+ isValid()
+ Boolean
+ Returns true if the bounds are properly initialized.
+
+
+
+
+
+
+
+ Point
Represents a point with x and y coordinates in pixels.
+
+
+Usage example
+
+
+
+
+
+
+
+var point = L.point(200, 300);
+
+All Leaflet methods and options that accept Point objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:
+map.panBy([200, 300]);
+map.panBy(L.point(200, 300));
+
+Note that Point does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.point(<Number> x, <Number> y, <Boolean> round?)
+ Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values.
+
+
+ L.point(<Number[]> coords)
+ Expects an array of the form [x, y] instead.
+
+
+ L.point(<Object> coords)
+ Expects a plain object of the form {x: Number, y: Number} instead.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ clone()
+ Point
+ Returns a copy of the current point.
+
+
+
+ add(<Point> otherPoint)
+ Point
+ Returns the result of addition of the current and the given points.
+
+
+
+ subtract(<Point> otherPoint)
+ Point
+ Returns the result of subtraction of the given point from the current.
+
+
+
+ divideBy(<Number> num)
+ Point
+ Returns the result of division of the current point by the given number.
+
+
+
+ multiplyBy(<Number> num)
+ Point
+ Returns the result of multiplication of the current point by the given number.
+
+
+
+ scaleBy(<Point> scale)
+ Point
+ Multiply each coordinate of the current point by each coordinate of
+scale. In linear algebra terms, multiply the point by the
+scaling matrix
+defined by scale.
+
+
+
+ unscaleBy(<Point> scale)
+ Point
+ Inverse of scaleBy. Divide each coordinate of the current point by
+each coordinate of scale.
+
+
+
+ round()
+ Point
+ Returns a copy of the current point with rounded coordinates.
+
+
+
+ floor()
+ Point
+ Returns a copy of the current point with floored coordinates (rounded down).
+
+
+
+ ceil()
+ Point
+ Returns a copy of the current point with ceiled coordinates (rounded up).
+
+
+
+ trunc()
+ Point
+ Returns a copy of the current point with truncated coordinates (rounded towards zero).
+
+
+
+ distanceTo(<Point> otherPoint)
+ Number
+ Returns the cartesian distance between the current and the given points.
+
+
+
+ equals(<Point> otherPoint)
+ Boolean
+ Returns true if the given point has the same coordinates.
+
+
+
+ contains(<Point> otherPoint)
+ Boolean
+ Returns true if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
+
+
+
+ toString()
+ String
+ Returns a string representation of the point for debugging purposes.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ x
+ Number
+ The x coordinate of the point
+
+
+ y
+ Number
+ The y coordinate of the point
+
+
+
+
+
+
+ Bounds
Represents a rectangular area in pixel coordinates.
+
+
+Usage example
+
+
+
+
+
+
+
+var p1 = L.point(10, 10),
+p2 = L.point(40, 60),
+bounds = L.bounds(p1, p2);
+
+All Leaflet methods that accept Bounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
+otherBounds.intersects([[10, 10], [40, 60]]);
+
+Note that Bounds does not inherit from Leaflet's Class object,
+which means new classes can't inherit from it, and new methods
+can't be added to it with the include function.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.bounds(<Point> corner1, <Point> corner2)
+ Creates a Bounds object from two corners coordinate pairs.
+
+
+ L.bounds(<Point[]> points)
+ Creates a Bounds object from the given array of points.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ extend(<Point> point)
+ this
+ Extends the bounds to contain the given point.
+
+
+
+ getCenter(<Boolean> round?)
+ Point
+ Returns the center point of the bounds.
+
+
+
+ getBottomLeft()
+ Point
+ Returns the bottom-left point of the bounds.
+
+
+
+ getTopRight()
+ Point
+ Returns the top-right point of the bounds.
+
+
+
+ getTopLeft()
+ Point
+ Returns the top-left point of the bounds (i.e. this.min).
+
+
+
+ getBottomRight()
+ Point
+ Returns the bottom-right point of the bounds (i.e. this.max).
+
+
+
+ getSize()
+ Point
+ Returns the size of the given bounds
+
+
+
+ contains(<Bounds> otherBounds)
+ Boolean
+ Returns true if the rectangle contains the given one.
+
+
+
+ contains(<Point> point)
+ Boolean
+ Returns true if the rectangle contains the given point.
+
+
+
+ intersects(<Bounds> otherBounds)
+ Boolean
+ Returns true if the rectangle intersects the given bounds. Two bounds
+intersect if they have at least one point in common.
+
+
+
+ overlaps(<Bounds> otherBounds)
+ Boolean
+ Returns true if the rectangle overlaps the given bounds. Two bounds
+overlap if their intersection is an area.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ min
+ Point
+ The top left corner of the rectangle.
+
+
+ max
+ Point
+ The bottom right corner of the rectangle.
+
+
+
+
+
+
+ Icon
Represents an icon to provide when creating a marker.
+
+
+Usage example
+
+
+
+
+
+
+
+var myIcon = L.icon({
+ iconUrl: 'my-icon.png',
+ iconSize: [38, 95],
+ iconAnchor: [22, 94],
+ popupAnchor: [-3, -76],
+ shadowUrl: 'my-icon-shadow.png',
+ shadowSize: [68, 95],
+ shadowAnchor: [22, 94]
+});
+
+L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
+
+L.Icon.Default extends L.Icon and is the blue icon Leaflet uses for markers by default.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.icon(<Icon options> options)
+ Creates an icon instance with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ iconUrl
+ String
+ null
+ (required) The URL to the icon image (absolute or relative to your script path).
+
+
+ iconRetinaUrl
+ String
+ null
+ The URL to a retina sized version of the icon image (absolute or relative to your
+script path). Used for Retina screen devices.
+
+
+ iconSize
+ Point
+ null
+ Size of the icon image in pixels.
+
+
+ iconAnchor
+ Point
+ null
+ The coordinates of the "tip" of the icon (relative to its top left corner). The icon
+will be aligned so that this point is at the marker's geographical location. Centered
+by default if size is specified, also can be set in CSS with negative margins.
+
+
+ popupAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which popups will "open", relative to the icon anchor.
+
+
+ tooltipAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which tooltips will "open", relative to the icon anchor.
+
+
+ shadowUrl
+ String
+ null
+ The URL to the icon shadow image. If not specified, no shadow image will be created.
+
+
+ shadowRetinaUrl
+ String
+ null
+
+
+
+ shadowSize
+ Point
+ null
+ Size of the shadow image in pixels.
+
+
+ shadowAnchor
+ Point
+ null
+ The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
+as iconAnchor if not specified).
+
+
+ className
+ String
+ ''
+ A custom class name to assign to both icon and shadow images. Empty by default.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ createIcon(<HTMLElement> oldIcon?)
+ HTMLElement
+ Called internally when the icon has to be shown, returns a <img> HTML element
+styled according to the options.
+
+
+
+ createShadow(<HTMLElement> oldIcon?)
+ HTMLElement
+ As createIcon, but for the shadow beneath it.
+
+
+
+
+
+
+
+
+
+
+Icon.Default
+
+
+
+
+
+A trivial subclass of Icon, represents the icon to use in Markers when
+no icon is specified. Points to the blue marker image distributed with Leaflet
+releases.
+In order to customize the default icon, just change the properties of L.Icon.Default.prototype.options
+(which is a set of Icon options).
+If you want to completely replace the default icon, override the
+L.Marker.prototype.options.icon with your own icon instead.
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ imagePath
+ String
+
+ Icon.Default will try to auto-detect the location of the
+blue icon images. If you are placing these images in a non-standard
+way, set this option to point to the right path.
+
+
+
+
+
+
+ DivIcon
Represents a lightweight icon for markers that uses a simple <div>
+element instead of an image. Inherits from Icon but ignores the iconUrl and shadow options.
+
+
+Usage example
+
+
+
+
+
+
+
+var myIcon = L.divIcon({className: 'my-div-icon'});
+// you can set .my-div-icon styles in CSS
+
+L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
+
+By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.divIcon(<DivIcon options> options)
+ Creates a DivIcon instance with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ html
+ String|HTMLElement
+ ''
+ Custom HTML code to put inside the div element, empty by default. Alternatively,
+an instance of HTMLElement.
+
+
+ bgPos
+ Point
+ [0, 0]
+ Optional relative position of the background, in pixels
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ iconUrl
+ String
+ null
+ (required) The URL to the icon image (absolute or relative to your script path).
+
+
+ iconRetinaUrl
+ String
+ null
+ The URL to a retina sized version of the icon image (absolute or relative to your
+script path). Used for Retina screen devices.
+
+
+ iconSize
+ Point
+ null
+ Size of the icon image in pixels.
+
+
+ iconAnchor
+ Point
+ null
+ The coordinates of the "tip" of the icon (relative to its top left corner). The icon
+will be aligned so that this point is at the marker's geographical location. Centered
+by default if size is specified, also can be set in CSS with negative margins.
+
+
+ popupAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which popups will "open", relative to the icon anchor.
+
+
+ tooltipAnchor
+ Point
+ [0, 0]
+ The coordinates of the point from which tooltips will "open", relative to the icon anchor.
+
+
+ shadowUrl
+ String
+ null
+ The URL to the icon shadow image. If not specified, no shadow image will be created.
+
+
+ shadowRetinaUrl
+ String
+ null
+
+
+
+ shadowSize
+ Point
+ null
+ Size of the shadow image in pixels.
+
+
+ shadowAnchor
+ Point
+ null
+ The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
+as iconAnchor if not specified).
+
+
+ className
+ String
+ ''
+ A custom class name to assign to both icon and shadow images. Empty by default.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ createIcon(<HTMLElement> oldIcon?)
+ HTMLElement
+ Called internally when the icon has to be shown, returns a <img> HTML element
+styled according to the options.
+
+
+
+ createShadow(<HTMLElement> oldIcon?)
+ HTMLElement
+ As createIcon, but for the shadow beneath it.
+
+
+
+
+
+
+
+
+ Control.Zoom
A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its zoomControl option to false. Extends Control.
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.zoom(<Control.Zoom options> options)
+ Creates a zoom control
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ zoomInText
+ String
+ '+'
+ The text set on the 'zoom in' button.
+
+
+ zoomInTitle
+ String
+ 'Zoom in'
+ The title set on the 'zoom in' button.
+
+
+ zoomOutText
+ String
+ '−
+ '
+The text set on the 'zoom out' button.
+
+
+ zoomOutTitle
+ String
+ 'Zoom out'
+ The title set on the 'zoom out' button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Control.Attribution
The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its attributionControl option to false, and it fetches attribution texts from layers with the getAttribution method automatically. Extends Control.
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.attribution(<Control.Attribution options> options)
+ Creates an attribution control.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ prefix
+ String
+ 'Leaflet'
+ The HTML text shown before the attributions. Pass false to disable.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ setPrefix(<String> prefix)
+ this
+ Sets the text before the attributions.
+
+
+
+ addAttribution(<String> text)
+ this
+ Adds an attribution text (e.g. 'Vector data © Mapbox').
+
+
+
+ removeAttribution(<String> text)
+ this
+ Removes an attribution text.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Control.Layers
The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the detailed example). Extends Control.
+
+
+Usage example
+
+
+
+
+
+
+
+var baseLayers = {
+ "Mapbox": mapbox,
+ "OpenStreetMap": osm
+};
+
+var overlays = {
+ "Marker": marker,
+ "Roads": roadsLayer
+};
+
+L.control.layers(baseLayers, overlays).addTo(map);
+
+The baseLayers and overlays parameters are object literals with layer names as keys and Layer objects as values:
+{
+ "<someName1>": layer1,
+ "<someName2>": layer2
+}
+
+The layer names can contain HTML, which allows you to add additional styling to the items:
+{"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.layers(<Object> baselayers?, <Object> overlays?, <Control.Layers options> options?)
+ Creates a layers control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ collapsed
+ Boolean
+ true
+ If true, the control will be collapsed into an icon and expanded on mouse hover or touch.
+
+
+ autoZIndex
+ Boolean
+ true
+ If true, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
+
+
+ hideSingleBase
+ Boolean
+ false
+ If true, the base layers in the control will be hidden when there is only one.
+
+
+ sortLayers
+ Boolean
+ false
+ Whether to sort the layers. When false, layers will keep the order
+in which they were added to the control.
+
+
+ sortFunction
+ Function
+ *
+ A compare function
+that will be used for sorting the layers, when sortLayers is true.
+The function receives both the L.Layer instances and their names, as in
+sortFunction(layerA, layerB, nameA, nameB).
+By default, it sorts layers alphabetically by their name.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addBaseLayer(<Layer> layer, <String> name)
+ this
+ Adds a base layer (radio button entry) with the given name to the control.
+
+
+
+ addOverlay(<Layer> layer, <String> name)
+ this
+ Adds an overlay (checkbox entry) with the given name to the control.
+
+
+
+ removeLayer(<Layer> layer)
+ this
+ Remove the given layer from the control.
+
+
+
+ expand()
+ this
+ Expand the control container if collapsed.
+
+
+
+ collapse()
+ this
+ Collapse the control container if expanded.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Control.Scale
A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends Control.
+
+
+Usage example
+
+
+
+
+
+
+
+L.control.scale().addTo(map);
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.control.scale(<Control.Scale options> options?)
+ Creates an scale control with the given options.
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ maxWidth
+ Number
+ 100
+ Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
+
+
+ metric
+ Boolean
+ True
+ Whether to show the metric scale line (m/km).
+
+
+ imperial
+ Boolean
+ True
+ Whether to show the imperial scale line (mi/ft).
+
+
+ updateWhenIdle
+ Boolean
+ false
+ If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+
+
+ Browser
A namespace with static properties for browser/feature detection used by Leaflet internally.
+
+
+Usage example
+
+
+
+
+
+
+
+if (L.Browser.ielt9) {
+ alert('Upgrade your browser, dude!');
+}
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ ie
+ Boolean
+ true for all Internet Explorer versions (not Edge).
+
+
+ ielt9
+ Boolean
+ true for Internet Explorer versions less than 9.
+
+
+ edge
+ Boolean
+ true for the Edge web browser.
+
+
+ webkit
+ Boolean
+ true for webkit-based browsers like Chrome and Safari (including mobile versions).
+
+
+ android
+ Boolean
+ true for any browser running on an Android platform.
+
+
+ android23
+ Boolean
+ true for browsers running on Android 2 or Android 3.
+
+
+ androidStock
+ Boolean
+ true for the Android stock browser (i.e. not Chrome)
+
+
+ opera
+ Boolean
+ true for the Opera browser
+
+
+ chrome
+ Boolean
+ true for the Chrome browser.
+
+
+ gecko
+ Boolean
+ true for gecko-based browsers like Firefox.
+
+
+ safari
+ Boolean
+ true for the Safari browser.
+
+
+ opera12
+ Boolean
+ true for the Opera browser supporting CSS transforms (version 12 or later).
+
+
+ win
+ Boolean
+ true when the browser is running in a Windows platform
+
+
+ ie3d
+ Boolean
+ true for all Internet Explorer versions supporting CSS transforms.
+
+
+ webkit3d
+ Boolean
+ true for webkit-based browsers supporting CSS transforms.
+
+
+ gecko3d
+ Boolean
+ true for gecko-based browsers supporting CSS transforms.
+
+
+ any3d
+ Boolean
+ true for all browsers supporting CSS transforms.
+
+
+ mobile
+ Boolean
+ true for all browsers running in a mobile device.
+
+
+ mobileWebkit
+ Boolean
+ true for all webkit-based browsers in a mobile device.
+
+
+ mobileWebkit3d
+ Boolean
+ true for all webkit-based browsers in a mobile device supporting CSS transforms.
+
+
+ msPointer
+ Boolean
+ true for browsers implementing the Microsoft touch events model (notably IE10).
+
+
+ pointer
+ Boolean
+ true for all browsers supporting pointer events.
+
+
+ touch
+ Boolean
+ true for all browsers supporting touch events.
+This does not necessarily mean that the browser is running in a computer with
+a touchscreen, it only means that the browser is capable of understanding
+touch events.
+
+
+ mobileOpera
+ Boolean
+ true for the Opera browser in a mobile device.
+
+
+ mobileGecko
+ Boolean
+ true for gecko-based browsers running in a mobile device.
+
+
+ retina
+ Boolean
+ true for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
+
+
+ passiveEvents
+ Boolean
+ true for browsers that support passive events.
+
+
+ canvas
+ Boolean
+ true when the browser supports <canvas>.
+
+
+ svg
+ Boolean
+ true when the browser supports SVG.
+
+
+ vml
+ Boolean
+ true if the browser supports VML.
+
+
+
+
+
+
+ Util
Various utility functions, used by Leaflet internally.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ extend(<Object> dest, <Object> src?)
+ Object
+ Merges the properties of the src object (or multiple objects) into dest object and returns the latter. Has an L.extend shortcut.
+
+
+ create(<Object> proto, <Object> properties?)
+ Object
+ Compatibility polyfill for Object.create
+
+
+ bind(<Function> fn, …)
+ Function
+ Returns a new function bound to the arguments passed, like Function.prototype.bind.
+Has a L.bind() shortcut.
+
+
+ stamp(<Object> obj)
+ Number
+ Returns the unique ID of an object, assigning it one if it doesn't have it.
+
+
+ throttle(<Function> fn, <Number> time, <Object> context)
+ Function
+ Returns a function which executes function fn with the given scope context
+(so that the this keyword refers to context inside fn's code). The function
+fn will be called no more than one time per given amount of time. The arguments
+received by the bound function will be any arguments passed when binding the
+function, followed by any arguments passed when invoking the bound function.
+Has an L.throttle shortcut.
+
+
+ wrapNum(<Number> num, <Number[]> range, <Boolean> includeMax?)
+ Number
+ Returns the number num modulo range in such a way so it lies within
+range[0] and range[1]. The returned value will be always smaller than
+range[1] unless includeMax is set to true.
+
+
+ falseFn()
+ Function
+ Returns a function which always returns false.
+
+
+ formatNum(<Number> num, <Number> digits?)
+ Number
+ Returns the number num rounded to digits decimals, or to 6 decimals by default.
+
+
+ trim(<String> str)
+ String
+ Compatibility polyfill for String.prototype.trim
+
+
+ splitWords(<String> str)
+ String[]
+ Trims and splits the string on whitespace and returns the array of parts.
+
+
+ setOptions(<Object> obj, <Object> options)
+ Object
+ Merges the given properties to the options of the obj object, returning the resulting options. See Class options. Has an L.setOptions shortcut.
+
+
+ getParamString(<Object> obj, <String> existingUrl?, <Boolean> uppercase?)
+ String
+ Converts an object into a parameter URL string, e.g. {a: "foo", b: "bar"}
+translates to '?a=foo&b=bar'. If existingUrl is set, the parameters will
+be appended at the end. If uppercase is true, the parameter names will
+be uppercased (e.g. '?A=foo&B=bar')
+
+
+ template(<String> str, <Object> data)
+ String
+ Simple templating facility, accepts a template string of the form 'Hello {a}, {b}'
+and a data object like {a: 'foo', b: 'bar'}, returns evaluated string
+('Hello foo, bar'). You can also specify functions instead of strings for
+data values — they will be evaluated passing data as an argument.
+
+
+ isArray(obj)
+ Boolean
+ Compatibility polyfill for Array.isArray
+
+
+ indexOf(<Array> array, <Object> el)
+ Number
+ Compatibility polyfill for Array.prototype.indexOf
+
+
+ requestAnimFrame(<Function> fn, <Object> context?, <Boolean> immediate?)
+ Number
+ Schedules fn to be executed when the browser repaints. fn is bound to
+context if given. When immediate is set, fn is called immediately if
+the browser doesn't have native support for
+window.requestAnimationFrame,
+otherwise it's delayed. Returns a request ID that can be used to cancel the request.
+
+
+ cancelAnimFrame(<Number> id)
+ undefined
+ Cancels a previous requestAnimFrame. See also window.cancelAnimationFrame.
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ lastId
+ Number
+ Last unique ID used by stamp()
+
+
+ emptyImageUrl
+ String
+ Data URI string containing a base64-encoded empty GIF image.
+Used as a hack to free memory from unused images on WebKit-powered
+mobile devices (by setting image src to this string).
+
+
+
+
+
+
+ Transformation
Represents an affine transformation: a set of coefficients a, b, c, d
+for transforming a point of a form (x, y) into (a*x + b, c*y + d) and doing
+the reverse. Used by Leaflet in its projections code.
+
+
+Usage example
+
+
+
+
+
+
+
+var transformation = L.transformation(2, 5, -1, 10),
+ p = L.point(1, 2),
+ p2 = transformation.transform(p), // L.point(7, 8)
+ p3 = transformation.untransform(p2); // L.point(1, 2)
+
+
+
+
+
+
+
+
+Creation
+
+
+
+
+
+
+
+
+ Factory
+ Description
+
+
+
+ L.transformation(<Number> a, <Number> b, <Number> c, <Number> d)
+ Instantiates a Transformation object with the given coefficients.
+
+
+ L.transformation(<Array> coefficients)
+ Expects an coefficients array of the form
+[a: Number, b: Number, c: Number, d: Number].
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ transform(<Point> point, <Number> scale?)
+ Point
+ Returns a transformed point, optionally multiplied by the given scale.
+Only accepts actual L.Point instances, not arrays.
+
+
+
+ untransform(<Point> point, <Number> scale?)
+ Point
+ Returns the reverse transformation of the given point, optionally divided
+by the given scale. Only accepts actual L.Point instances, not arrays.
+
+
+
+
+
+
+
+ LineUtil
Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ simplify(<Point[]> points, <Number> tolerance)
+ Point[]
+ Dramatically reduces the number of points in a polyline while retaining
+its shape and returns a new array of simplified points, using the
+Douglas-Peucker algorithm.
+Used for a huge performance boost when processing/displaying Leaflet polylines for
+each zoom level and also reducing visual noise. tolerance affects the amount of
+simplification (lesser value means higher quality but slower and with more points).
+Also released as a separated micro-library Simplify.js.
+
+
+ pointToSegmentDistance(<Point> p, <Point> p1, <Point> p2)
+ Number
+ Returns the distance between point p and segment p1 to p2.
+
+
+ closestPointOnSegment(<Point> p, <Point> p1, <Point> p2)
+ Number
+ Returns the closest point from a point p on a segment p1 to p2.
+
+
+ clipSegment(<Point> a, <Point> b, <Bounds> bounds, <Boolean> useLastCode?, <Boolean> round?)
+ Point[]|Boolean
+ Clips the segment a to b by rectangular bounds with the
+Cohen-Sutherland algorithm
+(modifying the segment points directly!). Used by Leaflet to only show polyline
+points that are on the screen or near, increasing performance.
+
+
+ isFlat(<LatLng[]> latlngs)
+ Boolean
+ Returns true if latlngs is a flat array, false is nested.
+
+
+
+
+
+
+ PolyUtil
Various utility functions for polygon geometries.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ clipPolygon(<Point[]> points, <Bounds> bounds, <Boolean> round?)
+ Point[]
+ Clips the polygon geometry defined by the given points by the given bounds (using the Sutherland-Hodgman algorithm).
+Used by Leaflet to only show polygon points that are on the screen or near, increasing
+performance. Note that polygon points needs different algorithm for clipping
+than polyline, so there's a separate method for it.
+
+
+
+
+
+
+ DomEvent
Utility functions to work with the DOM events, used by Leaflet internally.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ on(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular DOM event type of the
+element el. You can optionally specify the context of the listener
+(object the this keyword will point to). You can also pass several
+space-separated types (e.g. 'click dblclick').
+
+
+ on(<HTMLElement> el, <Object> eventMap, <Object> context?)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+ off(<HTMLElement> el, <String> types, <Function> fn, <Object> context?)
+ this
+ Removes a previously added listener function.
+Note that if you passed a custom context to on, you must pass the same
+context to off in order to remove the listener.
+
+
+ off(<HTMLElement> el, <Object> eventMap, <Object> context?)
+ this
+ Removes a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+ stopPropagation(<DOMEvent> ev)
+ this
+ Stop the given event from propagation to parent elements. Used inside the listener functions:
+L.DomEvent.on(div, 'click', function (ev) {
+ L.DomEvent.stopPropagation(ev);
+});
+
+
+
+ disableScrollPropagation(<HTMLElement> el)
+ this
+ Adds stopPropagation to the element's 'wheel' events (plus browser variants).
+
+
+ disableClickPropagation(<HTMLElement> el)
+ this
+ Adds stopPropagation to the element's 'click', 'doubleclick',
+'mousedown' and 'touchstart' events (plus browser variants).
+
+
+ preventDefault(<DOMEvent> ev)
+ this
+ Prevents the default action of the DOM Event ev from happening (such as
+following a link in the href of the a element, or doing a POST request
+with page reload when a <form> is submitted).
+Use it inside listener functions.
+
+
+ stop(<DOMEvent> ev)
+ this
+ Does stopPropagation and preventDefault at the same time.
+
+
+ getMousePosition(<DOMEvent> ev, <HTMLElement> container?)
+ Point
+ Gets normalized mouse position from a DOM event relative to the
+container (border excluded) or to the whole page if not specified.
+
+
+ getWheelDelta(<DOMEvent> ev)
+ Number
+ Gets normalized wheel delta from a wheel DOM event, in vertical
+pixels scrolled (negative if scrolling down).
+Events from pointing devices without precise scrolling are mapped to
+a best guess of 60 pixels.
+
+
+ addListener(…)
+ this
+ Alias to L.DomEvent.on
+
+
+ removeListener(…)
+ this
+ Alias to L.DomEvent.off
+
+
+
+
+
+
+ DomUtil
Utility functions to work with the DOM
+tree, used by Leaflet internally.
+Most functions expecting or returning a HTMLElement also work for
+SVG elements. The only difference is that classes refer to CSS classes
+in HTML and SVG classes in SVG.
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ get(<String|HTMLElement> id)
+ HTMLElement
+ Returns an element given its DOM id, or returns the element itself
+if it was passed directly.
+
+
+ getStyle(<HTMLElement> el, <String> styleAttrib)
+ String
+ Returns the value for a certain style attribute on an element,
+including computed values or values set through CSS.
+
+
+ create(<String> tagName, <String> className?, <HTMLElement> container?)
+ HTMLElement
+ Creates an HTML element with tagName, sets its class to className, and optionally appends it to container element.
+
+
+ remove(<HTMLElement> el)
+
+ Removes el from its parent element
+
+
+ empty(<HTMLElement> el)
+
+ Removes all of el's children elements from el
+
+
+ toFront(<HTMLElement> el)
+
+ Makes el the last child of its parent, so it renders in front of the other children.
+
+
+ toBack(<HTMLElement> el)
+
+ Makes el the first child of its parent, so it renders behind the other children.
+
+
+ hasClass(<HTMLElement> el, <String> name)
+ Boolean
+ Returns true if the element's class attribute contains name.
+
+
+ addClass(<HTMLElement> el, <String> name)
+
+ Adds name to the element's class attribute.
+
+
+ removeClass(<HTMLElement> el, <String> name)
+
+ Removes name from the element's class attribute.
+
+
+ setClass(<HTMLElement> el, <String> name)
+
+ Sets the element's class.
+
+
+ getClass(<HTMLElement> el)
+ String
+ Returns the element's class.
+
+
+ setOpacity(<HTMLElement> el, <Number> opacity)
+
+ Set the opacity of an element (including old IE support).
+opacity must be a number from 0 to 1.
+
+
+ testProp(<String[]> props)
+ String|false
+ Goes through the array of style names and returns the first name
+that is a valid style name for an element. If no such name is found,
+it returns false. Useful for vendor-prefixed styles like transform.
+
+
+ setTransform(<HTMLElement> el, <Point> offset, <Number> scale?)
+
+ Resets the 3D CSS transform of el so it is translated by offset pixels
+and optionally scaled by scale. Does not have an effect if the
+browser doesn't support 3D CSS transforms.
+
+
+ setPosition(<HTMLElement> el, <Point> position)
+
+ Sets the position of el to coordinates specified by position,
+using CSS translate or top/left positioning depending on the browser
+(used by Leaflet internally to position its layers).
+
+
+ getPosition(<HTMLElement> el)
+ Point
+ Returns the coordinates of an element previously positioned with setPosition.
+
+
+ disableTextSelection()
+
+ Prevents the user from generating selectstart DOM events, usually generated
+when the user drags the mouse through a page with text. Used internally
+by Leaflet to override the behaviour of any click-and-drag interaction on
+the map. Affects drag interactions on the whole document.
+
+
+ enableTextSelection()
+
+ Cancels the effects of a previous L.DomUtil.disableTextSelection.
+
+
+ disableImageDrag()
+
+ As L.DomUtil.disableTextSelection, but
+for dragstart DOM events, usually generated when the user drags an image.
+
+
+ enableImageDrag()
+
+ Cancels the effects of a previous L.DomUtil.disableImageDrag.
+
+
+ preventOutline(<HTMLElement> el)
+
+ Makes the outline
+of the element el invisible. Used internally by Leaflet to prevent
+focusable elements from displaying an outline when the user performs a
+drag interaction on them.
+
+
+ restoreOutline()
+
+ Cancels the effects of a previous L.DomUtil.preventOutline.
+
+
+ getSizedParentNode(<HTMLElement> el)
+ HTMLElement
+ Finds the closest parent node which size (width and height) is not null.
+
+
+ getScale(<HTMLElement> el)
+ Object
+ Computes the CSS scale currently applied on the element.
+Returns an object with x and y members as horizontal and vertical scales respectively,
+and boundingClientRect as the result of getBoundingClientRect().
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ TRANSFORM
+ String
+ Vendor-prefixed transform style name (e.g. 'webkitTransform' for WebKit).
+
+
+ TRANSITION
+ String
+ Vendor-prefixed transition style name.
+
+
+ TRANSITION_END
+ String
+ Vendor-prefixed transitionend event name.
+
+
+
+
+
+
+ PosAnimation
Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.
+
+
+Usage example
+
+
+
+
+
+
+
+var fx = new L.PosAnimation();
+fx.run(el, [300, 500], 0.5);
+
+
+
+
+
+
+
+
+Constructor
+
+
+
+
+
+
+
+
+ Constructor
+ Description
+
+
+
+ L.PosAnimation()
+ Creates a PosAnimation object.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ start
+ Event
+ Fired when the animation starts
+
+
+ step
+ Event
+ Fired continuously during the animation.
+
+
+ end
+ Event
+ Fired when the animation ends.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ run(<HTMLElement> el, <Point> newPos, <Number> duration?, <Number> easeLinearity?)
+
+ Run an animation of a given element to a new position, optionally setting
+duration in seconds (0.25 by default) and easing linearity factor (3rd
+argument of the cubic bezier curve,
+0.5 by default).
+
+
+
+ stop()
+
+ Stops the animation (if currently running).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Draggable
A class for making DOM elements draggable (including touch support).
+Used internally for map and marker dragging. Only works for elements
+that were positioned with L.DomUtil.setPosition.
+
+
+Usage example
+
+
+
+
+
+
+
+var draggable = new L.Draggable(elementToDrag);
+draggable.enable();
+
+
+
+
+
+
+
+
+Constructor
+
+
+
+
+
+
+
+
+ Constructor
+ Description
+
+
+
+ L.Draggable(<HTMLElement> el, <HTMLElement> dragHandle?, <Boolean> preventOutline?, <Draggable options> options?)
+ Creates a Draggable object for moving el when you start dragging the dragHandle element (equals el itself by default).
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ clickTolerance
+ Number
+ 3
+ The max number of pixels a user can shift the mouse pointer during a click
+for it to be considered a valid click (as opposed to a mouse drag).
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ down
+ Event
+ Fired when a drag is about to start.
+
+
+ dragstart
+ Event
+ Fired when a drag starts
+
+
+ predrag
+ Event
+ Fired continuously during dragging before each corresponding
+update of the element's position.
+
+
+ drag
+ Event
+ Fired continuously during dragging.
+
+
+ dragend
+ DragEndEvent
+ Fired when the drag ends.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ enable()
+
+ Enables the dragging ability
+
+
+
+ disable()
+
+ Disables the dragging ability
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Class
L.Class powers the OOP facilities of Leaflet and is used to create almost all of the Leaflet classes documented here.
+In addition to implementing a simple classical inheritance model, it introduces several special properties for convenient code organization — options, includes and statics.
+
+
+Usage example
+
+
+
+
+
+
+
+var MyClass = L.Class.extend({
+initialize: function (greeter) {
+ this.greeter = greeter;
+ // class constructor
+},
+
+greet: function (name) {
+ alert(this.greeter + ', ' + name)
+ }
+});
+
+// create instance of MyClass, passing "Hello" to the constructor
+var a = new MyClass("Hello");
+
+// call greet method, alerting "Hello, World"
+a.greet("World");
+
+
+
+
+
+
+Class Factories
+
+
+
+You may have noticed that Leaflet objects are created without using
+the new keyword. This is achieved by complementing each class with a
+lowercase factory method:
+new L.Map('map'); // becomes:
+L.map('map');
+
+The factories are implemented very easily, and you can do this for your own classes:
+L.map = function (id, options) {
+ return new L.Map(id, options);
+};
+
+
+
+
+
+
+Inheritance
+
+
+
+You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it:
+var MyChildClass = MyClass.extend({
+ // ... new properties and methods
+});
+
+This will create a class that inherits all methods and properties of the parent class (through a proper prototype chain), adding or overriding the ones you pass to extend. It will also properly react to instanceof:
+var a = new MyChildClass();
+a instanceof MyChildClass; // true
+a instanceof MyClass; // true
+
+You can call parent methods (including constructor) from corresponding child ones (as you do with super calls in other languages) by accessing parent class prototype and using JavaScript's call or apply:
+var MyChildClass = MyClass.extend({
+ initialize: function () {
+ MyClass.prototype.initialize.call(this, "Yo");
+ },
+
+ greet: function (name) {
+ MyClass.prototype.greet.call(this, 'bro ' + name + '!');
+ }
+});
+
+var a = new MyChildClass();
+a.greet('Jason'); // alerts "Yo, bro Jason!"
+
+
+
+
+
+
+Options
+
+
+
+options is a special property that unlike other objects that you pass
+to extend will be merged with the parent one instead of overriding it
+completely, which makes managing configuration of objects and default
+values convenient:
+var MyClass = L.Class.extend({
+ options: {
+ myOption1: 'foo',
+ myOption2: 'bar'
+ }
+});
+
+var MyChildClass = MyClass.extend({
+ options: {
+ myOption1: 'baz',
+ myOption3: 5
+ }
+});
+
+var a = new MyChildClass();
+a.options.myOption1; // 'baz'
+a.options.myOption2; // 'bar'
+a.options.myOption3; // 5
+
+There's also L.Util.setOptions, a method for
+conveniently merging options passed to constructor with the defaults
+defines in the class:
+var MyClass = L.Class.extend({
+ options: {
+ foo: 'bar',
+ bla: 5
+ },
+
+ initialize: function (options) {
+ L.Util.setOptions(this, options);
+ ...
+ }
+});
+
+var a = new MyClass({bla: 10});
+a.options; // {foo: 'bar', bla: 10}
+
+Note that the options object allows any keys, not just
+the options defined by the class and its base classes.
+This means you can use the options object to store
+application specific information, as long as you avoid
+keys that are already used by the class in question.
+
+
+
+
+
+Includes
+
+
+
+includes is a special class property that merges all specified objects into the class (such objects are called mixins).
+ var MyMixin = {
+ foo: function () { ... },
+ bar: 5
+};
+
+var MyClass = L.Class.extend({
+ includes: MyMixin
+});
+
+var a = new MyClass();
+a.foo();
+
+You can also do such includes in runtime with the include method:
+MyClass.include(MyMixin);
+
+statics is just a convenience property that injects specified object properties as the static properties of the class, useful for defining constants:
+var MyClass = L.Class.extend({
+ statics: {
+ FOO: 'bar',
+ BLA: 5
+ }
+});
+
+MyClass.FOO; // 'bar'
+
+
+
+
+
+
+Constructor hooks
+
+
+
+If you're a plugin developer, you often need to add additional initialization code to existing classes (e.g. editing hooks for L.Polyline). Leaflet comes with a way to do it easily using the addInitHook method:
+MyClass.addInitHook(function () {
+ // ... do something in constructor additionally
+ // e.g. add event listeners, set custom properties etc.
+});
+
+You can also use the following shortcut when you just need to make one additional method call:
+MyClass.addInitHook('methodName', arg1, arg2, …);
+
+
+
+
+
+
+
+
+Functions
+
+
+
+
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ extend(<Object> props)
+ Function
+ Extends the current class given the properties to be included.
+Returns a Javascript function that is a class constructor (to be called with new).
+
+
+ include(<Object> properties)
+ this
+ Includes a mixin into the current class.
+
+
+ mergeOptions(<Object> options)
+ this
+ Merges options into the defaults of the class.
+
+
+ addInitHook(<Function> fn)
+ this
+ Adds a constructor hook to the class.
+
+
+
+
+
+
+ Evented
A set of methods shared between event-powered classes (like Map and Marker). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire 'click' event).
+
+
+Usage example
+
+
+
+
+
+
+
+map.on('click', function(e) {
+ alert(e.latlng);
+} );
+
+Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
+function onClick(e) { ... }
+
+map.on('click', onClick);
+map.off('click', onClick);
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+ Layer
A set of methods from the Layer base class that all Leaflet layers use.
+Inherits all methods, options and events from L.Evented.
+
+
+Usage example
+
+
+
+
+
+
+
+var layer = L.marker(latlng).addTo(map);
+layer.addTo(map);
+layer.remove();
+
+
+
+
+
+
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ add
+ Event
+ Fired after the layer is added to a map
+
+
+ remove
+ Event
+ Fired after the layer is removed from a map
+
+
+
+
+
+Popup events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+Tooltip events
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+Classes extending L.Layer will inherit the following methods:
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+Extension methods
+
+Every layer should extend from L.Layer and (re-)implement the following methods.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ onAdd(<Map> map)
+ this
+ Should contain code that creates DOM elements for the layer, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).
+
+
+
+ onRemove(<Map> map)
+ this
+ Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
+
+
+
+ getEvents()
+ Object
+ This optional method should return an object like { viewreset: this._reset } for addEventListener. The event handlers in this object will be automatically added and removed from the map with your layer.
+
+
+
+ getAttribution()
+ String
+ This optional method should return a string containing HTML to be shown on the Attribution control whenever the layer is visible.
+
+
+
+ beforeAdd(<Map> map)
+ this
+ Optional method. Called on map.addLayer(layer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
+
+
+
+
+
+
+Popup methods
+
+All layers share a set of methods convenient for binding popups to it.
+var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);
+layer.openPopup();
+layer.closePopup();
+
+Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+Tooltip methods
+
+All layers share a set of methods convenient for binding tooltips to it.
+var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
+layer.openTooltip();
+layer.closeTooltip();
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Interactive layer
Some Layers can be made interactive - when the user interacts
+with such a layer, mouse events like click and mouseover can be handled.
+Use the event handling methods to handle these events.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ interactive
+ Boolean
+ true
+ If false, the layer will not emit mouse events and will act as a part of the underlying map.
+
+
+ bubblingMouseEvents
+ Boolean
+ true
+ When true, a mouse event on this layer will trigger the same event on the map
+(unless L.DomEvent.stopPropagation is used).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+Mouse events
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ click
+ MouseEvent
+ Fired when the user clicks (or taps) the layer.
+
+
+ dblclick
+ MouseEvent
+ Fired when the user double-clicks (or double-taps) the layer.
+
+
+ mousedown
+ MouseEvent
+ Fired when the user pushes the mouse button on the layer.
+
+
+ mouseup
+ MouseEvent
+ Fired when the user releases the mouse button pushed on the layer.
+
+
+ mouseover
+ MouseEvent
+ Fired when the mouse enters the layer.
+
+
+ mouseout
+ MouseEvent
+ Fired when the mouse leaves the layer.
+
+
+ contextmenu
+ MouseEvent
+ Fired when the user right-clicks on the layer, prevents
+default browser context menu from showing if there are listeners on
+this event. Also fired on mobile when the user holds a single touch
+for a second (also called long press).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Control
L.Control is a base class for implementing map controls. Handles positioning.
+All other controls extend from this class.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ position
+ String
+ 'topright'
+ The position of the control (one of the map corners). Possible values are 'topleft',
+'topright', 'bottomleft' or 'bottomright'
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+Classes extending L.Control will inherit the following methods:
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ getPosition()
+ string
+ Returns the position of the control.
+
+
+
+ setPosition(<string> position)
+ this
+ Sets the position of the control.
+
+
+
+ getContainer()
+ HTMLElement
+ Returns the HTMLElement that contains the control.
+
+
+
+ addTo(<Map> map)
+ this
+ Adds the control to the given map.
+
+
+
+ remove()
+ this
+ Removes the control from the map it is currently active on.
+
+
+
+
+
+
+Extension methods
+
+Every control should extend from L.Control and (re-)implement the following methods.
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ onAdd(<Map> map)
+ HTMLElement
+ Should return the container DOM element for the control and add listeners on relevant map events. Called on control.addTo(map).
+
+
+
+ onRemove(<Map> map)
+
+ Optional method. Should contain all clean up code that removes the listeners previously added in onAdd. Called on control.remove().
+
+
+
+
+
+
+
+ Handler
Abstract class for map interaction handlers
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ enable()
+ this
+ Enables the handler
+
+
+
+ disable()
+ this
+ Disables the handler
+
+
+
+ enabled()
+ Boolean
+ Returns true if the handler is enabled
+
+
+
+
+
+
+Extension methods
+
+Classes inheriting from Handler must implement the two following methods:
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addHooks()
+
+ Called when the handler is enabled, should add event hooks.
+
+
+
+ removeHooks()
+
+ Called when the handler is disabled, should remove the event hooks added previously.
+
+
+
+
+
+
+
+
+Functions
+
+
+
+There is static function which can be called without instantiating L.Handler:
+
+
+
+
+ Function
+ Returns
+ Description
+
+
+
+ addTo(<Map> map, <String> name)
+ this
+ Adds a new Handler to the given map with the given name.
+
+
+
+
+
+
+ Projection
An object with methods for projecting geographical coordinates of the world onto
+a flat surface (and back). See Map projection.
+
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ project(<LatLng> latlng)
+ Point
+ Projects geographical coordinates into a 2D point.
+Only accepts actual L.LatLng instances, not arrays.
+
+
+
+ unproject(<Point> point)
+ LatLng
+ The inverse of project. Projects a 2D point into a geographical location.
+Only accepts actual L.Point instances, not arrays.
+Note that the projection instances do not inherit from Leaflet's Class object,
+and can't be instantiated. Also, new classes can't inherit from them,
+and methods can't be added to them with the include function.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ bounds
+ Bounds
+ The bounds (specified in CRS units) where the projection is valid
+
+
+
+
+
+
+
+Defined projections
+
+
+
+
+
+Leaflet comes with a set of already defined Projections out of the box:
+
+
+
+ Projection
+ Description
+
+
+
+ L.Projection.LonLat
+ Equirectangular, or Plate Carree projection — the most simple projection,
+mostly used by GIS enthusiasts. Directly maps x as longitude, and y as
+latitude. Also suitable for flat worlds, e.g. game maps. Used by the
+EPSG:4326 and Simple CRS.
+
+
+ L.Projection.Mercator
+ Elliptical Mercator projection — more complex than Spherical Mercator. Assumes that Earth is an ellipsoid. Used by the EPSG:3395 CRS.
+
+
+ L.Projection.SphericalMercator
+ Spherical Mercator projection — the most common projection for online maps,
+used by almost all free and commercial tile providers. Assumes that Earth is
+a sphere. Used by the EPSG:3857 CRS.
+
+
+
+
+
+
+ CRS
+
+Methods
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ latLngToPoint(<LatLng> latlng, <Number> zoom)
+ Point
+ Projects geographical coordinates into pixel coordinates for a given zoom.
+
+
+
+ pointToLatLng(<Point> point, <Number> zoom)
+ LatLng
+ The inverse of latLngToPoint. Projects pixel coordinates on a given
+zoom into geographical coordinates.
+
+
+
+ project(<LatLng> latlng)
+ Point
+ Projects geographical coordinates into coordinates in units accepted for
+this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
+
+
+
+ unproject(<Point> point)
+ LatLng
+ Given a projected coordinate returns the corresponding LatLng.
+The inverse of project.
+
+
+
+ scale(<Number> zoom)
+ Number
+ Returns the scale used when transforming projected coordinates into
+pixel coordinates for a particular zoom. For example, it returns
+256 * 2^zoom for Mercator-based CRS.
+
+
+
+ zoom(<Number> scale)
+ Number
+ Inverse of scale(), returns the zoom level corresponding to a scale
+factor of scale.
+
+
+
+ getProjectedBounds(<Number> zoom)
+ Bounds
+ Returns the projection's bounds scaled and transformed for the provided zoom.
+
+
+
+ distance(<LatLng> latlng1, <LatLng> latlng2)
+ Number
+ Returns the distance between two geographical coordinates.
+
+
+
+ wrapLatLng(<LatLng> latlng)
+ LatLng
+ Returns a LatLng where lat and lng has been wrapped according to the
+CRS's wrapLat and wrapLng properties, if they are outside the CRS's bounds.
+
+
+
+ wrapLatLngBounds(<LatLngBounds> bounds)
+ LatLngBounds
+ Returns a LatLngBounds with the same size as the given one, ensuring
+that its center is within the CRS's bounds.
+Only accepts actual L.LatLngBounds instances, not arrays.
+
+
+
+
+
+
+
+
+Properties
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ code
+ String
+ Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857')
+
+
+ wrapLng
+ Number[]
+ An array of two numbers defining whether the longitude (horizontal) coordinate
+axis wraps around a given range and how. Defaults to [-180, 180] in most
+geographical CRSs. If undefined, the longitude axis does not wrap around.
+
+
+ wrapLat
+ Number[]
+ Like wrapLng, but for the latitude (vertical) axis.
+
+
+ infinite
+ Boolean
+ If true, the coordinate space will be unbounded (infinite in both axes)
+
+
+
+
+
+
+
+Defined CRSs
+
+
+
+
+
+
+
+
+ CRS
+ Description
+
+
+
+ L.CRS.EPSG3395
+ Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
+
+
+ L.CRS.EPSG3857
+ The most common CRS for online maps, used by almost all free and commercial
+tile providers. Uses Spherical Mercator projection. Set in by default in
+Map's crs option.
+
+
+ L.CRS.EPSG4326
+ A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
+Leaflet 1.0.x complies with the TMS coordinate scheme for EPSG:4326,
+which is a breaking change from 0.7.x behaviour. If you are using a TileLayer
+with this CRS, ensure that there are two 256x256 pixel tiles covering the
+whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),
+or (-180,-90) for TileLayers with the tms option set.
+
+
+ L.CRS.Earth
+ Serves as the base for CRS that are global such that they cover the earth.
+Can only be used as the base for other CRS and cannot be used directly,
+since it does not have a code, projection or transformation. distance() returns
+meters.
+
+
+ L.CRS.Simple
+ A simple CRS that maps longitude and latitude into x and y directly.
+May be used for maps of flat surfaces (e.g. game maps). Note that the y
+axis should still be inverted (going from bottom to top). distance() returns
+simple euclidean distance.
+
+
+ L.CRS.Base
+ Object that defines coordinate reference systems for projecting
+geographical points into pixel (screen) coordinates and back (and to
+coordinates in other units for WMS services). See
+spatial reference system.
+Leaflet defines the most usual CRSs by default. If you want to use a
+CRS not defined by default, take a look at the
+Proj4Leaflet plugin.
+Note that the CRS instances do not inherit from Leaflet's Class object,
+and can't be instantiated. Also, new classes can't inherit from them,
+and methods can't be added to them with the include function.
+
+
+
+
+
+
+ Renderer
Base class for vector renderer implementations (SVG, Canvas). Handles the
+DOM container of the renderer, its bounds, and its zoom animation.
+A Renderer works as an implicit layer group for all Paths - the renderer
+itself can be added or removed to the map. All paths use a renderer, which can
+be implicit (the map will decide the type of renderer and use it automatically)
+or explicit (using the renderer option of the path).
+Do not use this class directly, use SVG and Canvas instead.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ padding
+ Number
+ 0.1
+ How much to extend the clip area around the map view (relative to its size)
+e.g. 0.1 would be 10% of map view in each direction
+
+
+ tolerance
+ Number
+ 0
+ How much to extend click tolerance round a path/object on the map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ pane
+ String
+ 'overlayPane'
+ By default the layer will be added to the map's overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ update
+ Event
+ Fired when the renderer updates its bounds, center and zoom, for example when
+its map has moved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Event objects
Whenever a class inheriting from Evented fires an event, a listener function
+will be called with an event argument, which is a plain object containing
+information about the event. For example:
+map.on('click', function(ev) {
+ alert(ev.latlng); // ev is an event object (MouseEvent in this case)
+});
+
+The information available depends on the event type:
+
+
+
+
+Event
+
+
+
+
+
+The base event object. All other event objects contain these properties too.
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+KeyboardEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ originalEvent
+ DOMEvent
+ The original DOM KeyboardEvent that triggered this Leaflet event.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+MouseEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ latlng
+ LatLng
+ The geographical point where the mouse event occurred.
+
+
+ layerPoint
+ Point
+ Pixel coordinates of the point where the mouse event occurred relative to the map layer.
+
+
+ containerPoint
+ Point
+ Pixel coordinates of the point where the mouse event occurred relative to the map сontainer.
+
+
+ originalEvent
+ DOMEvent
+ The original DOM MouseEvent or DOM TouchEvent that triggered this Leaflet event.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+LocationEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ latlng
+ LatLng
+ Detected geographical location of the user.
+
+
+ bounds
+ LatLngBounds
+ Geographical bounds of the area user is located in (with respect to the accuracy of location).
+
+
+ accuracy
+ Number
+ Accuracy of location in meters.
+
+
+ altitude
+ Number
+ Height of the position above the WGS84 ellipsoid in meters.
+
+
+ altitudeAccuracy
+ Number
+ Accuracy of altitude in meters.
+
+
+ heading
+ Number
+ The direction of travel in degrees counting clockwise from true North.
+
+
+ speed
+ Number
+ Current velocity in meters per second.
+
+
+ timestamp
+ Number
+ The time when the position was acquired.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+ErrorEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ message
+ String
+ Error message.
+
+
+ code
+ Number
+ Error code (if applicable).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+LayerEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ layer
+ Layer
+ The layer that was added or removed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+
+
+
+
+
+
+
+
+LayersControlEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ layer
+ Layer
+ The layer that was added or removed.
+
+
+ name
+ String
+ The name of the layer that was added or removed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+
+
+
+
+
+
+
+
+TileEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ tile
+ HTMLElement
+ The tile element (image).
+
+
+ coords
+ Point
+ Point object with the tile's x, y, and z (zoom level) coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+TileErrorEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ tile
+ HTMLElement
+ The tile element (image).
+
+
+ coords
+ Point
+ Point object with the tile's x, y, and z (zoom level) coordinates.
+
+
+ error
+ *
+ Error passed to the tile's done() callback.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+ResizeEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ oldSize
+ Point
+ The old size before resize event.
+
+
+ newSize
+ Point
+ The new size after the resize event.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+GeoJSONEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ layer
+ Layer
+ The layer for the GeoJSON feature that is being added to the map.
+
+
+ properties
+ Object
+ GeoJSON properties of the feature.
+
+
+ geometryType
+ String
+ GeoJSON geometry type of the feature.
+
+
+ id
+ String
+ GeoJSON ID of the feature (if present).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+
+
+
+
+
+
+
+
+PopupEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ popup
+ Popup
+ The popup that was opened or closed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+TooltipEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ tooltip
+ Tooltip
+ The tooltip that was opened or closed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+DragEndEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ distance
+ Number
+ The distance in pixels the draggable element was moved by.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+
+
+
+ZoomAnimEvent
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ center
+ LatLng
+ The current center of the map
+
+
+ zoom
+ Number
+ The current zoom level of the map
+
+
+ noUpdate
+ Boolean
+ Whether layers should update their contents due to this event
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+ type
+ String
+ The event type (e.g. 'click').
+
+
+ target
+ Object
+ The object that fired the event. For propagated events, the last object in
+the propagation chain that fired the event.
+
+
+ sourceTarget
+ Object
+ The object that originally fired the event. For non-propagated events, this will
+be the same as the target.
+
+
+ propagatedFrom
+ Object
+ For propagated events, the last object that propagated the event to its
+event parent.
+
+
+ layer
+ Object
+ Deprecated. The same as propagatedFrom.
+
+
+
+
+
+
+
+ DivOverlay
Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.
+
+
+Options
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ offset
+ Point
+ Point(0, 7)
+ The offset of the popup position. Useful to control the anchor
+of the popup when opening it on some overlays.
+
+
+ className
+ String
+ ''
+ A custom CSS class name to assign to the popup.
+
+
+ pane
+ String
+ 'popupPane'
+ Map pane where the popup will be added.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Option
+ Type
+ Default
+ Description
+
+
+
+ attribution
+ String
+ null
+ String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
+
+
+
+
+
+
+
+
+Events
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ popupopen
+ PopupEvent
+ Fired when a popup bound to this layer is opened
+
+
+ popupclose
+ PopupEvent
+ Fired when a popup bound to this layer is closed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Event
+ Data
+ Description
+
+
+
+ tooltipopen
+ TooltipEvent
+ Fired when a tooltip bound to this layer is opened.
+
+
+ tooltipclose
+ TooltipEvent
+ Fired when a tooltip bound to this layer is closed.
+
+
+
+
+
+
+
+
+Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ addTo(<Map|LayerGroup> map)
+ this
+ Adds the layer to the given map or layer group.
+
+
+
+ remove()
+ this
+ Removes the layer from the map it is currently active on.
+
+
+
+ removeFrom(<Map> map)
+ this
+ Removes the layer from the given map
+
+
+
+ removeFrom(<LayerGroup> group)
+ this
+ Removes the layer from the given LayerGroup
+
+
+
+ getPane(<String> name?)
+ HTMLElement
+ Returns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
+
+
+
+ getAttribution()
+ String
+ Used by the attribution control, returns the attribution option.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindPopup(<String|HTMLElement|Function|Popup> content, <Popup options> options?)
+ this
+ Binds a popup to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindPopup()
+ this
+ Removes the popup previously bound with bindPopup.
+
+
+
+ openPopup(<LatLng> latlng?)
+ this
+ Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
+
+
+
+ closePopup()
+ this
+ Closes the popup bound to this layer if it is open.
+
+
+
+ togglePopup()
+ this
+ Opens or closes the popup bound to this layer depending on its current state.
+
+
+
+ isPopupOpen()
+ boolean
+ Returns true if the popup bound to this layer is currently open.
+
+
+
+ setPopupContent(<String|HTMLElement|Popup> content)
+ this
+ Sets the content of the popup bound to this layer.
+
+
+
+ getPopup()
+ Popup
+ Returns the popup bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ bindTooltip(<String|HTMLElement|Function|Tooltip> content, <Tooltip options> options?)
+ this
+ Binds a tooltip to the layer with the passed content and sets up the
+necessary event listeners. If a Function is passed it will receive
+the layer as the first argument and should return a String or HTMLElement.
+
+
+
+ unbindTooltip()
+ this
+ Removes the tooltip previously bound with bindTooltip.
+
+
+
+ openTooltip(<LatLng> latlng?)
+ this
+ Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
+
+
+
+ closeTooltip()
+ this
+ Closes the tooltip bound to this layer if it is open.
+
+
+
+ toggleTooltip()
+ this
+ Opens or closes the tooltip bound to this layer depending on its current state.
+
+
+
+ isTooltipOpen()
+ boolean
+ Returns true if the tooltip bound to this layer is currently open.
+
+
+
+ setTooltipContent(<String|HTMLElement|Tooltip> content)
+ this
+ Sets the content of the tooltip bound to this layer.
+
+
+
+ getTooltip()
+ Tooltip
+ Returns the tooltip bound to this layer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+ Returns
+ Description
+
+
+
+ on(<String> type, <Function> fn, <Object> context?)
+ this
+ Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
+
+
+
+ on(<Object> eventMap)
+ this
+ Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
+
+
+
+ off(<String> type, <Function> fn?, <Object> context?)
+ this
+ Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
+
+
+
+ off(<Object> eventMap)
+ this
+ Removes a set of type/listener pairs.
+
+
+
+ off()
+ this
+ Removes all listeners to all events on the object. This includes implicitly attached events.
+
+
+
+ fire(<String> type, <Object> data?, <Boolean> propagate?)
+ this
+ Fires an event of the specified type. You can optionally provide an data
+object — the first argument of the listener function will contain its
+properties. The event can optionally be propagated to event parents.
+
+
+
+ listens(<String> type)
+ Boolean
+ Returns true if a particular event type has any listeners attached to it.
+
+
+
+ once(…)
+ this
+ Behaves as on(…), except the listener will only get fired once and then removed.
+
+
+
+ addEventParent(<Evented> obj)
+ this
+ Adds an event parent - an Evented that will receive propagated events
+
+
+
+ removeEventParent(<Evented> obj)
+ this
+ Removes an event parent, so it will stop receiving propagated events
+
+
+
+ addEventListener(…)
+ this
+ Alias to on(…)
+
+
+
+ removeEventListener(…)
+ this
+ Alias to off(…)
+
+
+
+ clearAllEventListeners(…)
+ this
+ Alias to off()
+
+
+
+ addOneTimeEventListener(…)
+ this
+ Alias to once(…)
+
+
+
+ fireEvent(…)
+ this
+ Alias to fire(…)
+
+
+
+ hasEventListeners(…)
+ Boolean
+ Alias to listens(…)
+
+
+
+
+
+
+
+
+ Global Switches
Global switches are created for rare cases and generally make
+Leaflet to not detect a particular browser feature even if it's
+there. You need to set the switch as a global variable to true
+before including Leaflet on the page, like this:
+<script>L_NO_TOUCH = true;</script>
+<script src="leaflet.js"></script>
+
+
+
+
+Switch
+Description
+
+
+
+
+L_NO_TOUCH
+Forces Leaflet to not use touch events even if it detects them.
+
+
+L_DISABLE_3D
+Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning (which may cause glitches in some rare environments) even if they're supported.
+
+
+
+
+noConflict
This method restores the L global variable to the original value
+it had before Leaflet inclusion, and returns the real Leaflet
+namespace so you can put it elsewhere, like this:
+<script src='libs/l.js'>
+<!-- L points to some other library -->
+
+<script src='leaflet.js'>
+<!-- you include Leaflet, it replaces the L variable to Leaflet namespace -->
+
+<script>
+var Leaflet = L.noConflict();
+// now L points to that other library again, and you can use Leaflet.Map etc.
+</script>
+
+
+version
A constant that represents the Leaflet version in use.
+L.version; // contains "1.0.0" (or whatever version is currently in use)
+
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 00000000000..3fb5a3bc6a8
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,6358 @@
+{
+ "name": "leaflet",
+ "version": "1.7.1",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "leaflet",
+ "version": "1.7.1",
+ "license": "BSD-2-Clause",
+ "devDependencies": {
+ "@rollup/plugin-json": "^4.1.0",
+ "bundlemon": "^1.3.0",
+ "eslint": "^8.1.0",
+ "eslint-config-mourner": "^2.0.3",
+ "eslint-plugin-script-tags": "^0.5.0",
+ "git-rev-sync": "^3.0.1",
+ "happen": "~0.3.2",
+ "karma": "^6.3.6",
+ "karma-chrome-launcher": "^3.1.0",
+ "karma-edge-launcher": "^0.4.2",
+ "karma-expect": "^1.1.3",
+ "karma-firefox-launcher": "^2.1.1",
+ "karma-ie-launcher": "^1.0.0",
+ "karma-mocha": "^2.0.1",
+ "karma-rollup-preprocessor": "^7.0.7",
+ "karma-safari-launcher": "~1.0.0",
+ "karma-sinon": "^1.0.5",
+ "leafdoc": "^2.3.0",
+ "mocha": "^9.1.3",
+ "prosthetic-hand": "^1.3.1",
+ "rollup": "^2.59.0",
+ "rollup-plugin-git-version": "^0.3.1",
+ "sinon": "^7.5.0",
+ "ssri": "^8.0.1",
+ "uglify-js": "^3.14.2"
+ }
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz",
+ "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==",
+ "dev": true,
+ "dependencies": {
+ "@babel/highlight": "^7.16.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz",
+ "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==",
+ "dev": true,
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/highlight": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz",
+ "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==",
+ "dev": true,
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.16.7",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
+ "dev": true
+ },
+ "node_modules/@babel/highlight/node_modules/escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@babel/highlight/node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/@babel/runtime": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
+ "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
+ "dev": true,
+ "dependencies": {
+ "regenerator-runtime": "^0.13.4"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/runtime-corejs3": {
+ "version": "7.16.0",
+ "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.16.0.tgz",
+ "integrity": "sha512-Oi2qwQ21X7/d9gn3WiwkDTJmq3TQtYNz89lRnoFy8VeZpWlsyXvzSwiRrRZ8cXluvSwqKxqHJ6dBd9Rv+p0ZGQ==",
+ "dev": true,
+ "dependencies": {
+ "core-js-pure": "^3.19.0",
+ "regenerator-runtime": "^0.13.4"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@eslint/eslintrc": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz",
+ "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==",
+ "dev": true,
+ "dependencies": {
+ "ajv": "^6.12.4",
+ "debug": "^4.3.2",
+ "espree": "^9.2.0",
+ "globals": "^13.9.0",
+ "ignore": "^4.0.6",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^4.1.0",
+ "minimatch": "^3.0.4",
+ "strip-json-comments": "^3.1.1"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@humanwhocodes/config-array": {
+ "version": "0.9.2",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz",
+ "integrity": "sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA==",
+ "dev": true,
+ "dependencies": {
+ "@humanwhocodes/object-schema": "^1.2.1",
+ "debug": "^4.1.1",
+ "minimatch": "^3.0.4"
+ },
+ "engines": {
+ "node": ">=10.10.0"
+ }
+ },
+ "node_modules/@humanwhocodes/object-schema": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
+ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
+ "dev": true
+ },
+ "node_modules/@rollup/plugin-json": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz",
+ "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==",
+ "dev": true,
+ "dependencies": {
+ "@rollup/pluginutils": "^3.0.8"
+ },
+ "peerDependencies": {
+ "rollup": "^1.20.0 || ^2.0.0"
+ }
+ },
+ "node_modules/@rollup/pluginutils": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
+ "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==",
+ "dev": true,
+ "dependencies": {
+ "@types/estree": "0.0.39",
+ "estree-walker": "^1.0.1",
+ "picomatch": "^2.2.2"
+ },
+ "engines": {
+ "node": ">= 8.0.0"
+ },
+ "peerDependencies": {
+ "rollup": "^1.20.0||^2.0.0"
+ }
+ },
+ "node_modules/@sinonjs/commons": {
+ "version": "1.8.3",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz",
+ "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==",
+ "dev": true,
+ "dependencies": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "node_modules/@sinonjs/formatio": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz",
+ "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^1",
+ "@sinonjs/samsam": "^3.1.0"
+ }
+ },
+ "node_modules/@sinonjs/samsam": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz",
+ "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^1.3.0",
+ "array-from": "^2.1.1",
+ "lodash": "^4.17.15"
+ }
+ },
+ "node_modules/@sinonjs/text-encoding": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
+ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
+ "dev": true
+ },
+ "node_modules/@types/component-emitter": {
+ "version": "1.2.11",
+ "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
+ "integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==",
+ "dev": true
+ },
+ "node_modules/@types/cookie": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
+ "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
+ "dev": true
+ },
+ "node_modules/@types/cors": {
+ "version": "2.8.12",
+ "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz",
+ "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==",
+ "dev": true
+ },
+ "node_modules/@types/estree": {
+ "version": "0.0.39",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
+ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
+ "dev": true
+ },
+ "node_modules/@types/lodash": {
+ "version": "4.14.178",
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz",
+ "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==",
+ "dev": true
+ },
+ "node_modules/@types/node": {
+ "version": "16.11.6",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
+ "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==",
+ "dev": true
+ },
+ "node_modules/@types/parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
+ "dev": true
+ },
+ "node_modules/@ungap/promise-all-settled": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
+ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
+ "dev": true
+ },
+ "node_modules/accepts": {
+ "version": "1.3.7",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
+ "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
+ "dev": true,
+ "dependencies": {
+ "mime-types": "~2.1.24",
+ "negotiator": "0.6.2"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
+ "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
+ "dev": true,
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "peerDependencies": {
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ansi-colors": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
+ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
+ "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "dev": true,
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
+ },
+ "node_modules/array-from": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz",
+ "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=",
+ "dev": true
+ },
+ "node_modules/axios": {
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
+ "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
+ "dev": true,
+ "dependencies": {
+ "follow-redirects": "^1.14.0"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
+ "node_modules/base64-arraybuffer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.1.tgz",
+ "integrity": "sha512-vFIUq7FdLtjZMhATwDul5RZWv2jpXQ09Pd6jcVEOvIsqCWTRFD/ONHNfyOS8dA/Ippi5dsIgpyKWKZaAKZltbA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6.0"
+ }
+ },
+ "node_modules/base64id": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
+ "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
+ "dev": true,
+ "engines": {
+ "node": "^4.5.0 || >= 5.9"
+ }
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/body-parser": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
+ "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
+ "dev": true,
+ "dependencies": {
+ "bytes": "3.1.0",
+ "content-type": "~1.0.4",
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "on-finished": "~2.3.0",
+ "qs": "6.7.0",
+ "raw-body": "2.4.0",
+ "type-is": "~1.6.17"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/body-parser/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/body-parser/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "dependencies": {
+ "fill-range": "^7.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/brotli-size": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/brotli-size/-/brotli-size-4.0.0.tgz",
+ "integrity": "sha512-uA9fOtlTRC0iqKfzff1W34DXUA3GyVqbUaeo3Rw3d4gd1eavKVCETXrn3NzO74W+UVkG3UHu8WxUi+XvKI/huA==",
+ "dev": true,
+ "dependencies": {
+ "duplexer": "0.1.1"
+ },
+ "engines": {
+ "node": ">= 10.16.0"
+ }
+ },
+ "node_modules/browser-stdout": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
+ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
+ "dev": true
+ },
+ "node_modules/bundlemon": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/bundlemon/-/bundlemon-1.3.0.tgz",
+ "integrity": "sha512-6tSARvzrYf3K8xRC19GXBTCI4p45QxDV4VyyYEh1hUuM7gJdBIAUalhZY/5yidmhthGkonIVTh3taH054BLqGw==",
+ "dev": true,
+ "dependencies": {
+ "axios": "^0.21.1",
+ "brotli-size": "^4.0.0",
+ "bundlemon-utils": "^0.4.0",
+ "bytes": "^3.1.0",
+ "chalk": "^4.1.1",
+ "commander": "^8.0.0",
+ "cosmiconfig": "^7.0.0",
+ "gzip-size": "^6.0.0",
+ "micromatch": "^4.0.4",
+ "yup": "^0.32.11"
+ },
+ "bin": {
+ "bundlemon": "bin/bundlemon.js"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/bundlemon-utils": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/bundlemon-utils/-/bundlemon-utils-0.4.0.tgz",
+ "integrity": "sha512-BqYhoCgkPNgdN3ORpj2Xqphj+OQ4iHGBqq9KfM2aQpj+RAauVS2F0EAe77ZXpme2JLbLJq6MyrUOHoeXvB2lGA==",
+ "dev": true,
+ "dependencies": {
+ "bytes": "^3.1.0"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
+ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/camelcase": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
+ "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz",
+ "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==",
+ "dev": true,
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/chokidar/node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "dev": true,
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^7.0.0"
+ }
+ },
+ "node_modules/clone-regexp": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.1.tgz",
+ "integrity": "sha512-Fcij9IwRW27XedRIJnSOEupS7RVcXtObJXbcUOX93UCLqqOdRpkvzKywOOSizmEK/Is3S/RHX9dLdfo6R1Q1mw==",
+ "dev": true,
+ "dependencies": {
+ "is-regexp": "^1.0.0",
+ "is-supported-regexp-flag": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "node_modules/colors": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.1.90"
+ }
+ },
+ "node_modules/commander": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
+ "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
+ "dev": true,
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/comment-patterns": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/comment-patterns/-/comment-patterns-0.11.0.tgz",
+ "integrity": "sha512-YgQOR0QcCIE0mYFywZ0ToK8r7V+48FjEWA6Jflfvxf5JlGZtJEi8BzMcc4BXcaVUyU1DUSGEhppSUfJOI2YC/w==",
+ "dev": true,
+ "dependencies": {
+ "lodash": "^4.17.11"
+ }
+ },
+ "node_modules/component-emitter": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
+ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
+ "dev": true
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
+ },
+ "node_modules/connect": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz",
+ "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==",
+ "dev": true,
+ "dependencies": {
+ "debug": "2.6.9",
+ "finalhandler": "1.1.2",
+ "parseurl": "~1.3.3",
+ "utils-merge": "1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ }
+ },
+ "node_modules/connect/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/connect/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "node_modules/content-type": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
+ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
+ "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/core-js-pure": {
+ "version": "3.19.0",
+ "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.19.0.tgz",
+ "integrity": "sha512-UEQk8AxyCYvNAs6baNoPqDADv7BX0AmBLGxVsrAifPPx/C8EAzV4Q+2ZUJqVzfI2TQQEZITnwUkWcHpgc/IubQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/core-js"
+ }
+ },
+ "node_modules/cors": {
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
+ "dev": true,
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/cosmiconfig": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz",
+ "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==",
+ "dev": true,
+ "dependencies": {
+ "@types/parse-json": "^4.0.0",
+ "import-fresh": "^3.2.1",
+ "parse-json": "^5.0.0",
+ "path-type": "^4.0.0",
+ "yaml": "^1.10.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
+ "dev": true,
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/custom-event": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz",
+ "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=",
+ "dev": true
+ },
+ "node_modules/date-format": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz",
+ "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/debounce": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz",
+ "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==",
+ "dev": true
+ },
+ "node_modules/debug": {
+ "version": "4.3.2",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
+ "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.1.2"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/decamelize": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
+ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true
+ },
+ "node_modules/depd": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
+ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/di": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz",
+ "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=",
+ "dev": true
+ },
+ "node_modules/diff": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
+ "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.3.1"
+ }
+ },
+ "node_modules/doctrine": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+ "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+ "dev": true,
+ "dependencies": {
+ "esutils": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/dom-serialize": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz",
+ "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=",
+ "dev": true,
+ "dependencies": {
+ "custom-event": "~1.0.0",
+ "ent": "~2.2.0",
+ "extend": "^3.0.0",
+ "void-elements": "^2.0.0"
+ }
+ },
+ "node_modules/duplexer": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
+ "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
+ "dev": true
+ },
+ "node_modules/edge-launcher": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/edge-launcher/-/edge-launcher-1.2.2.tgz",
+ "integrity": "sha1-60Cq+9Bnpup27/+rBke81VCbN7I=",
+ "dev": true
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
+ "dev": true
+ },
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "node_modules/encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/engine.io": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.0.0.tgz",
+ "integrity": "sha512-Ui7yl3JajEIaACg8MOUwWvuuwU7jepZqX3BKs1ho7NQRuP4LhN4XIykXhp8bEy+x/DhA0LBZZXYSCkZDqrwMMg==",
+ "dev": true,
+ "dependencies": {
+ "@types/cookie": "^0.4.1",
+ "@types/cors": "^2.8.12",
+ "@types/node": ">=10.0.0",
+ "accepts": "~1.3.4",
+ "base64id": "2.0.0",
+ "cookie": "~0.4.1",
+ "cors": "~2.8.5",
+ "debug": "~4.3.1",
+ "engine.io-parser": "~5.0.0",
+ "ws": "~8.2.3"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/engine.io-parser": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.1.tgz",
+ "integrity": "sha512-j4p3WwJrG2k92VISM0op7wiq60vO92MlF3CRGxhKHy9ywG1/Dkc72g0dXeDQ+//hrcDn8gqQzoEkdO9FN0d9AA==",
+ "dev": true,
+ "dependencies": {
+ "base64-arraybuffer": "~1.0.1"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/ent": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz",
+ "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=",
+ "dev": true
+ },
+ "node_modules/entities": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz",
+ "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==",
+ "dev": true
+ },
+ "node_modules/error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dev": true,
+ "dependencies": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "node_modules/escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
+ "dev": true
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint": {
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.7.0.tgz",
+ "integrity": "sha512-ifHYzkBGrzS2iDU7KjhCAVMGCvF6M3Xfs8X8b37cgrUlDt6bWRTpRh6T/gtSXv1HJ/BUGgmjvNvOEGu85Iif7w==",
+ "dev": true,
+ "dependencies": {
+ "@eslint/eslintrc": "^1.0.5",
+ "@humanwhocodes/config-array": "^0.9.2",
+ "ajv": "^6.10.0",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.2",
+ "debug": "^4.3.2",
+ "doctrine": "^3.0.0",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^7.1.0",
+ "eslint-utils": "^3.0.0",
+ "eslint-visitor-keys": "^3.2.0",
+ "espree": "^9.3.0",
+ "esquery": "^1.4.0",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^6.0.1",
+ "functional-red-black-tree": "^1.0.1",
+ "glob-parent": "^6.0.1",
+ "globals": "^13.6.0",
+ "ignore": "^5.2.0",
+ "import-fresh": "^3.0.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "js-yaml": "^4.1.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.4.1",
+ "lodash.merge": "^4.6.2",
+ "minimatch": "^3.0.4",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.1",
+ "regexpp": "^3.2.0",
+ "strip-ansi": "^6.0.1",
+ "strip-json-comments": "^3.1.0",
+ "text-table": "^0.2.0",
+ "v8-compile-cache": "^2.0.3"
+ },
+ "bin": {
+ "eslint": "bin/eslint.js"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint-config-mourner": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/eslint-config-mourner/-/eslint-config-mourner-2.0.3.tgz",
+ "integrity": "sha512-ydFFzE/WkqvmozI3CM0lAtDZoYfmN03ycjlHzdPZW5x+o3Me1pI0lyfpsWoz9kOqykZk8qlvOVC5BN5UMwtXrg==",
+ "dev": true
+ },
+ "node_modules/eslint-plugin-script-tags": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-script-tags/-/eslint-plugin-script-tags-0.5.0.tgz",
+ "integrity": "sha512-iomN8+MwDyhRGWKwRKfBg4EchXuOCJ4iPC8bE9q255xdneXdIhvJU0AaWEe9GPXQIrJ3JKNKZbU1dAlAPbyyAg==",
+ "deprecated": "Now published as @mapbox/eslint-plugin-script-tags",
+ "dev": true,
+ "dependencies": {
+ "execall": "^1.0.0",
+ "lodash": "^4.16.0",
+ "split-lines": "^1.1.0"
+ }
+ },
+ "node_modules/eslint-scope": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz",
+ "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==",
+ "dev": true,
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
+ "node_modules/eslint-utils": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz",
+ "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==",
+ "dev": true,
+ "dependencies": {
+ "eslint-visitor-keys": "^2.0.0"
+ },
+ "engines": {
+ "node": "^10.0.0 || ^12.0.0 || >= 14.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ },
+ "peerDependencies": {
+ "eslint": ">=5"
+ }
+ },
+ "node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz",
+ "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/eslint-visitor-keys": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz",
+ "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==",
+ "dev": true,
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
+ "node_modules/eslint/node_modules/ignore": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
+ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/espree": {
+ "version": "9.3.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz",
+ "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==",
+ "dev": true,
+ "dependencies": {
+ "acorn": "^8.7.0",
+ "acorn-jsx": "^5.3.1",
+ "eslint-visitor-keys": "^3.1.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
+ "node_modules/esquery": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
+ "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
+ "dev": true,
+ "dependencies": {
+ "estraverse": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "dependencies": {
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/estree-walker": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
+ "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==",
+ "dev": true
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
+ "dev": true
+ },
+ "node_modules/execall": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execall/-/execall-1.0.0.tgz",
+ "integrity": "sha1-c9CQTjlbPKsGWLCNCewlMH8pu3M=",
+ "dev": true,
+ "dependencies": {
+ "clone-regexp": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/expect.js": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz",
+ "integrity": "sha1-sKWaDS7/VDdUTr8M6qYBWEHQm1s=",
+ "dev": true
+ },
+ "node_modules/extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "dev": true
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true
+ },
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true
+ },
+ "node_modules/fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+ "dev": true
+ },
+ "node_modules/file-entry-cache": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
+ "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
+ "dev": true,
+ "dependencies": {
+ "flat-cache": "^3.0.4"
+ },
+ "engines": {
+ "node": "^10.12.0 || >=12.0.0"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/finalhandler": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
+ "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
+ "dev": true,
+ "dependencies": {
+ "debug": "2.6.9",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.3",
+ "statuses": "~1.5.0",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/finalhandler/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/finalhandler/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/flat": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
+ "dev": true,
+ "bin": {
+ "flat": "cli.js"
+ }
+ },
+ "node_modules/flat-cache": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
+ "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+ "dev": true,
+ "dependencies": {
+ "flatted": "^3.1.0",
+ "rimraf": "^3.0.2"
+ },
+ "engines": {
+ "node": "^10.12.0 || >=12.0.0"
+ }
+ },
+ "node_modules/flatted": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz",
+ "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==",
+ "dev": true
+ },
+ "node_modules/follow-redirects": {
+ "version": "1.14.5",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz",
+ "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/fs-extra": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
+ "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
+ "dev": true,
+ "dependencies": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=6 <7 || >=8"
+ }
+ },
+ "node_modules/fs-extra/node_modules/graceful-fs": {
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
+ "dev": true
+ },
+ "node_modules/fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "dev": true,
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "node_modules/functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
+ "dev": true
+ },
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true,
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
+ "node_modules/git-rev-sync": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/git-rev-sync/-/git-rev-sync-3.0.1.tgz",
+ "integrity": "sha512-8xZzUwzukIuU3sasgYt3RELc3Ny7o+tbtvitnnU4a4j3djyZNpJ5JmqVX+K7Xv3gE/i7ln3hGdBfZ00T5WWoow==",
+ "dev": true,
+ "dependencies": {
+ "escape-string-regexp": "1.0.5",
+ "graceful-fs": "4.1.15",
+ "shelljs": "0.8.4"
+ }
+ },
+ "node_modules/git-rev-sync/node_modules/escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/glob": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
+ "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
+ "dev": true,
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+ "dev": true,
+ "dependencies": {
+ "is-glob": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/globals": {
+ "version": "13.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz",
+ "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==",
+ "dev": true,
+ "dependencies": {
+ "type-fest": "^0.20.2"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/graceful-fs": {
+ "version": "4.1.15",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
+ "dev": true
+ },
+ "node_modules/growl": {
+ "version": "1.10.5",
+ "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
+ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.x"
+ }
+ },
+ "node_modules/gzip-size": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz",
+ "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==",
+ "dev": true,
+ "dependencies": {
+ "duplexer": "^0.1.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/gzip-size/node_modules/duplexer": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
+ "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
+ "dev": true
+ },
+ "node_modules/handlebars": {
+ "version": "4.7.7",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
+ "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
+ "dev": true,
+ "dependencies": {
+ "minimist": "^1.2.5",
+ "neo-async": "^2.6.0",
+ "source-map": "^0.6.1",
+ "wordwrap": "^1.0.0"
+ },
+ "bin": {
+ "handlebars": "bin/handlebars"
+ },
+ "engines": {
+ "node": ">=0.4.7"
+ },
+ "optionalDependencies": {
+ "uglify-js": "^3.1.4"
+ }
+ },
+ "node_modules/happen": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/happen/-/happen-0.3.2.tgz",
+ "integrity": "sha512-fBouIWb3fMsRCfCySHgk6+/gTEijMAWUZM/TYKmjuui9VsdS2DGWNjcH9cN7/tPn9nSkxGSGLJU6FHh37G0WUg==",
+ "dev": true
+ },
+ "node_modules/has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
+ "dependencies": {
+ "function-bind": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/he": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "dev": true,
+ "bin": {
+ "he": "bin/he"
+ }
+ },
+ "node_modules/http-errors": {
+ "version": "1.7.2",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
+ "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
+ "dev": true,
+ "dependencies": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.1",
+ "statuses": ">= 1.5.0 < 2",
+ "toidentifier": "1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/http-errors/node_modules/inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ },
+ "node_modules/http-proxy": {
+ "version": "1.18.1",
+ "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
+ "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
+ "dev": true,
+ "dependencies": {
+ "eventemitter3": "^4.0.0",
+ "follow-redirects": "^1.0.0",
+ "requires-port": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ignore": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/import-fresh": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
+ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+ "dev": true,
+ "dependencies": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8.19"
+ }
+ },
+ "node_modules/inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
+ "dependencies": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "node_modules/interpret": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-core-module": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
+ "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
+ "dev": true,
+ "dependencies": {
+ "has": "^1.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true,
+ "bin": {
+ "is-docker": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/is-plain-obj": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
+ "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-regexp": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz",
+ "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-supported-regexp-flag": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.1.tgz",
+ "integrity": "sha512-3vcJecUUrpgCqc/ca0aWeNu64UGgxcvO60K/Fkr1N6RSvfGCTU60UKN68JDmKokgba0rFFJs12EnzOQa14ubKQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-unicode-supported": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
+ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "dependencies": {
+ "is-docker": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "node_modules/isbinaryfile": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.8.tgz",
+ "integrity": "sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w==",
+ "dev": true,
+ "engines": {
+ "node": ">= 8.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/gjtorikian/"
+ }
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true
+ },
+ "node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/json-parse-even-better-errors": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
+ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
+ "dev": true
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "node_modules/json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
+ "dev": true
+ },
+ "node_modules/jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
+ "optionalDependencies": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "node_modules/just-extend": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz",
+ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
+ "dev": true
+ },
+ "node_modules/karma": {
+ "version": "6.3.11",
+ "resolved": "https://registry.npmjs.org/karma/-/karma-6.3.11.tgz",
+ "integrity": "sha512-QGUh4yXgizzDNPLB5nWTvP+wysKexngbyLVWFOyikB661hpa2RZLf5anZQzqliWtAQuYVep0ot0D1U7UQKpsxQ==",
+ "dev": true,
+ "dependencies": {
+ "body-parser": "^1.19.0",
+ "braces": "^3.0.2",
+ "chokidar": "^3.5.1",
+ "colors": "1.4.0",
+ "connect": "^3.7.0",
+ "di": "^0.0.1",
+ "dom-serialize": "^2.2.1",
+ "glob": "^7.1.7",
+ "graceful-fs": "^4.2.6",
+ "http-proxy": "^1.18.1",
+ "isbinaryfile": "^4.0.8",
+ "lodash": "^4.17.21",
+ "log4js": "^6.3.0",
+ "mime": "^2.5.2",
+ "minimatch": "^3.0.4",
+ "qjobs": "^1.2.0",
+ "range-parser": "^1.2.1",
+ "rimraf": "^3.0.2",
+ "socket.io": "^4.2.0",
+ "source-map": "^0.6.1",
+ "tmp": "^0.2.1",
+ "ua-parser-js": "^0.7.30",
+ "yargs": "^16.1.1"
+ },
+ "bin": {
+ "karma": "bin/karma"
+ },
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/karma-chrome-launcher": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz",
+ "integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==",
+ "dev": true,
+ "dependencies": {
+ "which": "^1.2.1"
+ }
+ },
+ "node_modules/karma-chrome-launcher/node_modules/which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "which": "bin/which"
+ }
+ },
+ "node_modules/karma-edge-launcher": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/karma-edge-launcher/-/karma-edge-launcher-0.4.2.tgz",
+ "integrity": "sha512-YAJZb1fmRcxNhMIWYsjLuxwODBjh2cSHgTW/jkVmdpGguJjLbs9ZgIK/tEJsMQcBLUkO+yO4LBbqYxqgGW2HIw==",
+ "dev": true,
+ "dependencies": {
+ "edge-launcher": "1.2.2"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "peerDependencies": {
+ "karma": ">=0.9"
+ }
+ },
+ "node_modules/karma-expect": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/karma-expect/-/karma-expect-1.1.3.tgz",
+ "integrity": "sha1-xrClb/GJA9sRr08JjMbnzxmM4nU=",
+ "dev": true,
+ "dependencies": {
+ "expect.js": "^0.3.1"
+ }
+ },
+ "node_modules/karma-firefox-launcher": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz",
+ "integrity": "sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==",
+ "dev": true,
+ "dependencies": {
+ "is-wsl": "^2.2.0",
+ "which": "^2.0.1"
+ }
+ },
+ "node_modules/karma-ie-launcher": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/karma-ie-launcher/-/karma-ie-launcher-1.0.0.tgz",
+ "integrity": "sha1-SXmGhCxJAZA0bNifVJTKmDDG1Zw=",
+ "dev": true,
+ "dependencies": {
+ "lodash": "^4.6.1"
+ },
+ "peerDependencies": {
+ "karma": ">=0.9"
+ }
+ },
+ "node_modules/karma-mocha": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz",
+ "integrity": "sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==",
+ "dev": true,
+ "dependencies": {
+ "minimist": "^1.2.3"
+ }
+ },
+ "node_modules/karma-rollup-preprocessor": {
+ "version": "7.0.7",
+ "resolved": "https://registry.npmjs.org/karma-rollup-preprocessor/-/karma-rollup-preprocessor-7.0.7.tgz",
+ "integrity": "sha512-Y1QwsTCiCBp8sSALZdqmqry/mWIWIy0V6zonUIpy+0/D/Kpb2XZvR+JZrWfacQvcvKQdZFJvg6EwlnKtjepu3Q==",
+ "dev": true,
+ "dependencies": {
+ "chokidar": "^3.3.1",
+ "debounce": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 8.0.0"
+ },
+ "peerDependencies": {
+ "rollup": ">= 1.0.0"
+ }
+ },
+ "node_modules/karma-safari-launcher": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/karma-safari-launcher/-/karma-safari-launcher-1.0.0.tgz",
+ "integrity": "sha1-lpgqLMR9BmquccVTursoMZEVos4=",
+ "dev": true,
+ "peerDependencies": {
+ "karma": ">=0.9"
+ }
+ },
+ "node_modules/karma-sinon": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/karma-sinon/-/karma-sinon-1.0.5.tgz",
+ "integrity": "sha1-TjRD8oMP3s/2JNN0cWPxIX2qKpo=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "peerDependencies": {
+ "karma": ">=0.10",
+ "sinon": "*"
+ }
+ },
+ "node_modules/karma/node_modules/graceful-fs": {
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
+ "dev": true
+ },
+ "node_modules/leafdoc": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/leafdoc/-/leafdoc-2.3.0.tgz",
+ "integrity": "sha512-+D3XwoLWCXG4Fcf6Ujo2gZ4jv6XK7AQr1zv37lQ0B5dQ9Is9Lg3G0mL9hNBKMXb0Toq25w7r00PvUMfCQWSzYQ==",
+ "dev": true,
+ "dependencies": {
+ "handlebars": "^4.7.6",
+ "markdown-it": "^11.0.0",
+ "minimist": "^1.2.5",
+ "multilang-extract-comments": "^0.3.3",
+ "regenerate-unicode-properties": "^8.2.0",
+ "xregexp": "^4.3.0"
+ },
+ "bin": {
+ "leafdoc": "src/cli.mjs"
+ }
+ },
+ "node_modules/levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "dependencies": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/line-counter": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/line-counter/-/line-counter-1.1.0.tgz",
+ "integrity": "sha1-EN8sBGrTVG5yT7pV+nLN4YpqAfM=",
+ "dev": true
+ },
+ "node_modules/lines-and-columns": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
+ "dev": true
+ },
+ "node_modules/linkify-it": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz",
+ "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==",
+ "dev": true,
+ "dependencies": {
+ "uc.micro": "^1.0.1"
+ }
+ },
+ "node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/lodash": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "dev": true
+ },
+ "node_modules/lodash-es": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
+ "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
+ "dev": true
+ },
+ "node_modules/lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true
+ },
+ "node_modules/log-symbols": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
+ "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
+ "dev": true,
+ "dependencies": {
+ "chalk": "^4.1.0",
+ "is-unicode-supported": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log4js": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz",
+ "integrity": "sha512-Mc8jNuSFImQUIateBFwdOQcmC6Q5maU0VVvdC2R6XMb66/VnT+7WS4D/0EeNMZu1YODmJe5NIn2XftCzEocUgw==",
+ "dev": true,
+ "dependencies": {
+ "date-format": "^3.0.0",
+ "debug": "^4.1.1",
+ "flatted": "^2.0.1",
+ "rfdc": "^1.1.4",
+ "streamroller": "^2.2.4"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/log4js/node_modules/flatted": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
+ "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
+ "dev": true
+ },
+ "node_modules/lolex": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz",
+ "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==",
+ "dev": true
+ },
+ "node_modules/markdown-it": {
+ "version": "11.0.1",
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-11.0.1.tgz",
+ "integrity": "sha512-aU1TzmBKcWNNYvH9pjq6u92BML+Hz3h5S/QpfTFwiQF852pLT+9qHsrhM9JYipkOXZxGn+sGH8oyJE9FD9WezQ==",
+ "dev": true,
+ "dependencies": {
+ "argparse": "^1.0.7",
+ "entities": "~2.0.0",
+ "linkify-it": "^3.0.1",
+ "mdurl": "^1.0.1",
+ "uc.micro": "^1.0.5"
+ },
+ "bin": {
+ "markdown-it": "bin/markdown-it.js"
+ }
+ },
+ "node_modules/markdown-it/node_modules/argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "dependencies": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "node_modules/mdurl": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
+ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=",
+ "dev": true
+ },
+ "node_modules/media-typer": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/micromatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
+ "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",
+ "dev": true,
+ "dependencies": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.2.3"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/mime": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz",
+ "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==",
+ "dev": true,
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.50.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz",
+ "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.33",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz",
+ "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==",
+ "dev": true,
+ "dependencies": {
+ "mime-db": "1.50.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "dev": true
+ },
+ "node_modules/minipass": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.5.tgz",
+ "integrity": "sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==",
+ "dev": true,
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/mocha": {
+ "version": "9.1.4",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.4.tgz",
+ "integrity": "sha512-+q2aV5VlJZuLgCWoBvGI5zEwPF9eEI0kr/sAA9Jm4xMND7RfIEyF8JE7C0JIg8WXRG+P1sdIAb5ccoHPlXLzcw==",
+ "dev": true,
+ "dependencies": {
+ "@ungap/promise-all-settled": "1.1.2",
+ "ansi-colors": "4.1.1",
+ "browser-stdout": "1.3.1",
+ "chokidar": "3.5.2",
+ "debug": "4.3.2",
+ "diff": "5.0.0",
+ "escape-string-regexp": "4.0.0",
+ "find-up": "5.0.0",
+ "glob": "7.1.7",
+ "growl": "1.10.5",
+ "he": "1.2.0",
+ "js-yaml": "4.1.0",
+ "log-symbols": "4.1.0",
+ "minimatch": "3.0.4",
+ "ms": "2.1.3",
+ "nanoid": "3.1.25",
+ "serialize-javascript": "6.0.0",
+ "strip-json-comments": "3.1.1",
+ "supports-color": "8.1.1",
+ "which": "2.0.2",
+ "workerpool": "6.1.5",
+ "yargs": "16.2.0",
+ "yargs-parser": "20.2.4",
+ "yargs-unparser": "2.0.0"
+ },
+ "bin": {
+ "_mocha": "bin/_mocha",
+ "mocha": "bin/mocha"
+ },
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/mochajs"
+ }
+ },
+ "node_modules/mocha/node_modules/glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "dev": true,
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/mocha/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "node_modules/mocha/node_modules/supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/supports-color?sponsor=1"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "node_modules/multilang-extract-comments": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/multilang-extract-comments/-/multilang-extract-comments-0.3.3.tgz",
+ "integrity": "sha512-9NqT+Cf1yvM/eYp+ILUczzz2ca4upYbdQQwSn550ldFA7hX2WVZzo7jaddFkSfq6EkIkPaeWBL+LP+BZuHK0oA==",
+ "dev": true,
+ "dependencies": {
+ "comment-patterns": "^0.11.0",
+ "line-counter": "^1.0.3",
+ "lodash": "^4.17.11",
+ "quotemeta": "0.0.0"
+ }
+ },
+ "node_modules/nanoclone": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz",
+ "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==",
+ "dev": true
+ },
+ "node_modules/nanoid": {
+ "version": "3.1.25",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz",
+ "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==",
+ "dev": true,
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+ "dev": true
+ },
+ "node_modules/negotiator": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
+ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/neo-async": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
+ "dev": true
+ },
+ "node_modules/nise": {
+ "version": "1.5.3",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz",
+ "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/formatio": "^3.2.1",
+ "@sinonjs/text-encoding": "^0.7.1",
+ "just-extend": "^4.0.2",
+ "lolex": "^5.0.1",
+ "path-to-regexp": "^1.7.0"
+ }
+ },
+ "node_modules/nise/node_modules/lolex": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz",
+ "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^1.7.0"
+ }
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
+ "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
+ "dev": true,
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/optionator": {
+ "version": "0.9.1",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
+ "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
+ "dev": true,
+ "dependencies": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.3"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
+ "dependencies": {
+ "yocto-queue": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "dependencies": {
+ "callsites": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/parse-json": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
+ "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
+ "dev": true,
+ "dependencies": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-even-better-errors": "^2.3.0",
+ "lines-and-columns": "^1.1.6"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
+ "dev": true
+ },
+ "node_modules/path-to-regexp": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
+ "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
+ "dev": true,
+ "dependencies": {
+ "isarray": "0.0.1"
+ }
+ },
+ "node_modules/path-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
+ "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
+ "dev": true,
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/property-expr": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.4.tgz",
+ "integrity": "sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg==",
+ "dev": true
+ },
+ "node_modules/prosthetic-hand": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/prosthetic-hand/-/prosthetic-hand-1.4.0.tgz",
+ "integrity": "sha512-H0YgNfPFkO6x00Viw8+6LnqYisivAt8i3enoLnCxRUlT80DM/9i99BVBcKGUosPJ635CxlJMsYbjYLHCFpvF2w==",
+ "dev": true
+ },
+ "node_modules/punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/qjobs": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz",
+ "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.9"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
+ "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/quotemeta": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/quotemeta/-/quotemeta-0.0.0.tgz",
+ "integrity": "sha1-UdOgbuD81uO1AdvSiQQ1Gtelo4w=",
+ "dev": true
+ },
+ "node_modules/randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
+ "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
+ "dev": true,
+ "dependencies": {
+ "bytes": "3.1.0",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "unpipe": "1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/rechoir": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
+ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+ "dev": true,
+ "dependencies": {
+ "resolve": "^1.1.6"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/regenerate": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
+ "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==",
+ "dev": true
+ },
+ "node_modules/regenerate-unicode-properties": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz",
+ "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==",
+ "dev": true,
+ "dependencies": {
+ "regenerate": "^1.4.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/regenerator-runtime": {
+ "version": "0.13.9",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
+ "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==",
+ "dev": true
+ },
+ "node_modules/regexpp": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
+ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ }
+ },
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/requires-port": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
+ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
+ "dev": true
+ },
+ "node_modules/resolve": {
+ "version": "1.20.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
+ "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
+ "dev": true,
+ "dependencies": {
+ "is-core-module": "^2.2.0",
+ "path-parse": "^1.0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/rfdc": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",
+ "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==",
+ "dev": true
+ },
+ "node_modules/rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dev": true,
+ "dependencies": {
+ "glob": "^7.1.3"
+ },
+ "bin": {
+ "rimraf": "bin.js"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/rollup": {
+ "version": "2.64.0",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.64.0.tgz",
+ "integrity": "sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==",
+ "dev": true,
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/rollup-plugin-git-version": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-git-version/-/rollup-plugin-git-version-0.3.1.tgz",
+ "integrity": "sha512-u0jlr6PZvENfYFTjEZShKVXRlQ0maKJmsGNsq/wsAwvihTvXRt9sLBVLed1cmMH+JTCguwdIQWcORkQ7oskPWQ==",
+ "dev": true,
+ "dependencies": {
+ "@rollup/plugin-json": "^4.0.0"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "node_modules/serialize-javascript": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
+ "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
+ "dev": true,
+ "dependencies": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
+ "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==",
+ "dev": true
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "dev": true,
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shelljs": {
+ "version": "0.8.4",
+ "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz",
+ "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==",
+ "dev": true,
+ "dependencies": {
+ "glob": "^7.0.0",
+ "interpret": "^1.0.0",
+ "rechoir": "^0.6.2"
+ },
+ "bin": {
+ "shjs": "bin/shjs"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/sinon": {
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz",
+ "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^1.4.0",
+ "@sinonjs/formatio": "^3.2.1",
+ "@sinonjs/samsam": "^3.3.3",
+ "diff": "^3.5.0",
+ "lolex": "^4.2.0",
+ "nise": "^1.5.2",
+ "supports-color": "^5.5.0"
+ }
+ },
+ "node_modules/sinon/node_modules/diff": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
+ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.3.1"
+ }
+ },
+ "node_modules/sinon/node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/sinon/node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/socket.io": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.3.1.tgz",
+ "integrity": "sha512-HC5w5Olv2XZ0XJ4gOLGzzHEuOCfj3G0SmoW3jLHYYh34EVsIr3EkW9h6kgfW+K3TFEcmYy8JcPWe//KUkBp5jA==",
+ "dev": true,
+ "dependencies": {
+ "accepts": "~1.3.4",
+ "base64id": "~2.0.0",
+ "debug": "~4.3.2",
+ "engine.io": "~6.0.0",
+ "socket.io-adapter": "~2.3.2",
+ "socket.io-parser": "~4.0.4"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/socket.io-adapter": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.3.2.tgz",
+ "integrity": "sha512-PBZpxUPYjmoogY0aoaTmo1643JelsaS1CiAwNjRVdrI0X9Seuc19Y2Wife8k88avW6haG8cznvwbubAZwH4Mtg==",
+ "dev": true
+ },
+ "node_modules/socket.io-parser": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
+ "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
+ "dev": true,
+ "dependencies": {
+ "@types/component-emitter": "^1.2.10",
+ "component-emitter": "~1.3.0",
+ "debug": "~4.3.1"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/split-lines": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/split-lines/-/split-lines-1.1.0.tgz",
+ "integrity": "sha1-Oruo9ZhhQUL5240nq2q4dWYqHgk=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ },
+ "node_modules/ssri": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
+ "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==",
+ "dev": true,
+ "dependencies": {
+ "minipass": "^3.1.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
+ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/streamroller": {
+ "version": "2.2.4",
+ "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz",
+ "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==",
+ "dev": true,
+ "dependencies": {
+ "date-format": "^2.1.0",
+ "debug": "^4.1.1",
+ "fs-extra": "^8.1.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/streamroller/node_modules/date-format": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz",
+ "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
+ "dev": true
+ },
+ "node_modules/tmp": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
+ "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
+ "dev": true,
+ "dependencies": {
+ "rimraf": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8.17.0"
+ }
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
+ "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/toposort": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz",
+ "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=",
+ "dev": true
+ },
+ "node_modules/type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "dependencies": {
+ "prelude-ls": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/type-detect": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
+ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/type-fest": {
+ "version": "0.20.2",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
+ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "1.6.18",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+ "dev": true,
+ "dependencies": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ua-parser-js": {
+ "version": "0.7.31",
+ "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz",
+ "integrity": "sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/ua-parser-js"
+ },
+ {
+ "type": "paypal",
+ "url": "https://paypal.me/faisalman"
+ }
+ ],
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/uc.micro": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
+ "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
+ "dev": true
+ },
+ "node_modules/uglify-js": {
+ "version": "3.14.5",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz",
+ "integrity": "sha512-qZukoSxOG0urUTvjc2ERMTcAy+BiFh3weWAkeurLwjrCba73poHmG3E36XEjd/JGukMzwTL7uCxZiAexj8ppvQ==",
+ "dev": true,
+ "bin": {
+ "uglifyjs": "bin/uglifyjs"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4.0.0"
+ }
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/v8-compile-cache": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
+ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
+ "dev": true
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/void-elements": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz",
+ "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/word-wrap": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
+ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
+ "dev": true
+ },
+ "node_modules/workerpool": {
+ "version": "6.1.5",
+ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz",
+ "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==",
+ "dev": true
+ },
+ "node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "node_modules/ws": {
+ "version": "8.2.3",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
+ "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": "^5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/xregexp": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.4.1.tgz",
+ "integrity": "sha512-2u9HwfadaJaY9zHtRRnH6BY6CQVNQKkYm3oLtC9gJXXzfsbACg5X5e4EZZGVAH+YIfa+QA9lsFQTTe3HURF3ag==",
+ "dev": true,
+ "dependencies": {
+ "@babel/runtime-corejs3": "^7.12.1"
+ }
+ },
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ },
+ "node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "dev": true,
+ "dependencies": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "20.2.4",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
+ "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yargs-unparser": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
+ "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
+ "dev": true,
+ "dependencies": {
+ "camelcase": "^6.0.0",
+ "decamelize": "^4.0.0",
+ "flat": "^5.0.2",
+ "is-plain-obj": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/yup": {
+ "version": "0.32.11",
+ "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz",
+ "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==",
+ "dev": true,
+ "dependencies": {
+ "@babel/runtime": "^7.15.4",
+ "@types/lodash": "^4.14.175",
+ "lodash": "^4.17.21",
+ "lodash-es": "^4.17.21",
+ "nanoclone": "^0.2.1",
+ "property-expr": "^2.0.4",
+ "toposort": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ }
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz",
+ "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.16.7"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz",
+ "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz",
+ "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.16.7",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
+ "dev": true
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "@babel/runtime": {
+ "version": "7.16.7",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
+ "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
+ "dev": true,
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "@babel/runtime-corejs3": {
+ "version": "7.16.0",
+ "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.16.0.tgz",
+ "integrity": "sha512-Oi2qwQ21X7/d9gn3WiwkDTJmq3TQtYNz89lRnoFy8VeZpWlsyXvzSwiRrRZ8cXluvSwqKxqHJ6dBd9Rv+p0ZGQ==",
+ "dev": true,
+ "requires": {
+ "core-js-pure": "^3.19.0",
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "@eslint/eslintrc": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz",
+ "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.12.4",
+ "debug": "^4.3.2",
+ "espree": "^9.2.0",
+ "globals": "^13.9.0",
+ "ignore": "^4.0.6",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^4.1.0",
+ "minimatch": "^3.0.4",
+ "strip-json-comments": "^3.1.1"
+ }
+ },
+ "@humanwhocodes/config-array": {
+ "version": "0.9.2",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz",
+ "integrity": "sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA==",
+ "dev": true,
+ "requires": {
+ "@humanwhocodes/object-schema": "^1.2.1",
+ "debug": "^4.1.1",
+ "minimatch": "^3.0.4"
+ }
+ },
+ "@humanwhocodes/object-schema": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
+ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
+ "dev": true
+ },
+ "@rollup/plugin-json": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz",
+ "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==",
+ "dev": true,
+ "requires": {
+ "@rollup/pluginutils": "^3.0.8"
+ }
+ },
+ "@rollup/pluginutils": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
+ "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==",
+ "dev": true,
+ "requires": {
+ "@types/estree": "0.0.39",
+ "estree-walker": "^1.0.1",
+ "picomatch": "^2.2.2"
+ }
+ },
+ "@sinonjs/commons": {
+ "version": "1.8.3",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz",
+ "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "@sinonjs/formatio": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz",
+ "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1",
+ "@sinonjs/samsam": "^3.1.0"
+ }
+ },
+ "@sinonjs/samsam": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz",
+ "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.3.0",
+ "array-from": "^2.1.1",
+ "lodash": "^4.17.15"
+ }
+ },
+ "@sinonjs/text-encoding": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
+ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
+ "dev": true
+ },
+ "@types/component-emitter": {
+ "version": "1.2.11",
+ "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
+ "integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==",
+ "dev": true
+ },
+ "@types/cookie": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
+ "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
+ "dev": true
+ },
+ "@types/cors": {
+ "version": "2.8.12",
+ "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz",
+ "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==",
+ "dev": true
+ },
+ "@types/estree": {
+ "version": "0.0.39",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
+ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
+ "dev": true
+ },
+ "@types/lodash": {
+ "version": "4.14.178",
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz",
+ "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "16.11.6",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
+ "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==",
+ "dev": true
+ },
+ "@types/parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
+ "dev": true
+ },
+ "@ungap/promise-all-settled": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
+ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
+ "dev": true
+ },
+ "accepts": {
+ "version": "1.3.7",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
+ "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
+ "dev": true,
+ "requires": {
+ "mime-types": "~2.1.24",
+ "negotiator": "0.6.2"
+ }
+ },
+ "acorn": {
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
+ "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
+ "dev": true
+ },
+ "acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "requires": {}
+ },
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ansi-colors": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
+ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
+ "dev": true
+ },
+ "ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "anymatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
+ "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "dev": true,
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
+ },
+ "array-from": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz",
+ "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=",
+ "dev": true
+ },
+ "axios": {
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
+ "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
+ "dev": true,
+ "requires": {
+ "follow-redirects": "^1.14.0"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
+ "base64-arraybuffer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.1.tgz",
+ "integrity": "sha512-vFIUq7FdLtjZMhATwDul5RZWv2jpXQ09Pd6jcVEOvIsqCWTRFD/ONHNfyOS8dA/Ippi5dsIgpyKWKZaAKZltbA==",
+ "dev": true
+ },
+ "base64id": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
+ "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
+ "dev": true
+ },
+ "binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "dev": true
+ },
+ "body-parser": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
+ "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
+ "dev": true,
+ "requires": {
+ "bytes": "3.1.0",
+ "content-type": "~1.0.4",
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "on-finished": "~2.3.0",
+ "qs": "6.7.0",
+ "raw-body": "2.4.0",
+ "type-is": "~1.6.17"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ }
+ }
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "brotli-size": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/brotli-size/-/brotli-size-4.0.0.tgz",
+ "integrity": "sha512-uA9fOtlTRC0iqKfzff1W34DXUA3GyVqbUaeo3Rw3d4gd1eavKVCETXrn3NzO74W+UVkG3UHu8WxUi+XvKI/huA==",
+ "dev": true,
+ "requires": {
+ "duplexer": "0.1.1"
+ }
+ },
+ "browser-stdout": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
+ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
+ "dev": true
+ },
+ "bundlemon": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/bundlemon/-/bundlemon-1.3.0.tgz",
+ "integrity": "sha512-6tSARvzrYf3K8xRC19GXBTCI4p45QxDV4VyyYEh1hUuM7gJdBIAUalhZY/5yidmhthGkonIVTh3taH054BLqGw==",
+ "dev": true,
+ "requires": {
+ "axios": "^0.21.1",
+ "brotli-size": "^4.0.0",
+ "bundlemon-utils": "^0.4.0",
+ "bytes": "^3.1.0",
+ "chalk": "^4.1.1",
+ "commander": "^8.0.0",
+ "cosmiconfig": "^7.0.0",
+ "gzip-size": "^6.0.0",
+ "micromatch": "^4.0.4",
+ "yup": "^0.32.11"
+ }
+ },
+ "bundlemon-utils": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/bundlemon-utils/-/bundlemon-utils-0.4.0.tgz",
+ "integrity": "sha512-BqYhoCgkPNgdN3ORpj2Xqphj+OQ4iHGBqq9KfM2aQpj+RAauVS2F0EAe77ZXpme2JLbLJq6MyrUOHoeXvB2lGA==",
+ "dev": true,
+ "requires": {
+ "bytes": "^3.1.0"
+ }
+ },
+ "bytes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
+ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
+ "dev": true
+ },
+ "callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true
+ },
+ "camelcase": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
+ "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==",
+ "dev": true
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "chokidar": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz",
+ "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==",
+ "dev": true,
+ "requires": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "fsevents": "~2.3.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "dependencies": {
+ "glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ }
+ }
+ },
+ "cliui": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "dev": true,
+ "requires": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^7.0.0"
+ }
+ },
+ "clone-regexp": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.1.tgz",
+ "integrity": "sha512-Fcij9IwRW27XedRIJnSOEupS7RVcXtObJXbcUOX93UCLqqOdRpkvzKywOOSizmEK/Is3S/RHX9dLdfo6R1Q1mw==",
+ "dev": true,
+ "requires": {
+ "is-regexp": "^1.0.0",
+ "is-supported-regexp-flag": "^1.0.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "colors": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
+ "dev": true
+ },
+ "commander": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
+ "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
+ "dev": true
+ },
+ "comment-patterns": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/comment-patterns/-/comment-patterns-0.11.0.tgz",
+ "integrity": "sha512-YgQOR0QcCIE0mYFywZ0ToK8r7V+48FjEWA6Jflfvxf5JlGZtJEi8BzMcc4BXcaVUyU1DUSGEhppSUfJOI2YC/w==",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.17.11"
+ }
+ },
+ "component-emitter": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
+ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
+ "dev": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
+ },
+ "connect": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz",
+ "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "finalhandler": "1.1.2",
+ "parseurl": "~1.3.3",
+ "utils-merge": "1.0.1"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ }
+ }
+ },
+ "content-type": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
+ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
+ "dev": true
+ },
+ "cookie": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
+ "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==",
+ "dev": true
+ },
+ "core-js-pure": {
+ "version": "3.19.0",
+ "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.19.0.tgz",
+ "integrity": "sha512-UEQk8AxyCYvNAs6baNoPqDADv7BX0AmBLGxVsrAifPPx/C8EAzV4Q+2ZUJqVzfI2TQQEZITnwUkWcHpgc/IubQ==",
+ "dev": true
+ },
+ "cors": {
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
+ "dev": true,
+ "requires": {
+ "object-assign": "^4",
+ "vary": "^1"
+ }
+ },
+ "cosmiconfig": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz",
+ "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==",
+ "dev": true,
+ "requires": {
+ "@types/parse-json": "^4.0.0",
+ "import-fresh": "^3.2.1",
+ "parse-json": "^5.0.0",
+ "path-type": "^4.0.0",
+ "yaml": "^1.10.0"
+ }
+ },
+ "cross-spawn": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
+ "dev": true,
+ "requires": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ }
+ },
+ "custom-event": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz",
+ "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=",
+ "dev": true
+ },
+ "date-format": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz",
+ "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==",
+ "dev": true
+ },
+ "debounce": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz",
+ "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==",
+ "dev": true
+ },
+ "debug": {
+ "version": "4.3.2",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
+ "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "decamelize": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
+ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
+ "dev": true
+ },
+ "deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true
+ },
+ "depd": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
+ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
+ "dev": true
+ },
+ "di": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz",
+ "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=",
+ "dev": true
+ },
+ "diff": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
+ "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
+ "dev": true
+ },
+ "doctrine": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+ "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
+ "dom-serialize": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz",
+ "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=",
+ "dev": true,
+ "requires": {
+ "custom-event": "~1.0.0",
+ "ent": "~2.2.0",
+ "extend": "^3.0.0",
+ "void-elements": "^2.0.0"
+ }
+ },
+ "duplexer": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
+ "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
+ "dev": true
+ },
+ "edge-launcher": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/edge-launcher/-/edge-launcher-1.2.2.tgz",
+ "integrity": "sha1-60Cq+9Bnpup27/+rBke81VCbN7I=",
+ "dev": true
+ },
+ "ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
+ "dev": true
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
+ "dev": true
+ },
+ "engine.io": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.0.0.tgz",
+ "integrity": "sha512-Ui7yl3JajEIaACg8MOUwWvuuwU7jepZqX3BKs1ho7NQRuP4LhN4XIykXhp8bEy+x/DhA0LBZZXYSCkZDqrwMMg==",
+ "dev": true,
+ "requires": {
+ "@types/cookie": "^0.4.1",
+ "@types/cors": "^2.8.12",
+ "@types/node": ">=10.0.0",
+ "accepts": "~1.3.4",
+ "base64id": "2.0.0",
+ "cookie": "~0.4.1",
+ "cors": "~2.8.5",
+ "debug": "~4.3.1",
+ "engine.io-parser": "~5.0.0",
+ "ws": "~8.2.3"
+ }
+ },
+ "engine.io-parser": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.1.tgz",
+ "integrity": "sha512-j4p3WwJrG2k92VISM0op7wiq60vO92MlF3CRGxhKHy9ywG1/Dkc72g0dXeDQ+//hrcDn8gqQzoEkdO9FN0d9AA==",
+ "dev": true,
+ "requires": {
+ "base64-arraybuffer": "~1.0.1"
+ }
+ },
+ "ent": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz",
+ "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=",
+ "dev": true
+ },
+ "entities": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz",
+ "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==",
+ "dev": true
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "dev": true
+ },
+ "escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
+ "dev": true
+ },
+ "escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true
+ },
+ "eslint": {
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.7.0.tgz",
+ "integrity": "sha512-ifHYzkBGrzS2iDU7KjhCAVMGCvF6M3Xfs8X8b37cgrUlDt6bWRTpRh6T/gtSXv1HJ/BUGgmjvNvOEGu85Iif7w==",
+ "dev": true,
+ "requires": {
+ "@eslint/eslintrc": "^1.0.5",
+ "@humanwhocodes/config-array": "^0.9.2",
+ "ajv": "^6.10.0",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.2",
+ "debug": "^4.3.2",
+ "doctrine": "^3.0.0",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^7.1.0",
+ "eslint-utils": "^3.0.0",
+ "eslint-visitor-keys": "^3.2.0",
+ "espree": "^9.3.0",
+ "esquery": "^1.4.0",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^6.0.1",
+ "functional-red-black-tree": "^1.0.1",
+ "glob-parent": "^6.0.1",
+ "globals": "^13.6.0",
+ "ignore": "^5.2.0",
+ "import-fresh": "^3.0.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "js-yaml": "^4.1.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.4.1",
+ "lodash.merge": "^4.6.2",
+ "minimatch": "^3.0.4",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.1",
+ "regexpp": "^3.2.0",
+ "strip-ansi": "^6.0.1",
+ "strip-json-comments": "^3.1.0",
+ "text-table": "^0.2.0",
+ "v8-compile-cache": "^2.0.3"
+ },
+ "dependencies": {
+ "ignore": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
+ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==",
+ "dev": true
+ }
+ }
+ },
+ "eslint-config-mourner": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/eslint-config-mourner/-/eslint-config-mourner-2.0.3.tgz",
+ "integrity": "sha512-ydFFzE/WkqvmozI3CM0lAtDZoYfmN03ycjlHzdPZW5x+o3Me1pI0lyfpsWoz9kOqykZk8qlvOVC5BN5UMwtXrg==",
+ "dev": true
+ },
+ "eslint-plugin-script-tags": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-script-tags/-/eslint-plugin-script-tags-0.5.0.tgz",
+ "integrity": "sha512-iomN8+MwDyhRGWKwRKfBg4EchXuOCJ4iPC8bE9q255xdneXdIhvJU0AaWEe9GPXQIrJ3JKNKZbU1dAlAPbyyAg==",
+ "dev": true,
+ "requires": {
+ "execall": "^1.0.0",
+ "lodash": "^4.16.0",
+ "split-lines": "^1.1.0"
+ }
+ },
+ "eslint-scope": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz",
+ "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==",
+ "dev": true,
+ "requires": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ }
+ },
+ "eslint-utils": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz",
+ "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==",
+ "dev": true,
+ "requires": {
+ "eslint-visitor-keys": "^2.0.0"
+ },
+ "dependencies": {
+ "eslint-visitor-keys": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz",
+ "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==",
+ "dev": true
+ }
+ }
+ },
+ "eslint-visitor-keys": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz",
+ "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==",
+ "dev": true
+ },
+ "espree": {
+ "version": "9.3.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz",
+ "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==",
+ "dev": true,
+ "requires": {
+ "acorn": "^8.7.0",
+ "acorn-jsx": "^5.3.1",
+ "eslint-visitor-keys": "^3.1.0"
+ }
+ },
+ "esquery": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
+ "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^5.1.0"
+ }
+ },
+ "esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^5.2.0"
+ }
+ },
+ "estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true
+ },
+ "estree-walker": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
+ "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==",
+ "dev": true
+ },
+ "esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true
+ },
+ "eventemitter3": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
+ "dev": true
+ },
+ "execall": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execall/-/execall-1.0.0.tgz",
+ "integrity": "sha1-c9CQTjlbPKsGWLCNCewlMH8pu3M=",
+ "dev": true,
+ "requires": {
+ "clone-regexp": "^1.0.0"
+ }
+ },
+ "expect.js": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz",
+ "integrity": "sha1-sKWaDS7/VDdUTr8M6qYBWEHQm1s=",
+ "dev": true
+ },
+ "extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "dev": true
+ },
+ "fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+ "dev": true
+ },
+ "file-entry-cache": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
+ "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
+ "dev": true,
+ "requires": {
+ "flat-cache": "^3.0.4"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "finalhandler": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
+ "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.3",
+ "statuses": "~1.5.0",
+ "unpipe": "~1.0.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ }
+ }
+ },
+ "find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "flat": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
+ "dev": true
+ },
+ "flat-cache": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
+ "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+ "dev": true,
+ "requires": {
+ "flatted": "^3.1.0",
+ "rimraf": "^3.0.2"
+ }
+ },
+ "flatted": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz",
+ "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==",
+ "dev": true
+ },
+ "follow-redirects": {
+ "version": "1.14.5",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz",
+ "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==",
+ "dev": true
+ },
+ "fs-extra": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
+ "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ },
+ "dependencies": {
+ "graceful-fs": {
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
+ "dev": true
+ }
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
+ },
+ "fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "dev": true,
+ "optional": true
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "git-rev-sync": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/git-rev-sync/-/git-rev-sync-3.0.1.tgz",
+ "integrity": "sha512-8xZzUwzukIuU3sasgYt3RELc3Ny7o+tbtvitnnU4a4j3djyZNpJ5JmqVX+K7Xv3gE/i7ln3hGdBfZ00T5WWoow==",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "1.0.5",
+ "graceful-fs": "4.1.15",
+ "shelljs": "0.8.4"
+ },
+ "dependencies": {
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
+ }
+ }
+ },
+ "glob": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
+ "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.3"
+ }
+ },
+ "globals": {
+ "version": "13.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz",
+ "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.20.2"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.1.15",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
+ "dev": true
+ },
+ "growl": {
+ "version": "1.10.5",
+ "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
+ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
+ "dev": true
+ },
+ "gzip-size": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz",
+ "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==",
+ "dev": true,
+ "requires": {
+ "duplexer": "^0.1.2"
+ },
+ "dependencies": {
+ "duplexer": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
+ "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
+ "dev": true
+ }
+ }
+ },
+ "handlebars": {
+ "version": "4.7.7",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
+ "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5",
+ "neo-async": "^2.6.0",
+ "source-map": "^0.6.1",
+ "uglify-js": "^3.1.4",
+ "wordwrap": "^1.0.0"
+ }
+ },
+ "happen": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/happen/-/happen-0.3.2.tgz",
+ "integrity": "sha512-fBouIWb3fMsRCfCySHgk6+/gTEijMAWUZM/TYKmjuui9VsdS2DGWNjcH9cN7/tPn9nSkxGSGLJU6FHh37G0WUg==",
+ "dev": true
+ },
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "he": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "dev": true
+ },
+ "http-errors": {
+ "version": "1.7.2",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
+ "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
+ "dev": true,
+ "requires": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.1",
+ "statuses": ">= 1.5.0 < 2",
+ "toidentifier": "1.0.0"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ }
+ }
+ },
+ "http-proxy": {
+ "version": "1.18.1",
+ "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
+ "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
+ "dev": true,
+ "requires": {
+ "eventemitter3": "^4.0.0",
+ "follow-redirects": "^1.0.0",
+ "requires-port": "^1.0.0"
+ }
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "ignore": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+ "dev": true
+ },
+ "import-fresh": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
+ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+ "dev": true,
+ "requires": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ }
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+ "dev": true
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "interpret": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
+ "dev": true
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "requires": {
+ "binary-extensions": "^2.0.0"
+ }
+ },
+ "is-core-module": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
+ "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
+ "is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true
+ },
+ "is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "is-plain-obj": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
+ "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
+ "dev": true
+ },
+ "is-regexp": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz",
+ "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=",
+ "dev": true
+ },
+ "is-supported-regexp-flag": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.1.tgz",
+ "integrity": "sha512-3vcJecUUrpgCqc/ca0aWeNu64UGgxcvO60K/Fkr1N6RSvfGCTU60UKN68JDmKokgba0rFFJs12EnzOQa14ubKQ==",
+ "dev": true
+ },
+ "is-unicode-supported": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
+ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
+ "dev": true
+ },
+ "is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "requires": {
+ "is-docker": "^2.0.0"
+ }
+ },
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "isbinaryfile": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.8.tgz",
+ "integrity": "sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w==",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "requires": {
+ "argparse": "^2.0.1"
+ }
+ },
+ "json-parse-even-better-errors": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
+ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
+ "dev": true
+ },
+ "json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
+ "dev": true
+ },
+ "jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "just-extend": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz",
+ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
+ "dev": true
+ },
+ "karma": {
+ "version": "6.3.11",
+ "resolved": "https://registry.npmjs.org/karma/-/karma-6.3.11.tgz",
+ "integrity": "sha512-QGUh4yXgizzDNPLB5nWTvP+wysKexngbyLVWFOyikB661hpa2RZLf5anZQzqliWtAQuYVep0ot0D1U7UQKpsxQ==",
+ "dev": true,
+ "requires": {
+ "body-parser": "^1.19.0",
+ "braces": "^3.0.2",
+ "chokidar": "^3.5.1",
+ "colors": "1.4.0",
+ "connect": "^3.7.0",
+ "di": "^0.0.1",
+ "dom-serialize": "^2.2.1",
+ "glob": "^7.1.7",
+ "graceful-fs": "^4.2.6",
+ "http-proxy": "^1.18.1",
+ "isbinaryfile": "^4.0.8",
+ "lodash": "^4.17.21",
+ "log4js": "^6.3.0",
+ "mime": "^2.5.2",
+ "minimatch": "^3.0.4",
+ "qjobs": "^1.2.0",
+ "range-parser": "^1.2.1",
+ "rimraf": "^3.0.2",
+ "socket.io": "^4.2.0",
+ "source-map": "^0.6.1",
+ "tmp": "^0.2.1",
+ "ua-parser-js": "^0.7.30",
+ "yargs": "^16.1.1"
+ },
+ "dependencies": {
+ "graceful-fs": {
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
+ "dev": true
+ }
+ }
+ },
+ "karma-chrome-launcher": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz",
+ "integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==",
+ "dev": true,
+ "requires": {
+ "which": "^1.2.1"
+ },
+ "dependencies": {
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
+ "karma-edge-launcher": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/karma-edge-launcher/-/karma-edge-launcher-0.4.2.tgz",
+ "integrity": "sha512-YAJZb1fmRcxNhMIWYsjLuxwODBjh2cSHgTW/jkVmdpGguJjLbs9ZgIK/tEJsMQcBLUkO+yO4LBbqYxqgGW2HIw==",
+ "dev": true,
+ "requires": {
+ "edge-launcher": "1.2.2"
+ }
+ },
+ "karma-expect": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/karma-expect/-/karma-expect-1.1.3.tgz",
+ "integrity": "sha1-xrClb/GJA9sRr08JjMbnzxmM4nU=",
+ "dev": true,
+ "requires": {
+ "expect.js": "^0.3.1"
+ }
+ },
+ "karma-firefox-launcher": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz",
+ "integrity": "sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==",
+ "dev": true,
+ "requires": {
+ "is-wsl": "^2.2.0",
+ "which": "^2.0.1"
+ }
+ },
+ "karma-ie-launcher": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/karma-ie-launcher/-/karma-ie-launcher-1.0.0.tgz",
+ "integrity": "sha1-SXmGhCxJAZA0bNifVJTKmDDG1Zw=",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.6.1"
+ }
+ },
+ "karma-mocha": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz",
+ "integrity": "sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.3"
+ }
+ },
+ "karma-rollup-preprocessor": {
+ "version": "7.0.7",
+ "resolved": "https://registry.npmjs.org/karma-rollup-preprocessor/-/karma-rollup-preprocessor-7.0.7.tgz",
+ "integrity": "sha512-Y1QwsTCiCBp8sSALZdqmqry/mWIWIy0V6zonUIpy+0/D/Kpb2XZvR+JZrWfacQvcvKQdZFJvg6EwlnKtjepu3Q==",
+ "dev": true,
+ "requires": {
+ "chokidar": "^3.3.1",
+ "debounce": "^1.2.0"
+ }
+ },
+ "karma-safari-launcher": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/karma-safari-launcher/-/karma-safari-launcher-1.0.0.tgz",
+ "integrity": "sha1-lpgqLMR9BmquccVTursoMZEVos4=",
+ "dev": true,
+ "requires": {}
+ },
+ "karma-sinon": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/karma-sinon/-/karma-sinon-1.0.5.tgz",
+ "integrity": "sha1-TjRD8oMP3s/2JNN0cWPxIX2qKpo=",
+ "dev": true,
+ "requires": {}
+ },
+ "leafdoc": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/leafdoc/-/leafdoc-2.3.0.tgz",
+ "integrity": "sha512-+D3XwoLWCXG4Fcf6Ujo2gZ4jv6XK7AQr1zv37lQ0B5dQ9Is9Lg3G0mL9hNBKMXb0Toq25w7r00PvUMfCQWSzYQ==",
+ "dev": true,
+ "requires": {
+ "handlebars": "^4.7.6",
+ "markdown-it": "^11.0.0",
+ "minimist": "^1.2.5",
+ "multilang-extract-comments": "^0.3.3",
+ "regenerate-unicode-properties": "^8.2.0",
+ "xregexp": "^4.3.0"
+ }
+ },
+ "levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ }
+ },
+ "line-counter": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/line-counter/-/line-counter-1.1.0.tgz",
+ "integrity": "sha1-EN8sBGrTVG5yT7pV+nLN4YpqAfM=",
+ "dev": true
+ },
+ "lines-and-columns": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
+ "dev": true
+ },
+ "linkify-it": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz",
+ "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==",
+ "dev": true,
+ "requires": {
+ "uc.micro": "^1.0.1"
+ }
+ },
+ "locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^5.0.0"
+ }
+ },
+ "lodash": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "dev": true
+ },
+ "lodash-es": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
+ "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
+ "dev": true
+ },
+ "lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true
+ },
+ "log-symbols": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
+ "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^4.1.0",
+ "is-unicode-supported": "^0.1.0"
+ }
+ },
+ "log4js": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz",
+ "integrity": "sha512-Mc8jNuSFImQUIateBFwdOQcmC6Q5maU0VVvdC2R6XMb66/VnT+7WS4D/0EeNMZu1YODmJe5NIn2XftCzEocUgw==",
+ "dev": true,
+ "requires": {
+ "date-format": "^3.0.0",
+ "debug": "^4.1.1",
+ "flatted": "^2.0.1",
+ "rfdc": "^1.1.4",
+ "streamroller": "^2.2.4"
+ },
+ "dependencies": {
+ "flatted": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
+ "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
+ "dev": true
+ }
+ }
+ },
+ "lolex": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz",
+ "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==",
+ "dev": true
+ },
+ "markdown-it": {
+ "version": "11.0.1",
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-11.0.1.tgz",
+ "integrity": "sha512-aU1TzmBKcWNNYvH9pjq6u92BML+Hz3h5S/QpfTFwiQF852pLT+9qHsrhM9JYipkOXZxGn+sGH8oyJE9FD9WezQ==",
+ "dev": true,
+ "requires": {
+ "argparse": "^1.0.7",
+ "entities": "~2.0.0",
+ "linkify-it": "^3.0.1",
+ "mdurl": "^1.0.1",
+ "uc.micro": "^1.0.5"
+ },
+ "dependencies": {
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ }
+ }
+ },
+ "mdurl": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
+ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=",
+ "dev": true
+ },
+ "media-typer": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
+ "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.2.3"
+ }
+ },
+ "mime": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz",
+ "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==",
+ "dev": true
+ },
+ "mime-db": {
+ "version": "1.50.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz",
+ "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==",
+ "dev": true
+ },
+ "mime-types": {
+ "version": "2.1.33",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz",
+ "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==",
+ "dev": true,
+ "requires": {
+ "mime-db": "1.50.0"
+ }
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "dev": true
+ },
+ "minipass": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.5.tgz",
+ "integrity": "sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
+ "mocha": {
+ "version": "9.1.4",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.4.tgz",
+ "integrity": "sha512-+q2aV5VlJZuLgCWoBvGI5zEwPF9eEI0kr/sAA9Jm4xMND7RfIEyF8JE7C0JIg8WXRG+P1sdIAb5ccoHPlXLzcw==",
+ "dev": true,
+ "requires": {
+ "@ungap/promise-all-settled": "1.1.2",
+ "ansi-colors": "4.1.1",
+ "browser-stdout": "1.3.1",
+ "chokidar": "3.5.2",
+ "debug": "4.3.2",
+ "diff": "5.0.0",
+ "escape-string-regexp": "4.0.0",
+ "find-up": "5.0.0",
+ "glob": "7.1.7",
+ "growl": "1.10.5",
+ "he": "1.2.0",
+ "js-yaml": "4.1.0",
+ "log-symbols": "4.1.0",
+ "minimatch": "3.0.4",
+ "ms": "2.1.3",
+ "nanoid": "3.1.25",
+ "serialize-javascript": "6.0.0",
+ "strip-json-comments": "3.1.1",
+ "supports-color": "8.1.1",
+ "which": "2.0.2",
+ "workerpool": "6.1.5",
+ "yargs": "16.2.0",
+ "yargs-parser": "20.2.4",
+ "yargs-unparser": "2.0.0"
+ },
+ "dependencies": {
+ "glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "multilang-extract-comments": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/multilang-extract-comments/-/multilang-extract-comments-0.3.3.tgz",
+ "integrity": "sha512-9NqT+Cf1yvM/eYp+ILUczzz2ca4upYbdQQwSn550ldFA7hX2WVZzo7jaddFkSfq6EkIkPaeWBL+LP+BZuHK0oA==",
+ "dev": true,
+ "requires": {
+ "comment-patterns": "^0.11.0",
+ "line-counter": "^1.0.3",
+ "lodash": "^4.17.11",
+ "quotemeta": "0.0.0"
+ }
+ },
+ "nanoclone": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz",
+ "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==",
+ "dev": true
+ },
+ "nanoid": {
+ "version": "3.1.25",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz",
+ "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==",
+ "dev": true
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+ "dev": true
+ },
+ "negotiator": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
+ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
+ "dev": true
+ },
+ "neo-async": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
+ "dev": true
+ },
+ "nise": {
+ "version": "1.5.3",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz",
+ "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/formatio": "^3.2.1",
+ "@sinonjs/text-encoding": "^0.7.1",
+ "just-extend": "^4.0.2",
+ "lolex": "^5.0.1",
+ "path-to-regexp": "^1.7.0"
+ },
+ "dependencies": {
+ "lolex": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz",
+ "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.7.0"
+ }
+ }
+ }
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
+ "dev": true
+ },
+ "on-finished": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
+ "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
+ "dev": true,
+ "requires": {
+ "ee-first": "1.1.1"
+ }
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "optionator": {
+ "version": "0.9.1",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
+ "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
+ "dev": true,
+ "requires": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.3"
+ }
+ },
+ "p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
+ "requires": {
+ "yocto-queue": "^0.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^3.0.2"
+ }
+ },
+ "parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "requires": {
+ "callsites": "^3.0.0"
+ }
+ },
+ "parse-json": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
+ "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-even-better-errors": "^2.3.0",
+ "lines-and-columns": "^1.1.6"
+ }
+ },
+ "parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "dev": true
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
+ },
+ "path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "dev": true
+ },
+ "path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
+ "dev": true
+ },
+ "path-to-regexp": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
+ "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
+ "dev": true,
+ "requires": {
+ "isarray": "0.0.1"
+ }
+ },
+ "path-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
+ "dev": true
+ },
+ "picomatch": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
+ "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
+ "dev": true
+ },
+ "prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true
+ },
+ "property-expr": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.4.tgz",
+ "integrity": "sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg==",
+ "dev": true
+ },
+ "prosthetic-hand": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/prosthetic-hand/-/prosthetic-hand-1.4.0.tgz",
+ "integrity": "sha512-H0YgNfPFkO6x00Viw8+6LnqYisivAt8i3enoLnCxRUlT80DM/9i99BVBcKGUosPJ635CxlJMsYbjYLHCFpvF2w==",
+ "dev": true
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "dev": true
+ },
+ "qjobs": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz",
+ "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==",
+ "dev": true
+ },
+ "qs": {
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
+ "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
+ "dev": true
+ },
+ "quotemeta": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/quotemeta/-/quotemeta-0.0.0.tgz",
+ "integrity": "sha1-UdOgbuD81uO1AdvSiQQ1Gtelo4w=",
+ "dev": true
+ },
+ "randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "dev": true
+ },
+ "raw-body": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
+ "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
+ "dev": true,
+ "requires": {
+ "bytes": "3.1.0",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "unpipe": "1.0.0"
+ }
+ },
+ "readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "requires": {
+ "picomatch": "^2.2.1"
+ }
+ },
+ "rechoir": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
+ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+ "dev": true,
+ "requires": {
+ "resolve": "^1.1.6"
+ }
+ },
+ "regenerate": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
+ "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==",
+ "dev": true
+ },
+ "regenerate-unicode-properties": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz",
+ "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==",
+ "dev": true,
+ "requires": {
+ "regenerate": "^1.4.0"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.9",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
+ "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==",
+ "dev": true
+ },
+ "regexpp": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
+ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
+ "dev": true
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true
+ },
+ "requires-port": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
+ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.20.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
+ "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
+ "dev": true,
+ "requires": {
+ "is-core-module": "^2.2.0",
+ "path-parse": "^1.0.6"
+ }
+ },
+ "resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true
+ },
+ "rfdc": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",
+ "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "rollup": {
+ "version": "2.64.0",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.64.0.tgz",
+ "integrity": "sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==",
+ "dev": true,
+ "requires": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "rollup-plugin-git-version": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-git-version/-/rollup-plugin-git-version-0.3.1.tgz",
+ "integrity": "sha512-u0jlr6PZvENfYFTjEZShKVXRlQ0maKJmsGNsq/wsAwvihTvXRt9sLBVLed1cmMH+JTCguwdIQWcORkQ7oskPWQ==",
+ "dev": true,
+ "requires": {
+ "@rollup/plugin-json": "^4.0.0"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "serialize-javascript": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
+ "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "setprototypeof": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
+ "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^3.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "dev": true
+ },
+ "shelljs": {
+ "version": "0.8.4",
+ "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz",
+ "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.0.0",
+ "interpret": "^1.0.0",
+ "rechoir": "^0.6.2"
+ }
+ },
+ "sinon": {
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz",
+ "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.4.0",
+ "@sinonjs/formatio": "^3.2.1",
+ "@sinonjs/samsam": "^3.3.3",
+ "diff": "^3.5.0",
+ "lolex": "^4.2.0",
+ "nise": "^1.5.2",
+ "supports-color": "^5.5.0"
+ },
+ "dependencies": {
+ "diff": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
+ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "socket.io": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.3.1.tgz",
+ "integrity": "sha512-HC5w5Olv2XZ0XJ4gOLGzzHEuOCfj3G0SmoW3jLHYYh34EVsIr3EkW9h6kgfW+K3TFEcmYy8JcPWe//KUkBp5jA==",
+ "dev": true,
+ "requires": {
+ "accepts": "~1.3.4",
+ "base64id": "~2.0.0",
+ "debug": "~4.3.2",
+ "engine.io": "~6.0.0",
+ "socket.io-adapter": "~2.3.2",
+ "socket.io-parser": "~4.0.4"
+ }
+ },
+ "socket.io-adapter": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.3.2.tgz",
+ "integrity": "sha512-PBZpxUPYjmoogY0aoaTmo1643JelsaS1CiAwNjRVdrI0X9Seuc19Y2Wife8k88avW6haG8cznvwbubAZwH4Mtg==",
+ "dev": true
+ },
+ "socket.io-parser": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
+ "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
+ "dev": true,
+ "requires": {
+ "@types/component-emitter": "^1.2.10",
+ "component-emitter": "~1.3.0",
+ "debug": "~4.3.1"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "split-lines": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/split-lines/-/split-lines-1.1.0.tgz",
+ "integrity": "sha1-Oruo9ZhhQUL5240nq2q4dWYqHgk=",
+ "dev": true
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ },
+ "ssri": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
+ "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.1.1"
+ }
+ },
+ "statuses": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
+ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
+ "dev": true
+ },
+ "streamroller": {
+ "version": "2.2.4",
+ "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz",
+ "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==",
+ "dev": true,
+ "requires": {
+ "date-format": "^2.1.0",
+ "debug": "^4.1.1",
+ "fs-extra": "^8.1.0"
+ },
+ "dependencies": {
+ "date-format": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz",
+ "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==",
+ "dev": true
+ }
+ }
+ },
+ "string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ }
+ },
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ },
+ "strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
+ "dev": true
+ },
+ "tmp": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
+ "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
+ "dev": true,
+ "requires": {
+ "rimraf": "^3.0.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ },
+ "toidentifier": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
+ "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
+ "dev": true
+ },
+ "toposort": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz",
+ "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=",
+ "dev": true
+ },
+ "type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "^1.2.1"
+ }
+ },
+ "type-detect": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
+ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
+ "dev": true
+ },
+ "type-fest": {
+ "version": "0.20.2",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
+ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
+ "dev": true
+ },
+ "type-is": {
+ "version": "1.6.18",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+ "dev": true,
+ "requires": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ }
+ },
+ "ua-parser-js": {
+ "version": "0.7.31",
+ "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz",
+ "integrity": "sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==",
+ "dev": true
+ },
+ "uc.micro": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
+ "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
+ "dev": true
+ },
+ "uglify-js": {
+ "version": "3.14.5",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz",
+ "integrity": "sha512-qZukoSxOG0urUTvjc2ERMTcAy+BiFh3weWAkeurLwjrCba73poHmG3E36XEjd/JGukMzwTL7uCxZiAexj8ppvQ==",
+ "dev": true
+ },
+ "universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
+ "dev": true
+ },
+ "unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
+ "dev": true
+ },
+ "uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
+ "dev": true
+ },
+ "v8-compile-cache": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
+ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
+ "dev": true
+ },
+ "vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
+ "dev": true
+ },
+ "void-elements": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz",
+ "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=",
+ "dev": true
+ },
+ "which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "word-wrap": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
+ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+ "dev": true
+ },
+ "wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
+ "dev": true
+ },
+ "workerpool": {
+ "version": "6.1.5",
+ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz",
+ "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "ws": {
+ "version": "8.2.3",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
+ "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
+ "dev": true,
+ "requires": {}
+ },
+ "xregexp": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.4.1.tgz",
+ "integrity": "sha512-2u9HwfadaJaY9zHtRRnH6BY6CQVNQKkYm3oLtC9gJXXzfsbACg5X5e4EZZGVAH+YIfa+QA9lsFQTTe3HURF3ag==",
+ "dev": true,
+ "requires": {
+ "@babel/runtime-corejs3": "^7.12.1"
+ }
+ },
+ "y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ },
+ "yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "dev": true
+ },
+ "yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "20.2.4",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
+ "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
+ "dev": true
+ },
+ "yargs-unparser": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
+ "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^6.0.0",
+ "decamelize": "^4.0.0",
+ "flat": "^5.0.2",
+ "is-plain-obj": "^2.1.0"
+ }
+ },
+ "yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true
+ },
+ "yup": {
+ "version": "0.32.11",
+ "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz",
+ "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.15.4",
+ "@types/lodash": "^4.14.175",
+ "lodash": "^4.17.21",
+ "lodash-es": "^4.17.21",
+ "nanoclone": "^0.2.1",
+ "property-expr": "^2.0.4",
+ "toposort": "^2.0.2"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
index c1a3f95dd72..50da5fe4f2c 100644
--- a/package.json
+++ b/package.json
@@ -1,55 +1,67 @@
{
"name": "leaflet",
- "version": "1.5.1",
+ "version": "1.7.1",
"homepage": "https://leafletjs.com/",
"description": "JavaScript library for mobile-friendly interactive maps",
"devDependencies": {
- "eslint": "^4.19.1",
- "eslint-config-mourner": "^2.0.1",
- "git-rev-sync": "^1.12.0",
+ "@rollup/plugin-json": "^4.1.0",
+ "bundlemon": "^1.3.0",
+ "eslint": "^8.1.0",
+ "eslint-config-mourner": "^2.0.3",
+ "eslint-plugin-script-tags": "^0.5.0",
+ "git-rev-sync": "^3.0.1",
"happen": "~0.3.2",
- "karma": "^4.1.0",
- "karma-chrome-launcher": "^2.2.0",
+ "karma": "^6.3.6",
+ "karma-chrome-launcher": "^3.1.0",
+ "karma-edge-launcher": "^0.4.2",
"karma-expect": "^1.1.3",
- "karma-firefox-launcher": "~1.1.0",
- "karma-mocha": "^1.3.0",
- "karma-phantomjs-launcher": "^1.0.4",
- "karma-rollup-preprocessor": "^5.0.1",
+ "karma-firefox-launcher": "^2.1.1",
+ "karma-ie-launcher": "^1.0.0",
+ "karma-mocha": "^2.0.1",
+ "karma-rollup-preprocessor": "^7.0.7",
"karma-safari-launcher": "~1.0.0",
"karma-sinon": "^1.0.5",
- "leafdoc": "^1.4.1",
- "mocha": "^6.1.4",
- "phantomjs-prebuilt": "^2.1.16",
+ "leafdoc": "^2.3.0",
+ "mocha": "^9.1.3",
"prosthetic-hand": "^1.3.1",
- "rollup": "0.51.8",
- "rollup-plugin-git-version": "0.2.1",
- "rollup-plugin-json": "^4.0.0",
- "sinon": "^7.3.2",
- "ssri": "^6.0.1",
- "uglify-js": "~3.5.10"
+ "rollup": "^2.59.0",
+ "rollup-plugin-git-version": "^0.3.1",
+ "sinon": "^7.5.0",
+ "ssri": "^8.0.1",
+ "uglify-js": "^3.14.2"
},
"main": "dist/leaflet-src.js",
"style": "dist/leaflet.css",
"files": [
"dist",
"src",
- "!dist/leaflet.zip"
+ "!dist/leaflet.zip",
+ "!*.leafdoc"
],
"scripts": {
"docs": "node ./build/docs.js",
- "pretest": "npm run lint",
- "test": "npm run test-nolint",
- "test-nolint": "karma start ./spec/karma.conf.js",
+ "test": "karma start ./spec/karma.conf.js",
"build": "npm run rollup && npm run uglify",
- "release": "./build/publish.sh",
- "lint": "eslint src spec/suites docs/docs/js",
+ "lint": "eslint .",
"lintfix": "npm run lint -- --fix",
"rollup": "rollup -c build/rollup-config.js",
- "watch": "rollup -w -c build/rollup-watch-config.js",
- "uglify": "uglifyjs dist/leaflet-src.js -c -m -o dist/leaflet.js --source-map filename=dist/leaflet.js.map --in-source-map dist/leaflet-src.js.map --source-map-url leaflet.js.map --comments",
- "integrity": "node ./build/integrity.js"
+ "watch": "rollup -w -c build/rollup-config.js",
+ "uglify": "uglifyjs dist/leaflet-src.js -c -m -o dist/leaflet.js --source-map filename=dist/leaflet.js.map --source-map content=dist/leaflet-src.js.map --source-map url=leaflet.js.map --comments",
+ "integrity": "node ./build/integrity.js",
+ "bundlemon": "bundlemon --subProject no-compression --defaultCompression none && bundlemon --subProject gzip-compression --defaultCompression gzip"
},
"eslintConfig": {
+ "ignorePatterns": [
+ "dist",
+ "debug",
+ "docs/docs/highlight",
+ "docs/examples/choropleth/us-states.js",
+ "docs/examples/geojson/sample-geojson.js",
+ "docs/examples/map-panes/eu-countries.js",
+ "docs/examples/extending/extending-2-layers.md",
+ "docs/_posts/2012*",
+ "docs/_site"
+ ],
"root": true,
"globals": {
"L": true
@@ -60,6 +72,9 @@
"node": false
},
"extends": "mourner",
+ "plugins": [
+ "script-tags"
+ ],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
@@ -86,8 +101,36 @@
"strict": 0,
"wrap-iife": 0,
"key-spacing": 0,
- "consistent-return": 0
- }
+ "consistent-return": 0,
+ "no-unused-expressions": [
+ "error",
+ {
+ "allowShortCircuit": true
+ }
+ ]
+ },
+ "overrides": [
+ {
+ "files": [
+ "build/**/*"
+ ],
+ "env": {
+ "node": true
+ },
+ "rules": {
+ "global-require": 0
+ }
+ },
+ {
+ "files": [
+ "*.md"
+ ],
+ "rules": {
+ "eol-last": 0,
+ "no-unused-vars": 0
+ }
+ }
+ ]
},
"repository": {
"type": "git",
diff --git a/spec/.eslintrc b/spec/.eslintrc
index a30f63e55a8..69ccd8d0bab 100644
--- a/spec/.eslintrc
+++ b/spec/.eslintrc
@@ -1,11 +1,7 @@
{
"rules": {
- "no-unused-vars": 0,
"quotes": 0,
- "no-shadow": 0,
- "no-irregular-whitespace": 0,
"no-console": 0,
- "no-extend-native": 0
},
"env": {
"mocha": true
@@ -15,6 +11,6 @@
"sinon": false,
"happen": false,
"Hand": false,
- "takeScreenshot"
+ "touchEventType": false /* defined in SpecHelper.js */
}
}
diff --git a/spec/before.js b/spec/before.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/spec/index.html b/spec/index.html
index 5ae402a261d..f0e74016b26 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -3,8 +3,9 @@
Leaflet Spec Runner
+
-
+
@@ -16,18 +17,15 @@
-
-
@@ -44,6 +42,7 @@
+
@@ -55,10 +54,15 @@
-
+
+
+
+
+
+
@@ -91,15 +95,14 @@
+
+
-
-
-
-
diff --git a/spec/karma.conf.js b/spec/karma.conf.js
index 4ab07578139..f1aed91a9c7 100644
--- a/spec/karma.conf.js
+++ b/spec/karma.conf.js
@@ -1,20 +1,21 @@
-var json = require('rollup-plugin-json');
+var json = require('@rollup/plugin-json');
const outro = `var oldL = window.L;
-exports.noConflict = function() {
+leaflet.noConflict = function() {
window.L = oldL;
return this;
}
// Always export us to window global (see #2364)
-window.L = exports;`;
+window.L = leaflet;`;
// Karma configuration
module.exports = function (config) {
-// var libSources = require(__dirname + '/../build/build.js').getFiles();
+ // var libSources = require(__dirname + '/../build/build.js').getFiles();
var files = [
+ "spec/before.js",
"src/Leaflet.js",
"spec/after.js",
"node_modules/happen/happen.js",
@@ -38,7 +39,8 @@ module.exports = function (config) {
'karma-mocha',
'karma-sinon',
'karma-expect',
- 'karma-phantomjs-launcher',
+ 'karma-edge-launcher',
+ 'karma-ie-launcher',
'karma-chrome-launcher',
'karma-safari-launcher',
'karma-firefox-launcher'],
@@ -59,14 +61,17 @@ module.exports = function (config) {
plugins: [
json()
],
- format: 'umd',
- name: 'L',
- outro: outro
+ output: {
+ format: 'umd',
+ name: 'leaflet',
+ outro: outro,
+ freeze: false,
+ },
},
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
- reporters: ['dots'],
+ // reporters: ['dots'],
// web server port
port: 9876,
@@ -87,33 +92,51 @@ module.exports = function (config) {
// - Firefox
// - Opera
// - Safari (only Mac)
- // - PhantomJS
// - IE (only Windows)
- browsers: ['PhantomJSCustom'],
+ browsers: ['Chrome1280x1024'],
customLaunchers: {
- 'PhantomJSCustom': {
- base: 'PhantomJS',
- flags: ['--load-images=true'],
- options: {
- onCallback: function (data) {
- if (data.render) {
- page.render(data.render);
- }
- }
+ 'Chrome1280x1024': {
+ base: 'ChromeHeadless',
+ // increased viewport is required for some tests (TODO fix tests)
+ // https://github.com/Leaflet/Leaflet/issues/7113#issuecomment-619528577
+ flags: ['--window-size=1280,1024']
+ },
+ 'FirefoxTouch': {
+ base: 'FirefoxHeadless',
+ prefs: {
+ 'dom.w3c_touch_events.enabled': 1
}
+ },
+ 'FirefoxNoTouch': {
+ base: 'FirefoxHeadless',
+ prefs: {
+ 'dom.w3c_touch_events.enabled': 0
+ }
+ },
+ IE10: {
+ base: 'IE',
+ 'x-ua-compatible': 'IE=EmulateIE10'
}
},
+ concurrency: 1,
+
// If browser does not capture in given timeout [ms], kill it
- captureTimeout: 5000,
+ captureTimeout: 60000,
- // Workaround for PhantomJS random DISCONNECTED error
- browserDisconnectTimeout: 10000, // default 2000
- browserDisconnectTolerance: 1, // default 0
+ // Timeout for the client socket connection [ms].
+ browserSocketTimeout: 30000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
- singleRun: true
+ singleRun: true,
+
+ client: {
+ mocha: {
+ // eslint-disable-next-line no-undef
+ forbidOnly: process.env.CI || false
+ }
+ }
});
};
diff --git a/spec/suites/SpecHelper.js b/spec/suites/SpecHelper.js
index 900757c061b..f6a6fbc3a48 100644
--- a/spec/suites/SpecHelper.js
+++ b/spec/suites/SpecHelper.js
@@ -1,3 +1,4 @@
+/* eslint no-extend-native: 0 */
if (!Array.prototype.map) {
Array.prototype.map = function (fun) {
"use strict";
@@ -25,6 +26,7 @@ if (!Array.prototype.map) {
}
expect.Assertion.prototype.near = function (expected, delta) {
+ expected = L.point(expected);
delta = delta || 1;
expect(this.obj.x).to
.be.within(expected.x - delta, expected.x + delta);
@@ -33,6 +35,7 @@ expect.Assertion.prototype.near = function (expected, delta) {
};
expect.Assertion.prototype.nearLatLng = function (expected, delta) {
+ expected = L.latLng(expected);
delta = delta || 1e-4;
expect(this.obj.lat).to
.be.within(expected.lat - delta, expected.lat + delta);
@@ -49,22 +52,32 @@ happen.at = function (what, x, y, props) {
screenY: y,
which: 1,
button: 0
- }, props || {}));
+ }, props || {}));
};
+happen.makeEvent = (function (makeEvent) {
+ return function (o) {
+ var evt = makeEvent(o);
+ if (o.type.substring(0, 7) === 'pointer') {
+ evt.pointerId = o.pointerId;
+ evt.pointerType = o.pointerType;
+ }
+ return evt;
+ };
+})(happen.makeEvent);
+
// We'll want to skip a couple of things when in PhantomJS, due to lack of CSS animations
-it.skipInPhantom = L.Browser.any3d ? it : it.skip;
+it.skipIfNo3d = L.Browser.any3d ? it : it.skip;
// Viceversa: some tests we want only to run in browsers without CSS animations.
-it.skipInNonPhantom = L.Browser.any3d ? it.skip : it;
+it.skipIf3d = L.Browser.any3d ? it.skip : it;
// A couple of tests need the browser to be touch-capable
-it.skipIfNotTouch = window.TouchEvent ? it : it.skip;
+it.skipIfNotTouch = L.Browser.touch ? it : it.skip;
-// A couple of tests need the browser to be pointer-capable
-it.skipIfNotEdge = window.PointerEvent ? it : it.skip;
+var touchEventType = L.Browser.touchNative ? 'touch' : 'pointer'; // eslint-disable-line no-unused-vars
+// Note: this override is needed to workaround prosthetic-hand fail,
+// see https://github.com/Leaflet/prosthetic-hand/issues/14
-
-function takeScreenshot(path) {
- window.top.callPhantom({'render': path || 'screenshot.png'});
-}
+console.log('L.Browser.pointer', L.Browser.pointer);
+console.log('L.Browser.touchNative', L.Browser.touchNative);
diff --git a/spec/suites/control/Control.AttributionSpec.js b/spec/suites/control/Control.AttributionSpec.js
index c81303a165d..919354f0b16 100644
--- a/spec/suites/control/Control.AttributionSpec.js
+++ b/spec/suites/control/Control.AttributionSpec.js
@@ -1,5 +1,4 @@
describe("Control.Attribution", function () {
-
var map, control, container;
beforeEach(function () {
@@ -122,5 +121,4 @@ describe("Control.Attribution", function () {
expect(container.innerHTML).to.eql('prefix');
});
});
-
});
diff --git a/spec/suites/control/Control.LayersSpec.js b/spec/suites/control/Control.LayersSpec.js
index c1653aacac4..0c737ff33c1 100644
--- a/spec/suites/control/Control.LayersSpec.js
+++ b/spec/suites/control/Control.LayersSpec.js
@@ -1,18 +1,19 @@
describe("Control.Layers", function () {
- var map;
+ var div, map;
beforeEach(function () {
- map = L.map(document.createElement('div'));
+ div = document.createElement('div');
+ document.body.appendChild(div);
+ map = L.map(div);
+ map.setView([0, 0], 14);
});
+
afterEach(function () {
map.remove();
+ document.body.removeChild(div);
});
describe("baselayerchange event", function () {
- beforeEach(function () {
- map.setView([0, 0], 14);
- });
-
it("is fired on input that changes the base layer", function () {
var baseLayers = {"Layer 1": L.tileLayer(''), "Layer 2": L.tileLayer('')},
layers = L.control.layers(baseLayers).addTo(map),
@@ -62,10 +63,6 @@ describe("Control.Layers", function () {
});
describe("updates", function () {
- beforeEach(function () {
- map.setView([0, 0], 14);
- });
-
it("when an included layer is added or removed from the map", function () {
var baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]),
@@ -81,10 +78,9 @@ describe("Control.Layers", function () {
});
it("when an included layer is added or removed from the map, it's (un)checked", function () {
- document.body.appendChild(map._container);
var baseLayer = L.tileLayer(),
- overlay = L.marker([0, 0]),
- layers = L.control.layers({"Baselayer": baseLayer}, {"Overlay": overlay}).addTo(map);
+ overlay = L.marker([0, 0]);
+ L.control.layers({"Baselayer": baseLayer}, {"Overlay": overlay}).addTo(map);
function isChecked() {
return !!(map._container.querySelector('.leaflet-control-layers-overlays input').checked);
@@ -111,7 +107,6 @@ describe("Control.Layers", function () {
});
it("updates when an included layer is removed from the control", function () {
- document.body.appendChild(map._container);
var baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}, {"Overlay": overlay}).addTo(map);
@@ -132,7 +127,6 @@ describe("Control.Layers", function () {
});
it("having repeated layers works as expected", function () {
- document.body.appendChild(map._container);
var layerA = L.tileLayer(''), layerB = L.tileLayer(''),
baseLayers = {"Layer 1": layerA, "Layer 2": layerB, "Layer 3": layerA},
layers = L.control.layers(baseLayers).addTo(map);
@@ -160,10 +154,6 @@ describe("Control.Layers", function () {
});
describe("is removed cleanly", function () {
- beforeEach(function () {
- map.setView([0, 0], 14);
- });
-
it("and layers in the control can still be removed", function () {
var baseLayer = L.tileLayer('').addTo(map);
var layersCtrl = L.control.layers({'Base': baseLayer}).addTo(map);
@@ -188,31 +178,39 @@ describe("Control.Layers", function () {
describe("is created with an expand link", function () {
it("when collapsed", function () {
- var layersCtrl = L.control.layers(null, null, {collapsed: true}).addTo(map);
+ L.control.layers(null, null, {collapsed: true}).addTo(map);
expect(map._container.querySelector('.leaflet-control-layers-toggle')).to.be.ok();
});
it("when not collapsed", function () {
- var layersCtrl = L.control.layers(null, null, {collapsed: false}).addTo(map);
+ L.control.layers(null, null, {collapsed: false}).addTo(map);
expect(map._container.querySelector('.leaflet-control-layers-toggle')).to.be.ok();
});
});
describe("collapse when collapsed: true", function () {
+ it('expands on toggle focus', function () {
+ var layersCtrl = L.control.layers(null, null, {collapsed: true}).addTo(map);
+ var toggle = layersCtrl._container.querySelector('.leaflet-control-layers-toggle');
+ happen.once(toggle, {type:'focus'});
+ expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.be.ok();
+ });
+
it('expands when mouse is over', function () {
var layersCtrl = L.control.layers(null, null, {collapsed: true}).addTo(map);
happen.once(layersCtrl._container, {type:'mouseover'});
expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.be.ok();
});
+
it('collapses when mouse is out', function () {
var layersCtrl = L.control.layers(null, null, {collapsed: true}).addTo(map);
happen.once(layersCtrl._container, {type:'mouseover'});
happen.once(layersCtrl._container, {type:'mouseout'});
expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.not.be.ok();
});
+
it('collapses when map is clicked', function () {
var layersCtrl = L.control.layers(null, null, {collapsed: true}).addTo(map);
- map.setView([0, 0], 0);
happen.once(layersCtrl._container, {type:'mouseover'});
expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.be.ok();
happen.click(map._container);
@@ -229,23 +227,22 @@ describe("Control.Layers", function () {
happen.once(layersCtrl._container, {type:'mouseout'});
expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.be.ok();
});
+
it('does not collapse when map is clicked', function () {
- var layersCtrl = L.control.layers(null, null, {collapsed: false}).addTo(map);
- map.setView([0, 0], 0);
+ L.control.layers(null, null, {collapsed: false}).addTo(map);
expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.be.ok();
happen.click(map._container);
expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.be.ok();
});
+
it('is scrollable if necessary when added on map', function () {
var layersCtrl = L.control.layers(null, null, {collapsed: false}),
- div = document.createElement('div'),
i = 0;
// Need to create a DIV with specified height and insert it into DOM, so that the browser
// gives it an actual size.
map.remove();
div.style.height = div.style.width = '200px';
- document.body.appendChild(div);
map = L.map(div);
for (; i < 20; i += 1) {
@@ -259,16 +256,15 @@ describe("Control.Layers", function () {
expect(div.clientHeight).to.be.greaterThan(layersCtrl._container.clientHeight);
expect(layersCtrl._section.classList.contains('leaflet-control-layers-scrollbar')).to.be(true);
});
+
it('becomes scrollable if necessary when too many layers are added while it is already on map', function () {
var layersCtrl = L.control.layers(null, null, {collapsed: false}),
- div = document.createElement('div'),
i = 0;
// Need to create a DIV with specified height and insert it into DOM, so that the browser
// gives it an actual size.
map.remove();
div.style.height = div.style.width = '200px';
- document.body.appendChild(div);
map = L.map(div);
layersCtrl.addTo(map);
@@ -285,10 +281,6 @@ describe("Control.Layers", function () {
});
describe("sortLayers", function () {
- beforeEach(function () {
- map.setView([0, 0], 14);
- });
-
it("keeps original order by default", function () {
var baseLayerOne = L.tileLayer('').addTo(map);
var baseLayerTwo = L.tileLayer('').addTo(map);
@@ -296,7 +288,7 @@ describe("Control.Layers", function () {
var markerB = L.marker([0, 1]).addTo(map);
var markerA = L.marker([0, 0]).addTo(map);
- var layersCtrl = L.control.layers({
+ L.control.layers({
'Base One': baseLayerOne,
'Base Two': baseLayerTwo
}, {
@@ -320,7 +312,7 @@ describe("Control.Layers", function () {
var markerB = L.marker([0, 1]).addTo(map);
var markerC = L.marker([0, 2]).addTo(map);
- var layersCtrl = L.control.layers({
+ L.control.layers({
'Base Two': baseLayerTwo,
'Base One': baseLayerOne
}, {
@@ -346,7 +338,7 @@ describe("Control.Layers", function () {
var markerB = L.marker([0, 1], {customOption: 100}).addTo(map);
var markerC = L.marker([0, 2], {customOption: 101}).addTo(map);
- var layersCtrl = L.control.layers({
+ L.control.layers({
'Base One': baseLayerOne,
'Base Two': baseLayerTwo
}, {
@@ -366,5 +358,4 @@ describe("Control.Layers", function () {
expect(elems[4].innerHTML.trim()).to.be.equal('Marker A');
});
});
-
});
diff --git a/spec/suites/control/ControlSpec.js b/spec/suites/control/ControlSpec.js
index 6d2770b8046..66deb7e0a42 100644
--- a/spec/suites/control/ControlSpec.js
+++ b/spec/suites/control/ControlSpec.js
@@ -1,26 +1,32 @@
describe("Control", function () {
- var map;
+ function onAdd() {
+ return L.DomUtil.create('div', 'leaflet-test-control');
+ }
+
+ var map,
+ container,
+ control;
beforeEach(function () {
- map = L.map(document.createElement('div'));
+ container = document.createElement('div');
+ document.body.appendChild(container);
+ map = L.map(container).setView([0, 0], 1);
+ control = new L.Control();
+ control.onAdd = onAdd;
+ control.addTo(map);
});
- function onAdd() {
- return L.DomUtil.create('div', 'leaflet-test-control');
- }
+ afterEach(function () {
+ map.remove();
+ document.body.removeChild(container);
+ });
describe("#addTo", function () {
it("adds the container to the map", function () {
- var control = new L.Control();
- control.onAdd = onAdd;
- control.addTo(map);
expect(map.getContainer().querySelector('.leaflet-test-control')).to.equal(control.getContainer());
});
it("removes the control from any existing map", function () {
- var control = new L.Control();
- control.onAdd = onAdd;
- control.addTo(map);
control.addTo(map);
expect(map.getContainer().querySelectorAll('.leaflet-test-control').length).to.equal(1);
expect(map.getContainer().querySelector('.leaflet-test-control')).to.equal(control.getContainer());
@@ -29,17 +35,13 @@ describe("Control", function () {
describe("#remove", function () {
it("removes the container from the map", function () {
- var control = new L.Control();
- control.onAdd = onAdd;
- control.addTo(map).remove();
+ control.remove();
expect(map.getContainer().querySelector('.leaflet-test-control')).to.equal(null);
});
it("calls onRemove if defined", function () {
- var control = new L.Control();
- control.onAdd = onAdd;
control.onRemove = sinon.spy();
- control.addTo(map).remove();
+ control.remove();
expect(control.onRemove.called).to.be(true);
});
diff --git a/spec/suites/core/ClassSpec.js b/spec/suites/core/ClassSpec.js
index e202a6b3764..83b717caa3c 100644
--- a/spec/suites/core/ClassSpec.js
+++ b/spec/suites/core/ClassSpec.js
@@ -1,7 +1,8 @@
+/* eslint no-new: 0 */
describe("Class", function () {
-
describe("#extend", function () {
var Klass,
+ props,
constructor,
method;
@@ -9,14 +10,15 @@ describe("Class", function () {
constructor = sinon.spy();
method = sinon.spy();
- Klass = L.Class.extend({
+ props = {
statics: {bla: 1},
includes: {mixin: true},
initialize: constructor,
foo: 5,
bar: method
- });
+ };
+ Klass = L.Class.extend(props);
});
it("creates a class with the given constructor & properties", function () {
@@ -46,10 +48,25 @@ describe("Class", function () {
expect(method.called).to.be.ok();
});
+ it("does not modify source props object", function () {
+ expect(props).to.eql({
+ statics: {bla: 1},
+ includes: {mixin: true},
+
+ initialize: constructor,
+ foo: 5,
+ bar: method
+ });
+ });
+
it("supports static properties", function () {
expect(Klass.bla).to.eql(1);
});
+ it("does not merge 'statics' property itself", function () {
+ expect('statics' in Klass.prototype).to.not.be.ok();
+ });
+
it("inherits parent static properties", function () {
var Klass2 = Klass.extend({});
@@ -67,6 +84,10 @@ describe("Class", function () {
expect(a.mixin).to.be.ok();
});
+ it("does not merge 'includes' property itself", function () {
+ expect('includes' in Klass.prototype).to.not.be.ok();
+ });
+
it("includes multiple mixins", function () {
var Klass2 = L.Class.extend({
includes: [{mixin: true}, {mixin2: true}]
@@ -117,13 +138,35 @@ describe("Class", function () {
expect(K2.prototype.options.foo).to.eql('bar');
});
+ it("does not reuse original props.options", function () {
+ var props = {options: {}};
+ var K = L.Class.extend(props);
+
+ expect(K.prototype.options).not.to.be(props.options);
+ });
+
+ it("does not replace source props.options object", function () {
+ var K1 = L.Class.extend({options: {}});
+ var opts = {};
+ var props = {options: opts};
+ K1.extend(props);
+
+ expect(props.options).to.be(opts);
+ });
+
+ it("prevents change of prototype options", function () {
+ var Klass = L.Class.extend({options: {}});
+ var instance = new Klass();
+ expect(Klass.prototype.options).to.not.be(instance.options);
+ });
+
it("adds constructor hooks correctly", function () {
var spy1 = sinon.spy();
Klass.addInitHook(spy1);
Klass.addInitHook('bar', 1, 2, 3);
- var a = new Klass();
+ new Klass();
expect(spy1.called).to.be.ok();
expect(method.calledWith(1, 2, 3));
@@ -138,7 +181,7 @@ describe("Class", function () {
Klass.addInitHook(spy1);
Klass2.addInitHook(spy2);
- var a = new Klass2();
+ new Klass2();
expect(spy1.called).to.be.ok();
expect(spy2.called).to.be.ok();
@@ -153,7 +196,7 @@ describe("Class", function () {
Klass.addInitHook(spy1);
Klass2.addInitHook(spy2);
- var a = new Klass();
+ new Klass();
expect(spy1.called).to.be.ok();
expect(spy2.called).to.eql(false);
@@ -165,13 +208,12 @@ describe("Class", function () {
Klass.addInitHook(spy1);
var Klass2 = Klass.extend({});
- var a = new Klass2();
+ new Klass2();
expect(spy1.called).to.be.ok();
});
});
-
describe("#include", function () {
var Klass;
@@ -194,6 +236,37 @@ describe("Class", function () {
b.quux();
expect(q.called).to.be.ok();
});
+
+ it("keeps parent options", function () { // #6070
+
+ var Quux = L.Class.extend({
+ options: {foo: 'Foo!'}
+ });
+
+ Quux.include({
+ options: {bar: 'Bar!'}
+ });
+
+ var q = new Quux();
+ expect(q.options).to.have.property('foo');
+ expect(q.options).to.have.property('bar');
+ });
+
+ it("does not reuse original props.options", function () {
+ var props = {options: {}};
+ var K = Klass.include(props);
+
+ expect(K.prototype.options).not.to.be(props.options);
+ });
+
+ it("does not replace source props.options object", function () {
+ var K1 = Klass.include({options: {}});
+ var opts = {};
+ var props = {options: opts};
+ K1.extend(props);
+
+ expect(props.options).to.be(opts);
+ });
});
// TODO Class.mergeOptions
diff --git a/spec/suites/core/EventsSpec.js b/spec/suites/core/EventsSpec.js
index 5f46fa68c03..722b02495c0 100644
--- a/spec/suites/core/EventsSpec.js
+++ b/spec/suites/core/EventsSpec.js
@@ -1,15 +1,13 @@
describe('Events', function () {
-
describe('#fireEvent', function () {
-
it('fires all listeners added through #addEventListener', function () {
var obj = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy(),
spy4 = sinon.spy(),
- spy5 = sinon.spy(),
- spy6 = sinon.spy();
+ spy5 = sinon.spy();
+ // spy6 = sinon.spy();
obj.addEventListener('test', spy1);
obj.addEventListener('test', spy2);
@@ -41,12 +39,12 @@ describe('Events', function () {
ctx2 = new L.Class(),
count = {one: 0, two: 0, three: 0, four: 0};
- function listener1(e) {
+ function listener1() {
count.one++;
expect(count.two).to.eql(0);
}
- function listener2(e) {
+ function listener2() {
count.two++;
expect(count.one).to.eql(1);
expect(count.three).to.eql(0);
@@ -59,7 +57,7 @@ describe('Events', function () {
}
}
- function listener3(e) {
+ function listener3() {
count.three++;
expect(count.two).to.eql(3);
expect(count.four).to.eql(0);
@@ -70,7 +68,7 @@ describe('Events', function () {
}
}
- function listener4(e) {
+ function listener4() {
count.four++;
expect(count.three).to.eql(2);
}
@@ -287,7 +285,6 @@ describe('Events', function () {
it('correctly removes all listeners if given no fn', function () {
var obj = new L.Evented(),
spy = sinon.spy(),
- foo = {},
foo2 = {},
foo3 = {};
@@ -315,7 +312,6 @@ describe('Events', function () {
var obj = new L.Evented(),
spy = sinon.spy(),
spy2 = sinon.spy(),
- spy3 = sinon.spy(),
foo = {};
/* without context */
@@ -382,6 +378,37 @@ describe('Events', function () {
});
describe('#on, #off & #fire', function () {
+ it('does not remove all listeners when any fn argument specified', function () {
+ var obj = new L.Evented();
+ obj.on('test', L.Util.falseFn);
+ obj.off('test', undefined);
+ obj.off({test: undefined});
+
+ expect(obj.listens('test')).to.be(true);
+ });
+
+ it('ignores non-function listeners passed', function () {
+ var obj = new L.Evented();
+ var off = obj.off.bind(obj);
+ ['string', {}, [], true, false, undefined].forEach(function (fn) {
+ obj.on('test', fn);
+ expect(obj.listens('test')).to.be(false);
+ expect(off).withArgs('test', fn).to.not.throwException();
+ });
+ });
+
+ it('throws with wrong types passed', function () {
+ var obj = new L.Evented();
+ var on = obj.on.bind(obj);
+ var off = obj.off.bind(obj);
+ // todo? make it throw with []
+ [true, false, undefined, 1].forEach(function (type) {
+ expect(on).withArgs(type, L.Util.falseFn).to.throwException();
+ expect(off).withArgs(type, L.Util.falseFn).to.throwException();
+ });
+
+ // todo? make `fire` and `listen` to throw with wrong type
+ });
it('works like #addEventListener && #removeEventListener', function () {
var obj = new L.Evented(),
@@ -600,8 +627,7 @@ describe('Events', function () {
describe('#listens', function () {
it('is false if there is no event handler', function () {
- var obj = new L.Evented(),
- spy = sinon.spy();
+ var obj = new L.Evented();
expect(obj.listens('test')).to.be(false);
});
@@ -650,5 +676,4 @@ describe('Events', function () {
expect(spy.called).to.be(true);
});
});
-
});
diff --git a/spec/suites/core/GeneralSpec.js b/spec/suites/core/GeneralSpec.js
index fce1f215a0e..662cd37b089 100644
--- a/spec/suites/core/GeneralSpec.js
+++ b/spec/suites/core/GeneralSpec.js
@@ -1,15 +1,12 @@
describe('General', function () {
- describe('noConflict', function () {
+ it('noConflict', function () {
var leaflet = L;
-
- after(function () {
- L = leaflet;
- });
-
expect(L.noConflict()).to.eql(leaflet);
+ expect(L).to.eql(undefined);
+ L = leaflet;
});
- describe('namespace extension', function () {
+ it('namespace extension', function () {
L.Util.foo = 'bar';
L.Foo = 'Bar';
diff --git a/spec/suites/core/UtilSpec.js b/spec/suites/core/UtilSpec.js
index 979dcdca605..caac6ad71ae 100644
--- a/spec/suites/core/UtilSpec.js
+++ b/spec/suites/core/UtilSpec.js
@@ -1,5 +1,4 @@
describe('Util', function () {
-
describe('#extend', function () {
var a;
@@ -86,6 +85,8 @@ describe('Util', function () {
expect(L.Util.formatNum(13.12325555, 3)).to.eql(13.123);
expect(L.Util.formatNum(13.12325555)).to.eql(13.123256);
expect(L.Util.formatNum(13.12325555, 0)).to.eql(13);
+ expect(L.Util.formatNum(13.12325555, false)).to.eql(13.12325555);
+ expect(isNaN(L.Util.formatNum(-7.993322e-10))).to.eql(false);
});
});
@@ -229,9 +230,10 @@ describe('Util', function () {
}).to.throwError();
});
- it('allows underscores and dashes in placeholders', function () {
+ it('allows underscores, dashes and spaces in placeholders', function () {
expect(L.Util.template('{nice_stuff}', {'nice_stuff': 'foo'})).to.eql('foo');
expect(L.Util.template('{-y}', {'-y': 1})).to.eql('1');
+ expect(L.Util.template('{Day Of Month}', {'Day Of Month': 30})).to.eql('30');
});
});
diff --git a/spec/suites/dom/DomEvent.DoubleTapSpec.js b/spec/suites/dom/DomEvent.DoubleTapSpec.js
new file mode 100644
index 00000000000..005fa57ad25
--- /dev/null
+++ b/spec/suites/dom/DomEvent.DoubleTapSpec.js
@@ -0,0 +1,116 @@
+describe('DomEvent.DoubleTapSpec.js', function () {
+ var el, clock, spy;
+
+ beforeEach(function () {
+ el = document.createElement('div');
+ document.body.appendChild(el);
+
+ clock = sinon.useFakeTimers();
+ clock.tick(1000);
+ spy = sinon.spy();
+ L.DomEvent.on(el, 'dblclick', spy);
+ });
+
+ afterEach(function () {
+ clock.restore();
+ document.body.removeChild(el);
+ });
+
+ it('fires synthetic dblclick after two clicks with delay<200', function () {
+ happen.click(el, {detail: 1});
+ clock.tick(100);
+ happen.click(el, {detail: 1});
+
+ expect(spy.called).to.be.ok();
+ expect(spy.calledOnce).to.be.ok();
+ expect(spy.lastCall.args[0]._simulated).to.be.ok();
+ });
+
+ it('does not fire dblclick when delay>200', function () {
+ happen.click(el, {detail: 1});
+ clock.tick(300);
+ happen.click(el, {detail: 1});
+
+ expect(spy.notCalled).to.be.ok();
+ });
+
+ it('does not fire dblclick when detail !== 1', function () {
+ happen.click(el, {detail: 0}); // like in IE
+ clock.tick(100);
+ happen.click(el, {detail: 0});
+ clock.tick(100);
+
+ expect(spy.notCalled).to.be.ok();
+ });
+
+ it('does not fire dblclick after removeListener', function () {
+ L.DomEvent.off(el, 'dblclick', spy);
+
+ happen.click(el, {detail: 1});
+ clock.tick(100);
+ happen.click(el, {detail: 1});
+ clock.tick(100);
+
+ expect(spy.notCalled).to.be.ok();
+ });
+
+ it('does not conflict with native dblclick', function () {
+ happen.click(el, {detail: 1});
+ clock.tick(100);
+ happen.click(el, {detail: 2}); // native dblclick expected
+ happen.dblclick(el);
+ expect(spy.called).to.be.ok();
+ expect(spy.calledOnce).to.be.ok();
+ expect(spy.lastCall.args[0]._simulated).not.to.be.ok();
+ });
+
+ it('synthetic dblclick event has expected properties', function () {
+ var click = {
+ detail: 1,
+ clientX: 2,
+ clientY: 3,
+ screenX: 4,
+ screenY: 5
+ };
+ happen.click(el, click);
+ clock.tick(100);
+ happen.click(el, click);
+
+ var event = spy.lastCall.args[0];
+ var expectedProps = L.extend(click, {
+ type: 'dblclick',
+ // bubbles: true, // not important, as we do not actually dispatch the event
+ // cancelable: true, //
+ detail: 2,
+ target: el
+ });
+ for (var prop in expectedProps) {
+ expect(event[prop]).to.be(expectedProps[prop]);
+ }
+ expect(event.isTrusted).not.to.be.ok();
+ });
+
+ it('respects disableClickPropagation', function () {
+ var spyMap = sinon.spy();
+ var map = L.map(el).setView([51.505, -0.09], 13);
+ map.on('dblclick', spyMap);
+
+ var spyCtrl = sinon.spy();
+ var ctrl = L.DomUtil.create('div');
+ L.DomEvent.disableClickPropagation(ctrl);
+ var MyControl = L.Control.extend({
+ onAdd: function () {
+ return ctrl;
+ }
+ });
+ map.addControl(new MyControl());
+ L.DomEvent.on(ctrl, 'dblclick', spyCtrl);
+
+ happen.click(ctrl, {detail: 1});
+ clock.tick(100);
+ happen.click(ctrl, {detail: 1});
+
+ expect(spyCtrl.called).to.be.ok();
+ expect(spyMap.notCalled).to.be.ok();
+ });
+});
diff --git a/spec/suites/dom/DomEvent.PointerSpec.js b/spec/suites/dom/DomEvent.PointerSpec.js
new file mode 100644
index 00000000000..a190cb46d83
--- /dev/null
+++ b/spec/suites/dom/DomEvent.PointerSpec.js
@@ -0,0 +1,180 @@
+describe('DomEvent.Pointer', function () {
+ var el,
+ listeners = {};
+
+ var pointerEvents = ['pointerdown', 'pointermove', 'pointerup', 'pointercancel'];
+ var touchEvents = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
+
+ beforeEach(function () {
+ el = document.createElement('div');
+ document.body.appendChild(el);
+ touchEvents.forEach(function (type) {
+ listeners[type] = sinon.spy();
+ L.DomEvent.on(el, type, listeners[type]);
+ });
+ });
+
+ afterEach(function () {
+ happen.once(el, {type: 'pointercancel'}); // to reset prosphetic-hand
+ happen.once(el, {type: 'touchcancel'}); //
+ document.body.removeChild(el);
+ });
+
+ var skip = describe.skip;
+
+ var pointerToTouch = L.Browser.pointer && !L.Browser.touchNative;
+ (pointerToTouch ? describe : skip)('#Simulates touch based on pointer events', function () {
+ it('adds a listener and calls it on pointer event', function () {
+ pointerEvents.forEach(function (type) {
+ happen.once(el, {type: type});
+ });
+ touchEvents.forEach(function (type) {
+ expect(listeners[type].called).to.be.ok();
+ expect(listeners[type].calledOnce).to.be.ok();
+ });
+ });
+
+ it('does not call removed listener', function () {
+ touchEvents.forEach(function (type) {
+ L.DomEvent.off(el, type, listeners[type]);
+ });
+ pointerEvents.forEach(function (type) {
+ happen.once(el, {type: type});
+ });
+ touchEvents.forEach(function (type) {
+ expect(listeners[type].notCalled).to.be.ok();
+ });
+ });
+
+ it('ignores events from mouse', function () {
+ pointerEvents.forEach(function (type) {
+ happen.once(el, {type: type, pointerType: 'mouse'});
+ });
+ touchEvents.forEach(function (type) {
+ expect(listeners[type].notCalled).to.be.ok();
+ });
+ });
+
+ it('ignores native touch events', function () {
+ touchEvents.forEach(function (type) {
+ happen.once(el, {type: type});
+ });
+ touchEvents.forEach(function (type) {
+ expect(listeners[type].notCalled).to.be.ok();
+ });
+ });
+
+ it('does not throw on invalid event names', function () {
+ L.DomEvent.on(el, 'touchleave', L.Util.falseFn);
+ L.DomEvent.off(el, 'touchleave', L.Util.falseFn);
+ });
+
+ it('simulates touch events with correct properties', function () {
+ function containIn(props, evt) {
+ if (Array.isArray(props)) {
+ return props.every(function (props0) {
+ return containIn(props0, evt);
+ });
+ }
+ if ('length' in evt) {
+ return Array.prototype.some.call(evt, containIn.bind(this, props));
+ }
+ for (var prop in props) {
+ var res = true;
+ if (props[prop] !== evt[prop]) {
+ return false;
+ }
+ }
+ return res;
+ }
+ // test helper function
+ expect(containIn(undefined, {a:1})).not.to.be.ok();
+ expect(containIn({}, {a:1})).not.to.be.ok();
+ expect(containIn({a:1}, {a:2})).not.to.be.ok();
+ expect(containIn({a:1}, {a:1, b:2})).to.be.ok();
+ expect(containIn({a:1, b:2}, {a:1})).not.to.be.ok();
+ expect(containIn({a:1}, [{a:1}, {b:2}])).to.be.ok();
+ expect(containIn({a:1}, [{a:0}, {b:2}])).not.to.be.ok();
+ expect(containIn([{a:1}, {b:2}], [{a:1}, {b:2}, {c:3}])).to.be.ok();
+ expect(containIn([{a:1}, {b:2}], [{a:0}, {b:2}])).not.to.be.ok();
+
+ // pointerdown/touchstart
+ var pointer1 = {clientX:1, clientY:1, pointerId: 1};
+ happen.once(el, L.extend({type: 'pointerdown'}, pointer1));
+ var evt = listeners.touchstart.lastCall.args[0];
+ expect(evt.type).to.be('pointerdown');
+ expect(evt).to.have.keys('touches', 'changedTouches');
+ expect(evt.changedTouches).to.have.length(1);
+ expect(containIn(pointer1, evt.changedTouches[0])).to.be.ok();
+ expect(evt.touches).to.have.length(1);
+ expect(containIn(pointer1, evt.touches[0])).to.be.ok();
+
+ // another pointerdown/touchstart (multitouch)
+ var pointer2 = {clientX:2, clientY:2, pointerId: 2};
+ happen.once(el, L.extend({type: 'pointerdown'}, pointer2));
+ evt = listeners.touchstart.lastCall.args[0];
+ expect(evt.type).to.be('pointerdown');
+ expect(evt).to.have.keys('touches', 'changedTouches');
+ expect(evt.changedTouches).to.have.length(1);
+ expect(containIn(pointer2, evt.changedTouches[0])).to.be.ok();
+ expect(evt.touches).to.have.length(2);
+ expect(containIn([pointer1, pointer2], evt.touches)).to.be.ok();
+
+ // pointermove/touchmove (multitouch)
+ L.extend(pointer1, {clientX:11, clientY:11});
+ happen.once(el, L.extend({type: 'pointermove'}, pointer1));
+ evt = listeners.touchmove.lastCall.args[0];
+ expect(evt.type).to.be('pointermove');
+ expect(evt).to.have.keys('touches', 'changedTouches');
+ expect(evt.changedTouches).to.have.length(1);
+ expect(containIn(pointer1, evt.changedTouches[0])).to.be.ok();
+ expect(evt.touches).to.have.length(2);
+ expect(containIn([pointer1, pointer2], evt.touches)).to.be.ok();
+
+ // pointerup/touchend (multitouch)
+ happen.once(el, L.extend({type: 'pointerup'}, pointer2));
+ evt = listeners.touchend.lastCall.args[0];
+ expect(evt.type).to.be('pointerup');
+ expect(evt).to.have.keys('touches', 'changedTouches');
+ expect(evt.changedTouches).to.have.length(1);
+ expect(containIn(pointer2, evt.changedTouches[0])).to.be.ok();
+ expect(evt.touches).to.have.length(1);
+ expect(containIn(pointer1, evt.touches[0])).to.be.ok();
+
+ // pointercancel/touchcancel
+ happen.once(el, L.extend({type: 'pointercancel'}, pointer1));
+ evt = listeners.touchcancel.lastCall.args[0];
+ expect(evt.type).to.be('pointercancel');
+ expect(evt).to.have.keys('touches', 'changedTouches');
+ expect(evt.changedTouches).to.have.length(1);
+ expect(containIn(pointer1, evt.changedTouches[0])).to.be.ok();
+ expect(evt.touches).to.be.empty();
+
+ expect(listeners.touchstart.calledTwice).to.be.ok();
+ expect(listeners.touchmove.calledOnce).to.be.ok();
+ expect(listeners.touchend.calledOnce).to.be.ok();
+ expect(listeners.touchcancel.calledOnce).to.be.ok();
+ });
+ });
+
+ (L.Browser.pointer ? skip : describe)('#Does not intrude if pointer events are not available', function () {
+ it('adds a listener and calls it on touch event', function () {
+ touchEvents.forEach(function (type) {
+ happen.once(el, {type: type});
+ });
+ touchEvents.forEach(function (type) {
+ expect(listeners[type].calledOnce).to.be.ok();
+ });
+ });
+
+ it('ignores pointer events', function () {
+ pointerEvents.forEach(function (type) {
+ happen.once(el, {type: type});
+ });
+ touchEvents.forEach(function (type) {
+ expect(listeners[type].notCalled).to.be.ok();
+ });
+ });
+ });
+
+});
diff --git a/spec/suites/dom/DomEventSpec.js b/spec/suites/dom/DomEventSpec.js
index 7d784e553a7..48a459af2f3 100644
--- a/spec/suites/dom/DomEventSpec.js
+++ b/spec/suites/dom/DomEventSpec.js
@@ -1,112 +1,371 @@
describe('DomEvent', function () {
- var el;
-
- function simulateClick(el) {
- if (document.createEvent) {
- var e = document.createEvent('MouseEvents');
- e.initMouseEvent('click', true, true, window,
- 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- return el.dispatchEvent(e);
- } else if (el.fireEvent) {
- return el.fireEvent('onclick');
- }
- }
+ var el, listener;
beforeEach(function () {
el = document.createElement('div');
- el.style.position = 'absolute';
- el.style.top = el.style.left = '-10000px';
document.body.appendChild(el);
+ listener = sinon.spy();
});
afterEach(function () {
document.body.removeChild(el);
});
- describe('#addListener', function () {
- it('adds a listener and calls it on event', function () {
- var listener1 = sinon.spy(),
- listener2 = sinon.spy();
+ describe('#arguments check', function () {
+ it('throws when el is not HTMLElement', function () {
+ expect(L.DomEvent.on).withArgs({}, 'click', L.Util.falseFn)
+ .to.throwException();
+ expect(L.DomEvent.disableScrollPropagation).withArgs({})
+ .to.throwException();
+ expect(L.DomEvent.disableClickPropagation).withArgs({})
+ .to.throwException();
+ expect(L.DomEvent.getMousePosition).withArgs({clientX: 0, clientY: 0}, {})
+ .to.throwException();
+ // .off and .isExternalTarget do not throw atm
+ });
+ });
- L.DomEvent.addListener(el, 'click', listener1);
- L.DomEvent.addListener(el, 'click', listener2);
+ describe('#on (addListener)', function () {
+ it('throws when types/fn are undefined/null/false', function () {
+ expect(L.DomEvent.on).withArgs(el, undefined, L.Util.falseFn)
+ .to.throwException();
+ expect(L.DomEvent.on).withArgs(el, null, L.Util.falseFn)
+ .to.throwException();
+ expect(L.DomEvent.on).withArgs(el, false, L.Util.falseFn)
+ .to.throwException();
+ expect(L.DomEvent.on).withArgs(el, 'click', undefined)
+ .to.throwException();
+ expect(L.DomEvent.on).withArgs(el, 'click', null)
+ .to.throwException();
+ expect(L.DomEvent.on).withArgs(el, 'click', false)
+ .to.throwException();
+ });
+
+ it('adds a listener and calls it on event', function () {
+ var listener2 = sinon.spy();
+ L.DomEvent.on(el, 'click', listener);
+ L.DomEvent.on(el, 'click', listener2);
- simulateClick(el);
+ happen.click(el);
- expect(listener1.called).to.be.ok();
+ expect(listener.called).to.be.ok();
expect(listener2.called).to.be.ok();
});
+ it('adds a listener when passed an event map', function () {
+ var listener = sinon.spy();
+
+ L.DomEvent.on(el, {click: listener});
+
+ happen.click(el);
+
+ sinon.assert.called(listener);
+ });
+
it('binds "this" to the given context', function () {
- var obj = {foo: 'bar'},
- result;
+ var obj = {foo: 'bar'};
+ L.DomEvent.on(el, 'click', listener, obj);
- L.DomEvent.addListener(el, 'click', function () {
- result = this;
- }, obj);
+ happen.click(el);
- simulateClick(el);
+ expect(listener.calledOn(obj)).to.be.ok();
+ });
+
+ it('binds "this" to the given context when passed an event map', function () {
+ var listener = sinon.spy(),
+ ctx = {foo: 'bar'};
+
+ L.DomEvent.on(el, {click: listener}, ctx);
+
+ happen.click(el);
- expect(result).to.eql(obj);
+ sinon.assert.calledOn(listener, ctx);
});
it('passes an event object to the listener', function () {
- var type;
+ L.DomEvent.on(el, 'click', listener);
- L.DomEvent.addListener(el, 'click', function (e) {
- type = e && e.type;
- });
- simulateClick(el);
+ happen.click(el);
- expect(type).to.eql('click');
+ expect(listener.lastCall.args[0].type).to.eql('click');
});
it('is chainable', function () {
- var res = L.DomEvent.addListener(el, 'click', function () {});
- expect(res.addListener).to.be.a('function');
+ var res = L.DomEvent.on(el, 'click', function () {});
+
+ expect(res).to.be(L.DomEvent);
+ });
+
+ it('is aliased to addListener ', function () {
+ expect(L.DomEvent.on).to.be(L.DomEvent.addListener);
});
});
- describe('#removeListener', function () {
+ describe('#off (removeListener)', function () {
it('removes a previously added listener', function () {
+ L.DomEvent.on(el, 'click', listener);
+ L.DomEvent.off(el, 'click', listener);
+
+ happen.click(el);
+
+ expect(listener.notCalled).to.be.ok();
+ });
+
+ it('only removes the specified listener', function () {
+ var listenerA = sinon.spy(),
+ listenerB = sinon.spy();
+
+ L.DomEvent.on(el, 'click', listenerA);
+ L.DomEvent.on(el, 'click', listenerB);
+ L.DomEvent.off(el, 'click', listenerA);
+
+ happen.click(el);
+
+ expect(listenerA.called).to.not.be.ok();
+ expect(listenerB.called).to.be.ok();
+ });
+
+ it('removes a previously added listener when passed an event map', function () {
+ var listener = sinon.spy(),
+ events = {click: listener};
+
+ L.DomEvent.on(el, events);
+ L.DomEvent.off(el, events);
+
+ happen.click(el);
+
+ sinon.assert.notCalled(listener);
+ });
+
+ it('removes listener added with context', function () {
+ var listener = sinon.spy(),
+ ctx = {foo: 'bar'};
+
+ L.DomEvent.on(el, 'click', listener, ctx);
+ L.DomEvent.off(el, 'click', listener, ctx);
+
+ happen.click(el);
+
+ sinon.assert.notCalled(listener);
+ });
+
+ it('removes listener added with context when passed an event map', function () {
+ var listener = sinon.spy(),
+ events = {click: listener},
+ ctx = {foo: 'bar'};
+
+ L.DomEvent.on(el, events, ctx);
+ L.DomEvent.off(el, events, ctx);
+
+ happen.click(el);
+
+ sinon.assert.notCalled(listener);
+ });
+
+ it('only removes listener when proper context specified', function () {
+ var listener = sinon.spy(),
+ ctx = {foo: 'bar'};
+
+ L.DomEvent.on(el, 'click', listener);
+ L.DomEvent.off(el, 'click', listener, ctx);
+
+ happen.click(el);
+
+ sinon.assert.called(listener);
+
+ listener = sinon.spy();
+ L.DomEvent.on(el, 'click', listener, ctx);
+ L.DomEvent.off(el, 'click', listener, {}); // wrong context
+ L.DomEvent.off(el, 'click', listener);
+
+ happen.click(el);
+
+ sinon.assert.called(listener);
+ });
+
+ it('only removes listener when proper context specified when passed an event map', function () {
+ var listener = sinon.spy(),
+ events = {click: listener},
+ ctx = {foo: 'bar'};
+
+ L.DomEvent.on(el, events);
+ L.DomEvent.off(el, events, ctx);
+
+ happen.click(el);
+
+ sinon.assert.called(listener);
+
+ listener = sinon.spy();
+ events = {click: listener};
+
+ L.DomEvent.on(el, events, ctx);
+ L.DomEvent.off(el, events);
+ L.DomEvent.off(el, events, {}); // wrong context
+
+ happen.click(el);
+
+ sinon.assert.called(listener);
+ });
+
+ it('removes all listeners when only passed the HTMLElement', function () {
+ var listenerA = sinon.spy(),
+ listenerB = sinon.spy();
+
+ L.DomEvent.on(el, 'click', listenerA);
+ L.DomEvent.on(el, 'click', listenerB, {});
+ L.DomEvent.off(el);
+
+ happen.click(el);
+
+ expect(listenerA.called).to.not.be.ok();
+ expect(listenerB.called).to.not.be.ok();
+ });
+
+ it('only removes specified listeners type', function () {
+ var listenerClick = sinon.spy(),
+ listenerDblClick = sinon.spy();
+
+ L.DomEvent.on(el, 'click', listenerClick);
+ L.DomEvent.on(el, 'dblclick', listenerDblClick);
+ L.DomEvent.off(el, 'click');
+ happen.click(el);
+ happen.dblclick(el);
+
+ sinon.assert.notCalled(listenerClick);
+ sinon.assert.called(listenerDblClick);
+ });
+
+ it('throws when types/fn are undefined/null/false', function () {
+ expect(L.DomEvent.off).withArgs(el, undefined)
+ .to.throwException();
+ expect(L.DomEvent.off).withArgs(el, null)
+ .to.throwException();
+ expect(L.DomEvent.off).withArgs(el, false)
+ .to.throwException();
+
+ expect(L.DomEvent.off).withArgs(el, 'click', undefined)
+ .to.throwException();
+ expect(L.DomEvent.off).withArgs(el, 'click', null)
+ .to.throwException();
+ expect(L.DomEvent.off).withArgs(el, 'click', false)
+ .to.throwException();
+ });
+
+ it('removes listener when passed an event map', function () {
var listener = sinon.spy();
- L.DomEvent.addListener(el, 'click', listener);
- L.DomEvent.removeListener(el, 'click', listener);
+ L.DomEvent.on(el, 'click', listener);
+ L.DomEvent.off(el, {'click': listener});
- simulateClick(el);
+ happen.click(el);
expect(listener.called).to.not.be.ok();
});
it('is chainable', function () {
- var res = L.DomEvent.removeListener(el, 'click', function () {});
- expect(res.removeListener).to.be.a('function');
+ var res = L.DomEvent.off(el, 'click', function () {});
+
+ expect(res).to.be(L.DomEvent);
+ });
+
+ it('is aliased to removeListener ', function () {
+ expect(L.DomEvent.off).to.be(L.DomEvent.removeListener);
});
});
describe('#stopPropagation', function () {
it('stops propagation of the given event', function () {
- var child = document.createElement('div'),
- listener = sinon.spy();
+ var child = document.createElement('div');
+ el.appendChild(child);
+ L.DomEvent.on(child, 'click', L.DomEvent.stopPropagation);
+ L.DomEvent.on(el, 'click', listener);
+
+ happen.click(child);
+ expect(listener.notCalled).to.be.ok();
+ });
+ });
+
+ describe('#disableScrollPropagation', function () {
+ it('stops wheel events from propagation to parent elements', function () {
+ var child = document.createElement('div');
el.appendChild(child);
+ var wheel = 'onwheel' in window ? 'wheel' : 'mousewheel';
+ L.DomEvent.on(el, wheel, listener);
- L.DomEvent.addListener(child, 'click', L.DomEvent.stopPropagation);
- L.DomEvent.addListener(el, 'click', listener);
+ L.DomEvent.disableScrollPropagation(child);
+ happen.once(child, {type: wheel});
- simulateClick(child);
+ expect(listener.notCalled).to.be.ok();
+ });
+ });
- expect(listener.called).to.not.be.ok();
+ describe('#disableClickPropagation', function () {
+ it('stops click events from propagation to parent elements', function () { // except 'click'
+ var child = document.createElement('div');
+ el.appendChild(child);
+ L.DomEvent.disableClickPropagation(child);
+ L.DomEvent.on(el, 'dblclick contextmenu mousedown touchstart', listener);
+
+ happen.once(child, {type: 'dblclick'});
+ happen.once(child, {type: 'contextmenu'});
+ happen.once(child, {type: 'mousedown'});
+ happen.once(child, {type: 'touchstart', touches: []});
- el.removeChild(child);
+ expect(listener.notCalled).to.be.ok();
+ });
+
+ it('prevents click event on map object, but propagates to DOM elements', function () { // to solve #301
+ var child = document.createElement('div');
+ el.appendChild(child);
+ L.DomEvent.disableClickPropagation(child);
+ L.DomEvent.on(el, 'click', listener);
+ var grandChild = document.createElement('div');
+ child.appendChild(grandChild);
+
+ var map = L.map(el).setView([0, 0], 0);
+ var mapClickListener = sinon.spy();
+ var mapOtherListener = sinon.spy();
+ map.on('click', mapClickListener); // control case
+ map.on('keypress', mapOtherListener); // control case
+
+ happen.once(grandChild, {type: 'click'});
+ happen.once(grandChild, {type: 'keypress'});
+
+ expect(mapOtherListener.called).to.be.ok(); // control case
+ expect(listener.called).to.be.ok();
+ expect(mapClickListener.notCalled).to.be.ok();
+
+ happen.once(child, {type: 'click'});
+ happen.once(child, {type: 'keypress'});
+
+ expect(listener.calledTwice).to.be.ok();
+ expect(mapClickListener.notCalled).to.be.ok();
+
+ map.remove();
});
});
+
describe('#preventDefault', function () {
- it('prevents the default action of event', function () {
- L.DomEvent.addListener(el, 'click', L.DomEvent.preventDefault);
+ function isPrevented(e) {
+ if ('defaultPrevented' in e) {
+ return e.defaultPrevented;
+ } else { // IE<11
+ return !e.returnValue;
+ }
+ }
+
+ it('prevents the default action of event', function (done) {
+ L.DomEvent.on(el, 'click', function (e) {
+ expect(isPrevented(e)).not.to.be.ok(); // control case
+
+ L.DomEvent.preventDefault(e);
+
+ expect(isPrevented(e)).to.be.ok();
+ done();
+ });
- expect(simulateClick(el)).to.be(false);
+ happen.click(el);
});
});
});
diff --git a/spec/suites/geo/LatLngBoundsSpec.js b/spec/suites/geo/LatLngBoundsSpec.js
index c4d9686f6ad..6a24899e267 100644
--- a/spec/suites/geo/LatLngBoundsSpec.js
+++ b/spec/suites/geo/LatLngBoundsSpec.js
@@ -89,9 +89,11 @@ describe('LatLngBounds', function () {
it('returns true if properly set up', function () {
expect(a.isValid()).to.be.ok();
});
+
it('returns false if is invalid', function () {
expect(c.isValid()).to.not.be.ok();
});
+
it('returns true if extended', function () {
c.extend([0, 0]);
expect(c.isValid()).to.be.ok();
@@ -108,35 +110,30 @@ describe('LatLngBounds', function () {
it('returns a proper bbox south value', function () {
expect(a.getSouth()).to.eql(14);
});
-
});
describe('#getEast', function () {
it('returns a proper bbox east value', function () {
expect(a.getEast()).to.eql(40);
});
-
});
describe('#getNorth', function () {
it('returns a proper bbox north value', function () {
expect(a.getNorth()).to.eql(30);
});
-
});
describe('#toBBoxString', function () {
it('returns a proper left,bottom,right,top bbox', function () {
expect(a.toBBoxString()).to.eql("12,14,40,30");
});
-
});
describe('#getNorthWest', function () {
it('returns a proper north-west LatLng', function () {
expect(a.getNorthWest()).to.eql(new L.LatLng(a.getNorth(), a.getWest()));
});
-
});
describe('#getSouthEast', function () {
@@ -182,9 +179,9 @@ describe('LatLngBounds', function () {
it('returns true if overlaps the given bounds', function () {
expect(a.overlaps([[16, 20], [50, 60]])).to.eql(true);
});
+
it('returns false if just touches the boundary of the given bounds', function () {
expect(a.overlaps([[25, 40], [55, 50]])).to.eql(false);
});
});
-
});
diff --git a/spec/suites/geo/LatLngSpec.js b/spec/suites/geo/LatLngSpec.js
index c0d125935b9..f3eec74963e 100644
--- a/spec/suites/geo/LatLngSpec.js
+++ b/spec/suites/geo/LatLngSpec.js
@@ -12,7 +12,7 @@ describe('LatLng', function () {
it('throws an error if invalid lat or lng', function () {
expect(function () {
- var a = new L.LatLng(NaN, NaN);
+ L.latLng(NaN, NaN);
}).to.throwError();
});
@@ -28,7 +28,6 @@ describe('LatLng', function () {
var b = new L.LatLng(-25, -74, -50);
expect(b.alt).to.eql(-50);
});
-
});
describe('#equals', function () {
@@ -119,7 +118,6 @@ describe('LatLng', function () {
});
describe('#clone', function () {
-
it('should clone attributes', function () {
var a = new L.LatLng(50.5, 30.5, 100);
var b = a.clone();
@@ -135,7 +133,5 @@ describe('LatLng', function () {
expect(a === b).to.be(false);
});
-
});
-
});
diff --git a/spec/suites/geo/CRSSpec.js b/spec/suites/geo/crs/CRSSpec.js
similarity index 85%
rename from spec/suites/geo/CRSSpec.js
rename to spec/suites/geo/crs/CRSSpec.js
index aa5cdc05b8f..28986519f48 100644
--- a/spec/suites/geo/CRSSpec.js
+++ b/spec/suites/geo/crs/CRSSpec.js
@@ -3,37 +3,37 @@ describe("CRS.EPSG3857", function () {
describe("#latLngToPoint", function () {
it("projects a center point", function () {
- expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near(new L.Point(128, 128), 0.01);
+ expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near([128, 128], 0.01);
});
it("projects the northeast corner of the world", function () {
- expect(crs.latLngToPoint(L.latLng(85.0511287798, 180), 0)).near(new L.Point(256, 0));
+ expect(crs.latLngToPoint(L.latLng(85.0511287798, 180), 0)).near([256, 0]);
});
});
describe("#pointToLatLng", function () {
it("reprojects a center point", function () {
- expect(crs.pointToLatLng(new L.Point(128, 128), 0)).nearLatLng(L.latLng(0, 0), 0.01);
+ expect(crs.pointToLatLng(new L.Point(128, 128), 0)).nearLatLng([0, 0], 0.01);
});
it("reprojects the northeast corner of the world", function () {
- expect(crs.pointToLatLng(new L.Point(256, 0), 0)).nearLatLng(L.latLng(85.0511287798, 180));
+ expect(crs.pointToLatLng(new L.Point(256, 0), 0)).nearLatLng([85.0511287798, 180]);
});
});
describe("project", function () {
it('projects geo coords into meter coords correctly', function () {
- expect(crs.project(new L.LatLng(50, 30))).near(new L.Point(3339584.7238, 6446275.84102));
- expect(crs.project(new L.LatLng(85.0511287798, 180))).near(new L.Point(20037508.34279, 20037508.34278));
- expect(crs.project(new L.LatLng(-85.0511287798, -180))).near(new L.Point(-20037508.34279, -20037508.34278));
+ expect(crs.project(new L.LatLng(50, 30))).near([3339584.7238, 6446275.84102]);
+ expect(crs.project(new L.LatLng(85.0511287798, 180))).near([20037508.34279, 20037508.34278]);
+ expect(crs.project(new L.LatLng(-85.0511287798, -180))).near([-20037508.34279, -20037508.34278]);
});
});
describe("unproject", function () {
it('unprojects meter coords into geo coords correctly', function () {
- expect(crs.unproject(new L.Point(3339584.7238, 6446275.84102))).nearLatLng(new L.LatLng(50, 30));
- expect(crs.unproject(new L.Point(20037508.34279, 20037508.34278))).nearLatLng(new L.LatLng(85.051129, 180));
- expect(crs.unproject(new L.Point(-20037508.34279, -20037508.34278))).nearLatLng(new L.LatLng(-85.051129, -180));
+ expect(crs.unproject(new L.Point(3339584.7238, 6446275.84102))).nearLatLng([50, 30]);
+ expect(crs.unproject(new L.Point(20037508.34279, 20037508.34278))).nearLatLng([85.051129, 180]);
+ expect(crs.unproject(new L.Point(-20037508.34279, -20037508.34278))).nearLatLng([-85.051129, -180]);
});
});
@@ -164,21 +164,21 @@ describe("CRS.EPSG3395", function () {
describe("#latLngToPoint", function () {
it("projects a center point", function () {
- expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near(new L.Point(128, 128), 0.01);
+ expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near([128, 128], 0.01);
});
it("projects the northeast corner of the world", function () {
- expect(crs.latLngToPoint(L.latLng(85.0840591556, 180), 0)).near(new L.Point(256, 0));
+ expect(crs.latLngToPoint(L.latLng(85.0840591556, 180), 0)).near([256, 0]);
});
});
describe("#pointToLatLng", function () {
it("reprojects a center point", function () {
- expect(crs.pointToLatLng(new L.Point(128, 128), 0)).nearLatLng(L.latLng(0, 0), 0.01);
+ expect(crs.pointToLatLng(new L.Point(128, 128), 0)).nearLatLng([0, 0], 0.01);
});
it("reprojects the northeast corner of the world", function () {
- expect(crs.pointToLatLng(new L.Point(256, 0), 0)).nearLatLng(L.latLng(85.0840591556, 180));
+ expect(crs.pointToLatLng(new L.Point(256, 0), 0)).nearLatLng([85.0840591556, 180]);
});
});
});
@@ -188,17 +188,17 @@ describe("CRS.Simple", function () {
describe("#latLngToPoint", function () {
it("converts LatLng coords to pixels", function () {
- expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near(new L.Point(0, 0));
- expect(crs.latLngToPoint(L.latLng(700, 300), 0)).near(new L.Point(300, -700));
- expect(crs.latLngToPoint(L.latLng(-200, 1000), 1)).near(new L.Point(2000, 400));
+ expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near([0, 0]);
+ expect(crs.latLngToPoint(L.latLng(700, 300), 0)).near([300, -700]);
+ expect(crs.latLngToPoint(L.latLng(-200, 1000), 1)).near([2000, 400]);
});
});
describe("#pointToLatLng", function () {
it("converts pixels to LatLng coords", function () {
- expect(crs.pointToLatLng(L.point(0, 0), 0)).nearLatLng(new L.LatLng(0, 0));
- expect(crs.pointToLatLng(L.point(300, -700), 0)).nearLatLng(new L.LatLng(700, 300));
- expect(crs.pointToLatLng(L.point(2000, 400), 1)).nearLatLng(new L.LatLng(-200, 1000));
+ expect(crs.pointToLatLng(L.point(0, 0), 0)).nearLatLng([0, 0]);
+ expect(crs.pointToLatLng(L.point(300, -700), 0)).nearLatLng([700, 300]);
+ expect(crs.pointToLatLng(L.point(2000, 400), 1)).nearLatLng([-200, 1000]);
});
});
@@ -212,13 +212,14 @@ describe("CRS.Simple", function () {
it("returns coords as is", function () {
expect(crs.wrapLatLng(new L.LatLng(270, 400)).equals(new L.LatLng(270, 400))).to.be(true);
});
+
it("wraps coords if configured", function () {
var crs = L.extend({}, L.CRS.Simple, {
wrapLng: [-200, 200],
wrapLat: [-200, 200]
});
- expect(crs.wrapLatLng(new L.LatLng(300, -250))).nearLatLng(new L.LatLng(-100, 150));
+ expect(crs.wrapLatLng(new L.LatLng(300, -250))).nearLatLng([-100, 150]);
});
});
});
@@ -230,7 +231,8 @@ describe("CRS", function () {
it("convert zoom to scale and viceversa and return the same values", function () {
var zoom = 2.5;
var scale = crs.scale(zoom);
- expect(crs.zoom(scale)).to.eql(zoom);
+ var zoom2 = crs.zoom(scale);
+ expect(L.Util.formatNum(zoom2)).to.eql(zoom);
});
});
});
diff --git a/spec/suites/geo/ProjectionSpec.js b/spec/suites/geo/projection/ProjectionSpec.js
similarity index 57%
rename from spec/suites/geo/ProjectionSpec.js
rename to spec/suites/geo/projection/ProjectionSpec.js
index f106562e3d6..83d46a48d0a 100644
--- a/spec/suites/geo/ProjectionSpec.js
+++ b/spec/suites/geo/projection/ProjectionSpec.js
@@ -4,23 +4,23 @@ describe("Projection.Mercator", function () {
describe("#project", function () {
it("projects a center point", function () {
// edge cases
- expect(p.project(new L.LatLng(0, 0))).near(new L.Point(0, 0));
+ expect(p.project(new L.LatLng(0, 0))).near([0, 0]);
});
it("projects the northeast corner of the world", function () {
- expect(p.project(new L.LatLng(85.0840591556, 180))).near(new L.Point(20037508, 20037508));
+ expect(p.project(new L.LatLng(85.0840591556, 180))).near([20037508, 20037508]);
});
it("projects the southwest corner of the world", function () {
- expect(p.project(new L.LatLng(-85.0840591556, -180))).near(new L.Point(-20037508, -20037508));
+ expect(p.project(new L.LatLng(-85.0840591556, -180))).near([-20037508, -20037508]);
});
it("projects other points", function () {
- expect(p.project(new L.LatLng(50, 30))).near(new L.Point(3339584, 6413524));
+ expect(p.project(new L.LatLng(50, 30))).near([3339584, 6413524]);
// from https://github.com/Leaflet/Leaflet/issues/1578
expect(p.project(new L.LatLng(51.9371170300465, 80.11230468750001)))
- .near(new L.Point(8918060.964088084, 6755099.410887127));
+ .near([8918060.964088084, 6755099.410887127]);
});
});
@@ -30,14 +30,14 @@ describe("Projection.Mercator", function () {
}
it("unprojects a center point", function () {
- expect(pr(new L.Point(0, 0))).near(new L.Point(0, 0));
+ expect(pr(new L.Point(0, 0))).near([0, 0]);
});
it("unprojects pi points", function () {
- expect(pr(new L.Point(-Math.PI, Math.PI))).near(new L.Point(-Math.PI, Math.PI));
- expect(pr(new L.Point(-Math.PI, -Math.PI))).near(new L.Point(-Math.PI, -Math.PI));
+ expect(pr(new L.Point(-Math.PI, Math.PI))).near([-Math.PI, Math.PI]);
+ expect(pr(new L.Point(-Math.PI, -Math.PI))).near([-Math.PI, -Math.PI]);
- expect(pr(new L.Point(0.523598775598, 1.010683188683))).near(new L.Point(0.523598775598, 1.010683188683));
+ expect(pr(new L.Point(0.523598775598, 1.010683188683))).near([0.523598775598, 1.010683188683]);
});
it('unprojects other points', function () {
@@ -46,29 +46,30 @@ describe("Projection.Mercator", function () {
});
});
});
+
describe("Projection.SphericalMercator", function () {
var p = L.Projection.SphericalMercator;
describe("#project", function () {
it("projects a center point", function () {
// edge cases
- expect(p.project(new L.LatLng(0, 0))).near(new L.Point(0, 0));
+ expect(p.project(new L.LatLng(0, 0))).near([0, 0]);
});
it("projects the northeast corner of the world", function () {
- expect(p.project(new L.LatLng(85.0511287798, 180))).near(new L.Point(20037508, 20037508));
+ expect(p.project(new L.LatLng(85.0511287798, 180))).near([20037508, 20037508]);
});
it("projects the southwest corner of the world", function () {
- expect(p.project(new L.LatLng(-85.0511287798, -180))).near(new L.Point(-20037508, -20037508));
+ expect(p.project(new L.LatLng(-85.0511287798, -180))).near([-20037508, -20037508]);
});
it("projects other points", function () {
- expect(p.project(new L.LatLng(50, 30))).near(new L.Point(3339584, 6446275));
+ expect(p.project(new L.LatLng(50, 30))).near([3339584, 6446275]);
// from https://github.com/Leaflet/Leaflet/issues/1578
expect(p.project(new L.LatLng(51.9371170300465, 80.11230468750001)))
- .near(new L.Point(8918060.96409, 6788763.38325));
+ .near([8918060.96409, 6788763.38325]);
});
});
@@ -78,14 +79,14 @@ describe("Projection.SphericalMercator", function () {
}
it("unprojects a center point", function () {
- expect(pr(new L.Point(0, 0))).near(new L.Point(0, 0));
+ expect(pr(new L.Point(0, 0))).near([0, 0]);
});
it("unprojects pi points", function () {
- expect(pr(new L.Point(-Math.PI, Math.PI))).near(new L.Point(-Math.PI, Math.PI));
- expect(pr(new L.Point(-Math.PI, -Math.PI))).near(new L.Point(-Math.PI, -Math.PI));
+ expect(pr(new L.Point(-Math.PI, Math.PI))).near([-Math.PI, Math.PI]);
+ expect(pr(new L.Point(-Math.PI, -Math.PI))).near([-Math.PI, -Math.PI]);
- expect(pr(new L.Point(0.523598775598, 1.010683188683))).near(new L.Point(0.523598775598, 1.010683188683));
+ expect(pr(new L.Point(0.523598775598, 1.010683188683))).near([0.523598775598, 1.010683188683]);
});
it('unprojects other points', function () {
diff --git a/spec/suites/geometry/BoundsSpec.js b/spec/suites/geometry/BoundsSpec.js
index 9eafba8425d..aa925dc6b28 100644
--- a/spec/suites/geometry/BoundsSpec.js
+++ b/spec/suites/geometry/BoundsSpec.js
@@ -3,12 +3,12 @@ describe('Bounds', function () {
beforeEach(function () {
a = new L.Bounds(
- new L.Point(14, 12), // left, top
- new L.Point(30, 40)); // right, bottom
+ [14, 12], // left, top
+ [30, 40]); // right, bottom
b = new L.Bounds([
- new L.Point(20, 12), // center, top
- new L.Point(14, 20), // left, middle
- new L.Point(30, 40) // right, bottom
+ [20, 12], // center, top
+ [14, 20], // left, middle
+ [30, 40] // right, bottom
]);
c = new L.Bounds();
});
@@ -18,6 +18,7 @@ describe('Bounds', function () {
expect(a.min).to.eql(new L.Point(14, 12));
expect(a.max).to.eql(new L.Point(30, 40));
});
+
it('creates bounds with proper min & max on (Point[])', function () {
expect(b.min).to.eql(new L.Point(14, 12));
expect(b.max).to.eql(new L.Point(30, 40));
@@ -26,11 +27,11 @@ describe('Bounds', function () {
describe('#extend', function () {
it('extends the bounds to contain the given point', function () {
- a.extend(new L.Point(50, 20));
+ a.extend([50, 20]);
expect(a.min).to.eql(new L.Point(14, 12));
expect(a.max).to.eql(new L.Point(50, 40));
- b.extend(new L.Point(25, 50));
+ b.extend([25, 50]);
expect(b.min).to.eql(new L.Point(14, 12));
expect(b.max).to.eql(new L.Point(30, 50));
});
@@ -44,11 +45,11 @@ describe('Bounds', function () {
describe('#contains', function () {
it('contains other bounds or point', function () {
- a.extend(new L.Point(50, 10));
+ a.extend([50, 10]);
expect(a.contains(b)).to.be.ok();
expect(b.contains(a)).to.not.be.ok();
- expect(a.contains(new L.Point(24, 25))).to.be.ok();
- expect(a.contains(new L.Point(54, 65))).to.not.be.ok();
+ expect(a.contains([24, 25])).to.be.ok();
+ expect(a.contains([54, 65])).to.not.be.ok();
});
});
@@ -56,9 +57,11 @@ describe('Bounds', function () {
it('returns true if properly set up', function () {
expect(a.isValid()).to.be.ok();
});
+
it('returns false if is invalid', function () {
expect(c.isValid()).to.not.be.ok();
});
+
it('returns true if extended', function () {
c.extend([0, 0]);
expect(c.isValid()).to.be.ok();
@@ -74,7 +77,31 @@ describe('Bounds', function () {
describe('#intersects', function () {
it('returns true if bounds intersect', function () {
expect(a.intersects(b)).to.be(true);
- expect(a.intersects(new L.Bounds(new L.Point(100, 100), new L.Point(120, 120)))).to.eql(false);
+ });
+
+ it('two bounds intersect if they have at least one point in common', function () {
+ expect(a.intersects([[14, 12], [6, 5]])).to.be(true);
+ });
+
+ it('returns false if bounds not intersect', function () {
+ expect(a.intersects([[100, 100], [120, 120]])).to.eql(false);
+ });
+ });
+
+ describe('#overlaps', function () {
+ it('returns true if bounds overlaps', function () {
+ expect(a.overlaps(b)).to.be(true);
+ });
+
+ it('two bounds overlaps if their intersection is an area', function () {
+ // point in common
+ expect(a.overlaps([[14, 12], [6, 5]])).to.be(false);
+ // matching boundary
+ expect(a.overlaps([[30, 12], [35, 25]])).to.be(false);
+ });
+
+ it('returns false if bounds not overlaps', function () {
+ expect(a.overlaps([[100, 100], [120, 120]])).to.eql(false);
});
});
diff --git a/spec/suites/geometry/LineUtilSpec.js b/spec/suites/geometry/LineUtilSpec.js
index c09ac761797..c35083f645c 100644
--- a/spec/suites/geometry/LineUtilSpec.js
+++ b/spec/suites/geometry/LineUtilSpec.js
@@ -1,7 +1,5 @@
describe('LineUtil', function () {
-
describe('#clipSegment', function () {
-
var bounds;
beforeEach(function () {
@@ -51,7 +49,6 @@ describe('LineUtil', function () {
});
describe('#pointToSegmentDistance & #closestPointOnSegment', function () {
-
var p1 = new L.Point(0, 10);
var p2 = new L.Point(10, 0);
var p = new L.Point(0, 0);
@@ -86,5 +83,4 @@ describe('LineUtil', function () {
]);
});
});
-
});
diff --git a/spec/suites/geometry/PointSpec.js b/spec/suites/geometry/PointSpec.js
index ea53ad73519..12afc58c12a 100644
--- a/spec/suites/geometry/PointSpec.js
+++ b/spec/suites/geometry/PointSpec.js
@@ -1,7 +1,5 @@
describe("Point", function () {
-
describe('constructor', function () {
-
it("creates a point with the given x and y", function () {
var p = new L.Point(1.5, 2.5);
expect(p.x).to.eql(1.5);
@@ -99,15 +97,19 @@ describe("Point", function () {
var p = new L.Point(50, 30);
expect(L.point(p)).to.be(p);
});
+
it('creates a point out of three arguments', function () {
expect(L.point(50.1, 30.1, true)).to.eql(new L.Point(50, 30));
});
+
it('creates a point from an array of coordinates', function () {
expect(L.point([50, 30])).to.eql(new L.Point(50, 30));
});
+
it("creates a point from an object with x and y properties", function () {
expect(L.point({x: 50, y: 30})).to.eql(new L.Point(50, 30));
});
+
it('does not fail on invalid arguments', function () {
expect(L.point(undefined)).to.be(undefined);
expect(L.point(null)).to.be(null);
diff --git a/spec/suites/geometry/PolyUtilSpec.js b/spec/suites/geometry/PolyUtilSpec.js
index d4bc3590797..172d58881bc 100644
--- a/spec/suites/geometry/PolyUtilSpec.js
+++ b/spec/suites/geometry/PolyUtilSpec.js
@@ -1,5 +1,4 @@
describe('PolyUtil', function () {
-
describe('#clipPolygon', function () {
it('clips polygon by bounds', function () {
var bounds = L.bounds([0, 0], [10, 10]);
diff --git a/spec/suites/geometry/TransformationSpec.js b/spec/suites/geometry/TransformationSpec.js
index 35e6e971948..b0cc76dfa20 100644
--- a/spec/suites/geometry/TransformationSpec.js
+++ b/spec/suites/geometry/TransformationSpec.js
@@ -11,6 +11,7 @@ describe("Transformation", function () {
var p2 = t.transform(p, 2);
expect(p2).to.eql(new L.Point(24, 128));
});
+
it('assumes a scale of 1 if not specified', function () {
var p2 = t.transform(p);
expect(p2).to.eql(new L.Point(12, 64));
@@ -23,8 +24,8 @@ describe("Transformation", function () {
var p3 = t.untransform(p2, 2);
expect(p3).to.eql(p);
});
+
it('assumes a scale of 1 if not specified', function () {
- var p2 = t.transform(p);
expect(t.untransform(new L.Point(12, 64))).to.eql(new L.Point(10, 20));
});
});
diff --git a/spec/suites/layer/FeatureGroupSpec.js b/spec/suites/layer/FeatureGroupSpec.js
index 06df8a8dade..a34851c8d73 100644
--- a/spec/suites/layer/FeatureGroupSpec.js
+++ b/spec/suites/layer/FeatureGroupSpec.js
@@ -1,14 +1,11 @@
describe('FeatureGroup', function () {
- var map;
- beforeEach(function () {
- map = L.map(document.createElement('div'));
- map.setView([0, 0], 1);
- });
describe("#_propagateEvent", function () {
var marker;
+
beforeEach(function () {
marker = L.marker([0, 0]);
});
+
describe("when a Marker is added to multiple FeatureGroups ", function () {
it("e.propagatedFrom should be the Marker", function () {
var fg1 = L.featureGroup(),
@@ -39,6 +36,7 @@
});
});
});
+
describe('addLayer', function () {
it('adds the layer', function () {
var fg = L.featureGroup(),
@@ -50,6 +48,7 @@
expect(fg.hasLayer(marker)).to.be(true);
});
+
it('supports non-evented layers', function () {
var fg = L.featureGroup(),
g = L.layerGroup();
@@ -61,6 +60,7 @@
expect(fg.hasLayer(g)).to.be(true);
});
});
+
describe('removeLayer', function () {
it('removes the layer passed to it', function () {
var fg = L.featureGroup(),
@@ -72,6 +72,7 @@
fg.removeLayer(marker);
expect(fg.hasLayer(marker)).to.be(false);
});
+
it('removes the layer passed to it by id', function () {
var fg = L.featureGroup(),
marker = L.marker([0, 0]);
diff --git a/spec/suites/layer/GeoJSONSpec.js b/spec/suites/layer/GeoJSONSpec.js
index 944e9edc522..74a00f44520 100644
--- a/spec/suites/layer/GeoJSONSpec.js
+++ b/spec/suites/layer/GeoJSONSpec.js
@@ -1,5 +1,4 @@
describe("L.GeoJSON", function () {
-
describe("addData", function () {
var geojson = {
type: 'Feature',
@@ -31,10 +30,24 @@ describe("L.GeoJSON", function () {
layer.addData(geojsonEmpty);
expect(layer.getLayers().length).to.eql(0);
});
+
+ it("makes default marker inherit group options if explicitly requested", function () {
+ // Check first that it does not inherit group options by default
+ var options = {
+ customOption: "My Custom Option"
+ };
+ var layer = new L.GeoJSON(null, options);
+ layer.addData(geojson);
+ expect(layer.getLayers()[0].options.customOption).to.equal(undefined);
+
+ // Now make it inherit group options
+ layer.options.markersInheritOptions = true;
+ layer.addData(geojson);
+ expect(layer.getLayers()[1].options.customOption).to.eql(options.customOption);
+ });
});
describe('resetStyle', function () {
-
it('should reset init options', function () {
var feature = {
type: 'Feature',
@@ -53,8 +66,36 @@ describe("L.GeoJSON", function () {
expect(layer.options.color).to.be('chocolate');
});
+ it('should reset init options of all child layers', function () {
+ var feature = {
+ type: 'Feature',
+ geometry: {
+ type: 'LineString',
+ coordinates:[[-2.35, 51.38], [-2.38, 51.38]]
+ }
+ };
+ var feature2 = {
+ type: 'Feature',
+ geometry: {
+ type: 'LineString',
+ coordinates:[[-3.35, 50.38], [-3.38, 50.38]]
+ }
+ };
+ var geojson = L.geoJSON([feature, feature2], {weight: 7, color: 'chocolate'});
+ geojson.setStyle({weight: 22, color: 'coral'});
+ var layer = geojson.getLayers()[0];
+ expect(layer.options.weight).to.be(22);
+ expect(layer.options.color).to.be('coral');
+ var layer2 = geojson.getLayers()[1];
+ expect(layer2.options.weight).to.be(22);
+ expect(layer2.options.color).to.be('coral');
+ geojson.resetStyle(); // Should apply to all layers
+ expect(layer.options.weight).to.be(7);
+ expect(layer.options.color).to.be('chocolate');
+ expect(layer2.options.weight).to.be(7);
+ expect(layer2.options.color).to.be('chocolate');
+ });
});
-
});
describe("L.Marker#toGeoJSON", function () {
@@ -471,3 +512,358 @@ describe("L.LayerGroup#toGeoJSON", function () {
});
});
});
+
+describe("L.GeoJSON functions", function () {
+ describe("#geometryToLayer", function () {
+ var point = {
+ type: "Point",
+ coordinates: [0, 0]
+ };
+ var multiPoint = {
+ type: "MultiPoint",
+ coordinates: [
+ [0, 0], [10, 10]
+ ]
+ };
+ var line = {
+ type: "LineString",
+ coordinates: [
+ [0, 0], [10, 10], [20, 20]
+ ]
+ };
+ var multiLine = {
+ type: "MultiLineString",
+ coordinates: [
+ [[10, 10], [20, 20], [30, 30]],
+ [[50, 50], [60, 60], [70, 70]]
+ ]
+ };
+ var polygon = {
+ type: "Polygon",
+ coordinates: [
+ [[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]
+ ]
+ };
+ var multiPolygon = {
+ type: "MultiPolygon",
+ coordinates: [
+ [
+ [[30, 20], [45, 40], [10, 40], [30, 20]]
+ ],
+ [
+ [[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]
+ ]
+ ]
+ };
+ var geometryCollection = {
+ type: "GeometryCollection",
+ geometries: [
+ {
+ type: "Point",
+ coordinates: [0, 0]
+ },
+ {
+ type: "LineString",
+ coordinates: [
+ [10, 10], [20, 20]
+ ]
+ }
+ ]
+ };
+
+ function customPointToLayer(geojsonPoint, latLng) {
+ return L.circle(latLng, {
+ radius: geojsonPoint.properties.radius
+ });
+ }
+
+ function customCoordstoLatLng(coords) {
+ return L.latLng(coords[1] + 1, coords[0] + 1, coords[2] + 1);
+ }
+
+ [
+ [point, L.Marker],
+ [line, L.Polyline],
+ [polygon, L.Polygon],
+ [multiPoint, L.FeatureGroup],
+ [multiLine, L.Polyline],
+ [multiPolygon, L.Polygon],
+ [geometryCollection, L.FeatureGroup]
+ ].forEach(function (item) {
+ var geometry = item[0], expectedType = item[1];
+
+ it("creates a Layer from a GeoJSON feature (type='" + geometry.type + "')", function () {
+ var layer = L.GeoJSON.geometryToLayer({
+ type: "Feature",
+ geometry: geometry
+ });
+ expect(layer).to.be.a(expectedType);
+ });
+
+ it("creates a Layer from a GeoJSON geometry (type='" + geometry.type + "')", function () {
+ var layer = L.GeoJSON.geometryToLayer(geometry);
+ expect(layer).to.be.a(expectedType);
+ });
+ });
+
+ it("throws an error if feature is an invalid GeoJSON object", function () {
+ expect(L.GeoJSON.geometryToLayer).withArgs({
+ type: "Feature",
+ geometry: {
+ type: "invalid",
+ coordinates: [0, 0]
+ }
+ }).to.throwError("Invalid GeoJSON object.");
+ });
+
+ it("returns nothing if feature does not have a geometry property", function () {
+ var ret = L.GeoJSON.geometryToLayer({type: "Feature"});
+ expect(ret).not.to.be.ok();
+ });
+
+ it("creates a Layer using pointToLayer option (Point)", function () {
+ var layer = L.GeoJSON.geometryToLayer({
+ type: "Feature",
+ geometry: point,
+ properties: {radius: 100}
+ }, {
+ pointToLayer: customPointToLayer
+ });
+ expect(layer).to.be.a(L.Circle);
+ expect(layer.options.radius).to.be(100);
+ });
+
+ it("creates a Layer using pointToLayer option (MultiPoint)", function () {
+ var layer = L.GeoJSON.geometryToLayer({
+ type: "Feature",
+ geometry: multiPoint,
+ properties: {radius: 100}
+ }, {
+ pointToLayer: customPointToLayer
+ });
+ layer.eachLayer(function (lyr) {
+ expect(lyr).to.be.a(L.Circle);
+ expect(lyr.options.radius).to.be(100);
+ });
+ });
+
+ it("creates a Layer using coordsToLatLng option (Point)", function () {
+ var layer = L.GeoJSON.geometryToLayer({
+ type: "Feature",
+ geometry: {
+ type: "Point",
+ coordinates: [1, 2, 3]
+ }
+ }, {
+ coordsToLatLng: customCoordstoLatLng
+ });
+ expect(layer.getLatLng()).to.eql({lat: 3, lng: 2, alt: 4});
+ });
+
+ it("creates a Layer using coordsToLatLng option (MultiPoint)", function () {
+ var layer = L.GeoJSON.geometryToLayer({
+ type: "Feature",
+ geometry: {
+ type: "MultiPoint",
+ coordinates: [
+ [1, 2, 3], [4, 5, 6]
+ ]
+ }
+ }, {
+ coordsToLatLng: customCoordstoLatLng
+ });
+ expect(layer.getLayers().map(function (lyr) {
+ return lyr.getLatLng();
+ })).to.eql([
+ {lat: 3, lng: 2, alt: 4},
+ {lat: 6, lng: 5, alt: 7}
+ ]);
+ });
+ });
+
+ describe("#coordsToLatLng", function () {
+ it("creates a LatLng object with given coordinates", function () {
+ var latLng = L.GeoJSON.coordsToLatLng([1, 2]);
+ var latLngWithAlt = L.GeoJSON.coordsToLatLng([3, 4, 5]);
+ expect(latLng).to.be.a(L.LatLng);
+ expect(latLngWithAlt).to.be.a(L.LatLng);
+ expect(latLng).to.eql({lng: 1, lat: 2});
+ expect(latLngWithAlt).to.eql({lng: 3, lat: 4, alt: 5});
+ });
+ });
+
+ describe("#coordsToLatLngs", function () {
+
+ function customCoordsToLatLng(coords) {
+ return L.latLng(coords[1] + 1, coords[0] + 1, coords[2] + 1);
+ }
+
+ it("creates a multidimensional array of LatLngs", function () {
+ var latLngs = L.GeoJSON.coordsToLatLngs([[1, 2], [3, 4], [5, 6]]);
+ expect(latLngs).to.eql([{lng: 1, lat: 2}, {lng: 3, lat: 4}, {lng: 5, lat: 6}]);
+ latLngs.forEach(function (latLng) {
+ expect(latLng).to.be.a(L.LatLng);
+ });
+ });
+
+ it("creates a multidimensional array of LatLngs (levelsDeep=1)", function () {
+ var latLngs = L.GeoJSON.coordsToLatLngs([
+ [[1, 2], [3, 4], [5, 6]],
+ [[5, 6], [7, 8], [9, 10]]
+ ], 1);
+ expect(latLngs).to.eql([
+ [{lng: 1, lat: 2}, {lng: 3, lat: 4}, {lng: 5, lat: 6}],
+ [{lng: 5, lat: 6}, {lng: 7, lat: 8}, {lng: 9, lat: 10}]
+ ]);
+ latLngs.forEach(function (arr) {
+ arr.forEach(function (latlng) {
+ expect(latlng).to.be.a(L.LatLng);
+ });
+ });
+ });
+
+ it("creates a multidimensional array of LatLngs with custom coordsToLatLng", function () {
+ var coords = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
+ var latLngs = L.GeoJSON.coordsToLatLngs(coords, 0, customCoordsToLatLng);
+ expect(latLngs).to.eql([
+ {lat: 3, lng: 2, alt: 4},
+ {lat: 6, lng: 5, alt: 7},
+ {lat: 9, lng: 8, alt: 10}
+ ]);
+ });
+
+ it("creates a multidimensional array of LatLngs with custom coordsToLatLng (levelDeep=1)", function () {
+ var coords = [
+ [[1, 2, 3], [4, 5, 6]],
+ [[12, 13, 14], [15, 16, 17]]
+ ];
+ var latLngs = L.GeoJSON.coordsToLatLngs(coords, 1, customCoordsToLatLng);
+ expect(latLngs).to.eql([
+ [
+ {lat: 3, lng: 2, alt: 4},
+ {lat: 6, lng: 5, alt: 7}
+ ],
+ [
+ {lat: 14, lng: 13, alt: 15},
+ {lat: 17, lng: 16, alt: 18}
+ ]
+ ]);
+ });
+ });
+
+ describe("#latLngToCoords", function () {
+ it("returns an array of coordinates and altitude", function () {
+ var coords = L.GeoJSON.latLngToCoords(L.latLng(2, 1));
+ var coordsWithAlt = L.GeoJSON.latLngToCoords(L.latLng(2, 1, 3));
+ expect(coords).to.eql([1, 2]);
+ expect(coordsWithAlt).to.eql([1, 2, 3]);
+ });
+
+ it("returns an array of coordinates with given precision", function () {
+ var coords = L.GeoJSON.latLngToCoords(L.latLng(
+ 2.123456, 1.123456
+ ), 3);
+ var coordsWithAlt = L.GeoJSON.latLngToCoords(L.latLng(
+ 2.123456, 1.123456, 3.123456
+ ), 3);
+ expect(coords).to.eql([1.123, 2.123]);
+ expect(coordsWithAlt).to.eql([1.123, 2.123, 3.123]);
+ });
+ });
+
+ describe("#latLngsToCoords", function () {
+ it("returns a multidimensional array of coordinates", function () {
+ var coords = L.GeoJSON.latLngsToCoords([L.latLng(2, 1), L.latLng(4, 3)]);
+ var coordWithAlt = L.GeoJSON.latLngsToCoords([L.latLng(2, 1, 3), L.latLng(5, 4, 6)]);
+ expect(coords).to.eql([[1, 2], [3, 4]]);
+ expect(coordWithAlt).to.eql([[1, 2, 3], [4, 5, 6]]);
+ });
+
+ it("returns a multidimensional array of coordinates (levelDeep=1)", function () {
+ var latLngs = [
+ [L.latLng(2, 1), L.latLng(4, 3)],
+ [L.latLng(6, 5), L.latLng(8, 7)]
+ ];
+ var coords = L.GeoJSON.latLngsToCoords(latLngs, 1);
+ expect(coords).to.eql([
+ [[1, 2], [3, 4]],
+ [[5, 6], [7, 8]]
+ ]);
+ });
+
+ it("returns a multidimensional array of coordinates (closed=True)", function () {
+ var latLngs = [L.latLng(2, 1), L.latLng(4, 3), L.latLng(6, 5)];
+ var coords = L.GeoJSON.latLngsToCoords(latLngs, 0, true);
+ expect(coords).to.eql([[1, 2], [3, 4], [5, 6], [1, 2]]);
+ });
+
+ it("returns a multidimensional array of coordinates (levelsDeep=1, closed=True)", function () {
+ var latLngs = [
+ [L.latLng(2, 1), L.latLng(4, 3), L.latLng(6, 5)],
+ [L.latLng(8, 7), L.latLng(10, 9), L.latLng(12, 11)]
+ ];
+ var coords = L.GeoJSON.latLngsToCoords(latLngs, 1, true);
+ expect(coords).to.eql([
+ [[1, 2], [3, 4], [5, 6], [1, 2]],
+ [[7, 8], [9, 10], [11, 12], [7, 8]]
+ ]);
+ });
+
+ it("returns a multidimensional array of coordinates with given precision", function () {
+ var latLngs = [L.latLng(2.123456, 1.123456), L.latLng(4.123456, 3.123456)];
+ var coords = L.GeoJSON.latLngsToCoords(latLngs, 0, false, 3);
+ expect(coords).to.eql([[1.123, 2.123], [3.123, 4.123]]);
+ });
+ });
+
+ describe("#asFeature", function () {
+ var geometry1 = {
+ type: "Point",
+ coordinates: [0, 0]
+ };
+
+ var geometry2 = {
+ type: "Point",
+ coordinates: [1, 1]
+ };
+
+ var feature1 = {
+ type: "Feature",
+ geometry: geometry1,
+ properties: {a: 1}
+ };
+
+ var feature2 = {
+ type: "Feature",
+ geometry: geometry2,
+ properties: {b: 2}
+ };
+
+ var featureCollection = {
+ type: "FeatureCollection",
+ features: [
+ feature1,
+ feature2
+ ]
+ };
+
+ it("given a bare geometry returns a GeoJSON-like feature", function () {
+ var ret = L.GeoJSON.asFeature(geometry1);
+ expect(ret).to.eql({
+ type: "Feature",
+ properties: {},
+ geometry: geometry1
+ });
+ });
+
+ it("given a GeoJSON feature directly returns it", function () {
+ var ret = L.GeoJSON.asFeature(feature1);
+ expect(ret).to.eql(feature1);
+ });
+
+ it("given a GeoJSON feature collection directly returns it", function () {
+ var ret = L.GeoJSON.asFeature(featureCollection);
+ expect(ret).to.eql(featureCollection);
+ });
+ });
+});
diff --git a/spec/suites/layer/ImageOverlaySpec.js b/spec/suites/layer/ImageOverlaySpec.js
index 6f1616a8e87..0db082ecf24 100644
--- a/spec/suites/layer/ImageOverlaySpec.js
+++ b/spec/suites/layer/ImageOverlaySpec.js
@@ -1,10 +1,29 @@
describe('ImageOverlay', function () {
+ var c, map;
+ var imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
+
+ beforeEach(function () {
+ c = document.createElement('div');
+ c.style.width = '400px';
+ c.style.height = '400px';
+ document.body.appendChild(c);
+ map = new L.Map(c);
+ map.setView(new L.LatLng(55.8, 37.6), 6); // view needs to be set so when layer is added it is initilized
+ });
+
+ afterEach(function () {
+ map.remove();
+ map = null;
+ document.body.removeChild(c);
+ });
+
describe('#setStyle', function () {
it('sets opacity', function () {
var overlay = L.imageOverlay().setStyle({opacity: 0.5});
expect(overlay.options.opacity).to.equal(0.5);
});
});
+
describe('#setBounds', function () {
it('sets bounds', function () {
var bounds = new L.LatLngBounds(
@@ -14,22 +33,17 @@ describe('ImageOverlay', function () {
expect(overlay._bounds).to.equal(bounds);
});
});
+
describe("_image", function () {
- var c, map, overlay;
+ var overlay;
+
// Url for testing errors
var errorUrl = 'data:image/false;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAT1JREFUOI2dk79qwlAUxr9zcKmxbyAWh0IIDqJrcchkX6ODrn2TDAWRPEkyKKVzBxHJkKFoySP0mlLhnA5NbIgmpf6my73n+853/xFKRLY9UJEpAy6Am2x6q8xLYZ73omhVrKd88DocNpvGPBHwUDYtIiL+9X7/2EmS9GiQiUMC7urER1RfLGPGnSRJGQCyzidiy/Nged6pAdHoo9XyAIAj2x78FfscBEw3jtNnFZn+V5zDIhPOTvsiFHAZv1d1SYIuXyrOaQDYArg9t3gIw1qxML81lHlJFQZfQVBrwKoLFuZ5VUHlO8ggVZ97UbQSEf9cwSEMq7ehOrPjeE0A8N5uXxnLCkA0qs2cIcBzM03vu7vdJwNAJ0lSy5hxVZJy51wMFH5jzsZx+iwyUcBlkS7wc9qsuiBV347jdbH+G/fth7AzHdiJAAAAAElFTkSuQmCC';
var blankUrl = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
- // Create map and overlay for each test
+ // Create overlay for each test
beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- document.body.appendChild(c);
- map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6); // view needs to be set so when layer is added it is initilized
-
- overlay = L.imageOverlay(blankUrl, [[40.712216, -74.22655], [40.773941, -74.12544]], {
+ overlay = L.imageOverlay(blankUrl, imageBounds, {
errorOverlayUrl: errorUrl,
className: 'my-custom-image-class'
});
@@ -43,15 +57,13 @@ describe('ImageOverlay', function () {
// Clean up after each test run
afterEach(function () {
- document.body.removeChild(c);
map.removeLayer(overlay);
overlay = null;
- map = null;
});
function raiseImageEvent(event) {
var domEvent = document.createEvent('Event');
- domEvent.initEvent(event);
+ domEvent.initEvent(event, false, false);
overlay._image.dispatchEvent(domEvent);
}
@@ -71,6 +83,7 @@ describe('ImageOverlay', function () {
raiseImageEvent('error');
expect(errorRaised.called).to.be(true);
});
+
it('should change the image to errorOverlayUrl', function () {
raiseImageEvent('error');
expect(overlay._url).to.be(errorUrl);
@@ -86,28 +99,6 @@ describe('ImageOverlay', function () {
});
describe('#setZIndex', function () {
-
- var div, map;
- var corner1 = L.latLng(40.712, -74.227),
- corner2 = L.latLng(40.774, -74.125),
- bounds = L.latLngBounds(corner1, corner2);
-
- beforeEach(function () {
- div = document.createElement('div');
- div.style.width = '800px';
- div.style.height = '600px';
- div.style.visibility = 'hidden';
-
- document.body.appendChild(div);
-
- map = L.map(div);
- map.setView([0, 0], 1); // view needs to be set so when layer is added it is initilized
- });
-
- afterEach(function () {
- document.body.removeChild(div);
- });
-
it('sets the z-index of the image', function () {
var overlay = L.imageOverlay();
overlay.setZIndex(10);
@@ -115,25 +106,25 @@ describe('ImageOverlay', function () {
});
it('should update the z-index of the image if it has allready been added to the map', function () {
- var overlay = L.imageOverlay('', bounds);
+ var overlay = L.imageOverlay('', imageBounds);
overlay.addTo(map);
- expect(overlay._image.style.zIndex).to.be('1');
+ expect(overlay._image.style.zIndex).to.eql('1'); // Number type in IE
overlay.setZIndex('10');
- expect(overlay._image.style.zIndex).to.be('10');
+ expect(overlay._image.style.zIndex).to.eql('10'); // Number type in IE
});
it('should set the z-index of the image when it is added to the map', function () {
- var overlay = L.imageOverlay('', bounds);
+ var overlay = L.imageOverlay('', imageBounds);
overlay.setZIndex('10');
overlay.addTo(map);
- expect(overlay._image.style.zIndex).to.be('10');
+ expect(overlay._image.style.zIndex).to.eql('10'); // Number type in IE
});
it('should use the z-index specified in options', function () {
- var overlay = L.imageOverlay('', bounds, {zIndex: 20});
+ var overlay = L.imageOverlay('', imageBounds, {zIndex: 20});
overlay.addTo(map);
- expect(overlay._image.style.zIndex).to.be('20');
+ expect(overlay._image.style.zIndex).to.eql('20'); // Number type in IE
});
it('should be fluent', function () {
@@ -142,28 +133,23 @@ describe('ImageOverlay', function () {
});
});
+ describe('#getCenter', function () {
+ it('should return the correct center', function () {
+ var overlay = L.imageOverlay('', imageBounds).addTo(map);
+ expect(overlay.getCenter()).to.be.nearLatLng([40.743078, -74.175995]);
+ });
+ it('should open popup at the center', function () {
+ var overlay = L.imageOverlay('', imageBounds).addTo(map);
+ overlay.bindPopup('Center').openPopup();
+ expect(overlay.getPopup().getLatLng()).to.be.nearLatLng([40.743078, -74.175995]);
+ });
+ });
// For tests that do not actually need to append the map container to the document.
// This saves PhantomJS memory.
- describe('_image2', function () {
- var c, map, overlay;
+ var _describe = 'crossOrigin' in L.DomUtil.create('img') ? describe : describe.skip; // skip in IE<11
+ _describe('crossOrigin option', function () {
+ var overlay;
var blankUrl = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
- var bounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
-
- // Create map and overlay for each test
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6); // view needs to be set so when layer is added it is initialized
- });
-
- // Clean up after each test run
- afterEach(function () {
- map.removeLayer(overlay);
- overlay = null;
- map = null;
- });
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes
testCrossOriginValue(undefined, null); // Falsy value (other than empty string '') => no attribute set.
@@ -174,7 +160,7 @@ describe('ImageOverlay', function () {
function testCrossOriginValue(crossOrigin, expectedValue) {
it('uses crossOrigin option value ' + crossOrigin, function () {
- overlay = L.imageOverlay(blankUrl, bounds, {
+ overlay = L.imageOverlay(blankUrl, imageBounds, {
crossOrigin: crossOrigin
});
map.addLayer(overlay);
diff --git a/spec/suites/layer/LayerGroupSpec.js b/spec/suites/layer/LayerGroupSpec.js
index 3767e4b488a..2dba44f3619 100644
--- a/spec/suites/layer/LayerGroupSpec.js
+++ b/spec/suites/layer/LayerGroupSpec.js
@@ -1,10 +1,14 @@
describe('LayerGroup', function () {
describe("#hasLayer", function () {
- it("returns false when passed undefined, null, or false", function () {
+ it("throws when called without proper argument", function () {
var lg = L.layerGroup();
- expect(lg.hasLayer(undefined)).to.equal(false);
- expect(lg.hasLayer(null)).to.equal(false);
- expect(lg.hasLayer(false)).to.equal(false);
+ var hasLayer = L.Util.bind(lg.hasLayer, lg);
+ expect(hasLayer).withArgs(new L.Layer()).to.not.throwException(); // control case
+
+ expect(hasLayer).withArgs(undefined).to.throwException();
+ expect(hasLayer).withArgs(null).to.throwException();
+ expect(hasLayer).withArgs(false).to.throwException();
+ expect(hasLayer).to.throwException();
});
});
diff --git a/spec/suites/layer/PopupSpec.js b/spec/suites/layer/PopupSpec.js
index a5451e296bf..c85fcdcc6fb 100644
--- a/spec/suites/layer/PopupSpec.js
+++ b/spec/suites/layer/PopupSpec.js
@@ -1,25 +1,28 @@
-describe('Popup', function () {
-
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- document.body.appendChild(c);
- map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6);
- });
+var c, map, center = [55.8, 37.6];
+
+function setup() {
+ c = document.createElement('div');
+ c.style.width = '400px';
+ c.style.height = '400px';
+ document.body.appendChild(c);
+ map = new L.Map(c);
+ map.setView(center, 6);
+}
+
+function cleanup() {
+ map.remove();
+ document.body.removeChild(c);
+}
- afterEach(function () {
- document.body.removeChild(c);
- });
+describe('Popup', function () {
+ beforeEach(setup);
+ afterEach(cleanup);
it("closes on map click when map has closePopupOnClick option", function () {
map.options.closePopupOnClick = true;
var popup = new L.Popup()
- .setLatLng(new L.LatLng(55.8, 37.6))
+ .setLatLng(center)
.openOn(map);
happen.click(c);
@@ -31,7 +34,7 @@ describe('Popup', function () {
map.options.closePopupOnClick = false;
var popup = new L.Popup({closeOnClick: true})
- .setLatLng(new L.LatLng(55.8, 37.6))
+ .setLatLng(center)
.openOn(map);
happen.click(c);
@@ -43,7 +46,7 @@ describe('Popup', function () {
map.options.closePopupOnClick = true;
var popup = new L.Popup({closeOnClick: false})
- .setLatLng(new L.LatLng(55.8, 37.6))
+ .setLatLng(center)
.openOn(map);
happen.click(c);
@@ -52,7 +55,7 @@ describe('Popup', function () {
});
it("toggles its visibility when marker is clicked", function () {
- var marker = new L.Marker(new L.LatLng(55.8, 37.6));
+ var marker = new L.Marker(center);
map.addLayer(marker);
marker.bindPopup('Popup1');
@@ -68,8 +71,8 @@ describe('Popup', function () {
});
it("it should use a popup with a function as content with a FeatureGroup", function () {
- var marker1 = new L.Marker(new L.LatLng(55.8, 37.6));
- var marker2 = new L.Marker(new L.LatLng(54.6, 38.2));
+ var marker1 = new L.Marker(center);
+ var marker2 = new L.Marker([54.6, 38.2]);
var group = new L.FeatureGroup([marker1, marker2]).addTo(map);
marker1.description = "I'm marker 1.";
@@ -82,7 +85,7 @@ describe('Popup', function () {
// toggle popup on marker1
group.fire('click', {
- latlng: new L.LatLng(55.8, 37.6),
+ latlng: center,
layer: marker1
});
expect(map.hasLayer(group._popup)).to.be(true);
@@ -90,7 +93,7 @@ describe('Popup', function () {
// toggle popup on marker2
group.fire('click', {
- latlng: new L.LatLng(54.6, 38.2),
+ latlng: [54.6, 38.2],
layer: marker2
});
expect(map.hasLayer(group._popup)).to.be(true);
@@ -98,8 +101,8 @@ describe('Popup', function () {
});
it("it should function for popup content after bindPopup is called", function () {
- var marker1 = new L.Marker(new L.LatLng(55.8, 37.6));
- var marker2 = new L.Marker(new L.LatLng(54.6, 38.2));
+ var marker1 = new L.Marker(center);
+ var marker2 = new L.Marker([54.6, 38.2]);
var group = new L.FeatureGroup([marker1]).addTo(map);
marker1.description = "I'm marker 1.";
@@ -114,7 +117,7 @@ describe('Popup', function () {
// toggle popup on marker1
group.fire('click', {
- latlng: new L.LatLng(55.8, 37.6),
+ latlng: center,
layer: marker1
});
expect(map.hasLayer(group._popup)).to.be(true);
@@ -122,7 +125,7 @@ describe('Popup', function () {
// toggle popup on marker2
group.fire('click', {
- latlng: new L.LatLng(54.6, 38.2),
+ latlng: [54.6, 38.2],
layer: marker2
});
expect(map.hasLayer(group._popup)).to.be(true);
@@ -130,8 +133,8 @@ describe('Popup', function () {
});
it("should use a function for popup content when a source is passed to Popup", function () {
- var marker = new L.Marker(new L.LatLng(55.8, 37.6)).addTo(map);
- var popup = L.popup({}, marker);
+ var marker = new L.Marker(center).addTo(map);
+ L.popup({}, marker);
marker.description = "I am a marker.";
@@ -140,7 +143,7 @@ describe('Popup', function () {
});
marker.fire('click', {
- latlng: new L.LatLng(55.8, 37.6)
+ latlng: center
});
expect(map.hasLayer(marker._popup)).to.be(true);
@@ -148,8 +151,8 @@ describe('Popup', function () {
});
it("triggers popupopen on marker when popup opens", function () {
- var marker1 = new L.Marker(new L.LatLng(55.8, 37.6));
- var marker2 = new L.Marker(new L.LatLng(57.123076977278, 44.861962891635));
+ var marker1 = new L.Marker(center);
+ var marker2 = new L.Marker([57.123076977278, 44.861962891635]);
map.addLayer(marker1);
map.addLayer(marker2);
@@ -169,8 +172,8 @@ describe('Popup', function () {
});
it("triggers popupclose on marker when popup closes", function () {
- var marker1 = new L.Marker(new L.LatLng(55.8, 37.6));
- var marker2 = new L.Marker(new L.LatLng(57.123076977278, 44.861962891635));
+ var marker1 = new L.Marker(center);
+ var marker2 = new L.Marker([57.123076977278, 44.861962891635]);
map.addLayer(marker1);
map.addLayer(marker2);
@@ -195,7 +198,7 @@ describe('Popup', function () {
});
describe('should take into account icon popupAnchor option on', function () {
- var latlng = new L.LatLng(55.8, 37.6);
+ var latlng = center;
var offset = new L.Point(20, 30);
var autoPanBefore;
var popupAnchorBefore;
@@ -221,7 +224,7 @@ describe('Popup', function () {
L.Icon.Default.prototype.options.popupAnchor = popupAnchorBefore;
});
- it.skipInNonPhantom("non-any3d browsers", function () {
+ it.skipIf3d("non-any3d browsers", function () {
marker1.bindPopup('Popup').addTo(map);
marker1.openPopup();
var defaultLeft = parseInt(marker1._popup._container.style.left, 10);
@@ -242,7 +245,7 @@ describe('Popup', function () {
expect(offsetBottom + offset.y).to.eql(defaultBottom);
});
- it.skipInPhantom("any3d browsers", function () {
+ it.skipIfNo3d("any3d browsers", function () {
marker1.bindPopup('Popup').addTo(map);
marker1.openPopup();
var defaultLeft = marker1._popup._container._leaflet_pos.x;
@@ -265,7 +268,7 @@ describe('Popup', function () {
});
it("prevents an underlying map click for Layer", function () {
- var layer = new L.Polygon([[55.8, 37.6], [55.9, 37.7], [56.0, 37.8]]).addTo(map);
+ var layer = new L.Polygon([center, [55.9, 37.7], [56.0, 37.8]]).addTo(map);
layer.bindPopup("layer popup");
var mapClicked = false;
@@ -285,7 +288,7 @@ describe('Popup', function () {
it("can open a popup with enter keypress when marker has focus", function () {
- var layer = new L.Marker([55.8, 37.6]).addTo(map);
+ var layer = new L.Marker(center).addTo(map);
layer.bindPopup("layer popup");
happen.keypress(layer._icon, {
@@ -296,7 +299,6 @@ describe('Popup', function () {
});
describe("autoPan option should pan popup into visibility", function () {
-
// Helper function which calculates the offset of the map-container & popup-container in pixel
function getPopupOffset(map, popup) {
var mapOffset = map._container.getBoundingClientRect().top;
@@ -310,7 +312,7 @@ describe('Popup', function () {
expect(popupTopOffset).to.be.below(0, "The upper edge of the popup should not be visible");
done();
});
- map.openPopup('', L.latLng(58.4, 37.6), {
+ map.openPopup('', [58.4, 37.6], {
autoPan: false
});
});
@@ -321,7 +323,7 @@ describe('Popup', function () {
expect(popupTopOffset).to.be(10, "The upper edge of the popup have a padding of 10");
done();
});
- map.openPopup('', L.latLng(58.4, 37.6), {
+ map.openPopup('', [58.4, 37.6], {
autoPan: true,
autoPanPadding: L.point(10, 10)
});
@@ -339,7 +341,7 @@ describe('Popup', function () {
duration: 1
});
- map.openPopup('', L.latLng(58.4, 37.6), {
+ map.openPopup('', [58.4, 37.6], {
autoPan: true,
autoPanPadding: L.point(10, 10)
});
@@ -348,52 +350,39 @@ describe('Popup', function () {
});
describe("L.Map#openPopup", function () {
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6);
- });
-
- afterEach(function () {
- if (document.body.contains(c)) {
- document.body.removeChild(c);
- }
- });
+ beforeEach(setup);
+ afterEach(cleanup);
it("adds the popup layer to the map", function () {
var popup = new L.Popup()
- .setLatLng(new L.LatLng(55.8, 37.6));
+ .setLatLng(center);
map.openPopup(popup);
expect(map.hasLayer(popup)).to.be(true);
});
it("sets popup location", function () {
var popup = new L.Popup();
- map.openPopup(popup, L.latLng(55.8, 37.6));
+ map.openPopup(popup, center);
expect(popup.getLatLng()).to.eql(L.latLng(55.8, 37.6));
});
it("creates a popup from content", function () {
- map.openPopup("Hello World
", L.latLng(55.8, 37.6));
+ map.openPopup("Hello World
", center);
expect(map._popup).to.be.an(L.Popup);
expect(map._popup.getContent()).to.eql("Hello World
");
});
it("closes existing popup", function () {
- var p1 = new L.Popup().setLatLng(new L.LatLng(55.8, 37.6));
- var p2 = new L.Popup().setLatLng(new L.LatLng(55.8, 37.6));
+ var p1 = new L.Popup().setLatLng(center);
+ var p2 = new L.Popup().setLatLng(center);
map.openPopup(p1);
map.openPopup(p2);
expect(map.hasLayer(p1)).to.be(false);
});
it("does not close existing popup with autoClose: false option", function () {
- var p1 = new L.Popup({autoClose: false}).setLatLng(new L.LatLng(55.8, 37.6));
- var p2 = new L.Popup().setLatLng(new L.LatLng(55.8, 37.6));
+ var p1 = new L.Popup({autoClose: false}).setLatLng(center);
+ var p2 = new L.Popup().setLatLng(center);
map.openPopup(p1);
map.openPopup(p2);
expect(map.hasLayer(p1)).to.be(true);
@@ -401,14 +390,14 @@ describe("L.Map#openPopup", function () {
});
it('should not be closen when dragging map', function (done) {
- document.body.appendChild(c);
c.style.position = 'absolute';
c.style.left = 0;
c.style.top = 0;
c.style.zIndex = 10000;
+
var coords = map._container.getBoundingClientRect();
var spy = sinon.spy();
- var p = new L.Popup().setLatLng(new L.LatLng(55.8, 37.6));
+ var p = new L.Popup().setLatLng(center);
map.openPopup(p);
expect(map.hasLayer(p)).to.be(true);
map.on('drag', spy);
@@ -424,26 +413,38 @@ describe("L.Map#openPopup", function () {
.down().moveBy(10, 10, 20).up();
});
+ it('moves the map over a long distance to the popup if it is not in the view (keepInView)', function (done) {
+ c.style.position = 'absolute';
+ c.style.left = 0;
+ c.style.top = 0;
+ c.style.zIndex = 10000;
+
+ // to prevent waiting until the animation is finished
+ map.options.inertia = false;
+
+ var spy = sinon.spy();
+ map.on('autopanstart', spy);
+ var p = new L.Popup({keepInView: true}).setContent('Popup').setLatLng([center[0], center[1] + 50]);
+ map.openPopup(p);
+
+ setTimeout(function () {
+ expect(spy.called).to.be(true);
+ expect(map.getBounds().contains(p.getLatLng())).to.be(true);
+ done();
+ }, 800);
+ });
});
describe('L.Layer#_popup', function () {
- var c, map, marker;
+ beforeEach(setup);
+ afterEach(cleanup);
+
+ var marker;
beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6);
marker = L.marker(L.latLng(55.8, 37.6)).addTo(map);
});
- afterEach(function () {
- if (document.body.contains(c)) {
- document.body.removeChild(c);
- }
- });
-
it("only adds a popup to the map when opened", function () {
marker.bindPopup("new layer");
expect(map.hasLayer(marker.getPopup())).to.be(false);
@@ -489,8 +490,7 @@ describe('L.Layer#_popup', function () {
});
it('does not throw is popup is inmediately closed', function (done) {
-
- map.on('popupopen', function (ev) {
+ map.on('popupopen', function () {
marker.closePopup();
});
@@ -499,4 +499,51 @@ describe('L.Layer#_popup', function () {
done();
}).to.not.throwException();
});
+
+ it("does not close popup when clicking on it's tip", function () {
+ if (L.Browser.ie) { this.skip(); } // fixme
+ c.style.position = "absolute";
+ c.style.top = "0";
+ c.style.left = "0";
+ var popup = L.popup().setLatLng(map.getCenter())
+ .openOn(map);
+
+ var point = map.latLngToContainerPoint(map.getCenter());
+ point.y -= 2; // move mouse into the popup-tip
+ var el = document.elementFromPoint(point.x, point.y);
+ expect(el).to.be(popup._tip);
+
+ happen.click(el, {
+ clientX: point.x,
+ clientY: point.y
+ });
+ expect(popup.isOpen()).to.be.ok();
+ });
+
+ it("does not open for empty FeatureGroup", function () {
+ var popup = L.popup();
+ L.featureGroup([])
+ .addTo(map)
+ .bindPopup(popup)
+ .openPopup();
+
+ expect(map.hasLayer(popup)).to.not.be.ok();
+ });
+
+ it("uses only visible layers of FeatureGroup for popup content source", function () {
+ var marker1 = L.marker([1, 1]);
+ var marker2 = L.marker([2, 2]);
+ var marker3 = L.marker([3, 3]);
+ var popup = L.popup();
+ var group = L.featureGroup([marker1, marker2, marker3])
+ .bindPopup(popup)
+ .addTo(map);
+
+ marker1.remove();
+ marker3.remove();
+ group.openPopup();
+
+ expect(map.hasLayer(popup)).to.be.ok();
+ expect(popup._source).to.be(marker2);
+ });
});
diff --git a/spec/suites/layer/TooltipSpec.js b/spec/suites/layer/TooltipSpec.js
index be4d3447f89..b6aea553ad4 100644
--- a/spec/suites/layer/TooltipSpec.js
+++ b/spec/suites/layer/TooltipSpec.js
@@ -1,6 +1,5 @@
describe('Tooltip', function () {
-
- var c, map, p2ll,
+ var c, map,
center = [55.8, 37.6];
beforeEach(function () {
@@ -14,12 +13,10 @@ describe('Tooltip', function () {
document.body.appendChild(c);
map = new L.Map(c);
map.setView(center, 6);
- p2ll = function (x, y) {
- return map.layerPointToLatLng([x, y]);
- };
});
afterEach(function () {
+ map.remove();
document.body.removeChild(c);
});
@@ -71,6 +68,18 @@ describe('Tooltip', function () {
expect(spy.calledOnce).to.be(true);
});
+ it("has class leaflet-interactive", function () {
+ var layer = new L.Marker(center).addTo(map);
+ layer.bindTooltip('Tooltip', {permanent: true, interactive: true});
+ expect(L.DomUtil.hasClass(layer._tooltip._container, 'leaflet-interactive')).to.be(true);
+ });
+
+ it("has not class leaflet-interactive", function () {
+ var layer = new L.Marker(center).addTo(map);
+ layer.bindTooltip('Tooltip', {permanent: true});
+ expect(L.DomUtil.hasClass(layer._tooltip._container, 'leaflet-interactive')).to.be(false);
+ });
+
it("can be forced on left direction", function () {
var layer = new L.Marker(center).addTo(map);
var spy = sinon.spy();
@@ -168,8 +177,8 @@ describe('Tooltip', function () {
});
it("it should use a tooltip with a function as content with a FeatureGroup", function () {
- var marker1 = new L.Marker(new L.LatLng(55.8, 37.6), {description: "I'm marker 1."});
- var marker2 = new L.Marker(new L.LatLng(54.6, 38.2), {description: "I'm marker 2."});
+ var marker1 = new L.Marker([55.8, 37.6], {description: "I'm marker 1."});
+ var marker2 = new L.Marker([54.6, 38.2], {description: "I'm marker 2."});
var group = new L.FeatureGroup([marker1, marker2]).addTo(map);
group.bindTooltip(function (layer) {
@@ -281,11 +290,100 @@ describe('Tooltip', function () {
map.openTooltip('Tooltip', center);
});
+ it("map.openTooltip considers interactive option", function () {
+ if (!window.getComputedStyle) { this.skip(); } // IE9+
+
+ var tooltip = L.tooltip({interactive: true}).setContent('Tooltip');
+ map.openTooltip(tooltip, center);
+ expect(getComputedStyle(tooltip._container).pointerEvents).to.equal('auto');
+ });
+
it("can call closeTooltip while not on the map", function () {
var layer = new L.Marker(center);
layer.bindTooltip('Tooltip', {interactive: true});
layer.closeTooltip();
});
-});
+ it("opens a tooltip and follow the mouse (sticky)", function () {
+ var layer = L.rectangle([[58, 39.7], [54, 35.3]]).addTo(map);
+ layer.bindTooltip('Sticky', {sticky: true}).openTooltip();
+ var tooltip = layer.getTooltip();
+ expect(tooltip.getLatLng().equals(layer.getCenter())).to.be(true);
+ happen.at('click', 120, 120);
+ var latlng = map.containerPointToLatLng([120, 120]);
+ expect(tooltip.getLatLng().equals(latlng)).to.be(true);
+ });
+
+ it("opens a permanent tooltip and follow the mouse (sticky)", function (done) {
+ var layer = L.rectangle([[58, 39.7], [54, 35.3]]).addTo(map);
+ layer.bindTooltip('Sticky', {sticky: true, permanent: true}).openTooltip();
+ var tooltip = layer.getTooltip();
+ expect(tooltip.getLatLng().equals(layer.getCenter())).to.be(true);
+
+ var hand = new Hand({
+ timing: 'fastframe',
+ onStop: function () {
+ var latlng = map.containerPointToLatLng([120, 120]);
+ expect(tooltip.getLatLng().equals(latlng)).to.be(true);
+ done();
+ }
+ });
+ var toucher = hand.growFinger('mouse');
+ toucher.wait(100).moveTo(120, 120, 1000).wait(100);
+ });
+
+ it("closes existent tooltip on new bindTooltip call", function () {
+ var layer = new L.Marker(center).addTo(map);
+ var eventSpy = sinon.spy(layer, "unbindTooltip");
+ layer.bindTooltip('Tooltip1', {permanent: true});
+ var tooltip1 = layer.getTooltip();
+ layer.bindTooltip('Tooltip2').openTooltip();
+ layer.unbindTooltip.restore(); // unwrap the spy
+ expect(map.hasLayer(tooltip1)).to.not.be.ok();
+ expect(eventSpy.calledOnce).to.be.ok();
+ });
+
+ it("don't opens the tooltip on marker mouseover while dragging map", function () {
+ // Sometimes the mouse is moving faster then the map while dragging and then the marker can be hover and
+ // the tooltip opened / closed.
+ var layer = L.marker(center).addTo(map).bindTooltip('Tooltip');
+ var tooltip = layer.getTooltip();
+
+ // simulate map dragging
+ map.dragging.moving = function () {
+ return true;
+ };
+ happen.at('mouseover', 210, 195);
+ expect(tooltip.isOpen()).to.be(false);
+
+ // simulate map not dragging anymore
+ map.dragging.moving = function () {
+ return false;
+ };
+ happen.at('mouseover', 210, 195);
+ expect(tooltip.isOpen()).to.be.ok();
+ });
+
+ it("closes the tooltip on marker mouseout while dragging map and don't open it again", function () {
+ // Sometimes the mouse is moving faster then the map while dragging and then the marker can be hover and
+ // the tooltip opened / closed.
+ var layer = L.marker(center).addTo(map).bindTooltip('Tooltip');
+ var tooltip = layer.getTooltip();
+
+ // open tooltip before "dragging map"
+ happen.at('mouseover', 210, 195);
+ expect(tooltip.isOpen()).to.be.ok();
+
+ // simulate map dragging
+ map.dragging.moving = function () {
+ return true;
+ };
+ happen.mouseout(layer._icon, {relatedTarget: map._container});
+ expect(tooltip.isOpen()).to.be(false);
+
+ // tooltip should not open again while dragging
+ happen.at('mouseover', 210, 195);
+ expect(tooltip.isOpen()).to.be(false);
+ });
+});
diff --git a/spec/suites/layer/marker/Icon.DefaultSpec.js b/spec/suites/layer/marker/Icon.DefaultSpec.js
index 1c9666390c7..5994995eb88 100644
--- a/spec/suites/layer/marker/Icon.DefaultSpec.js
+++ b/spec/suites/layer/marker/Icon.DefaultSpec.js
@@ -1,33 +1,55 @@
describe("Icon.Default", function () {
+ var div, map;
- it("icon measures 25x41px", function () {
- var div = document.createElement('div');
+ beforeEach(function () {
+ div = document.createElement('div');
div.style.height = '100px';
document.body.appendChild(div);
+ map = L.map(div).setView([0, 0], 0);
+ L.marker([0, 0]).addTo(map);
+ });
- var map = L.map(div).setView([0, 0], 0);
+ afterEach(function () {
+ map.remove();
+ document.body.removeChild(div);
+ });
- var marker = new L.Marker([0, 0]).addTo(map);
+ it("detect icon images path", function () {
+ var origPath = L.Icon.Default.imagePath; // set in after.js
+ expect(origPath).to.be.ok();
+ delete L.Icon.Default.imagePath;
+ var marker = new L.Marker([0, 0]);
+
+ expect(L.Icon.Default.imagePath).to.not.be.ok();
+ marker.addTo(map);
+
+ // polyfill for IE<11
+ var origin = document.location.origin || window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
+ expect(L.Icon.Default.imagePath).to.equal(origin + origPath);
+
+ var stripUrl = L.Icon.Default.prototype._stripUrl;
+ var properPath = 'http://localhost:8000/base/dist/images/';
+ [ // valid
+ 'url("http://localhost:8000/base/dist/images/marker-icon.png")', // Firefox
+ "url('http://localhost:8000/base/dist/images/marker-icon.png')",
+ 'url(http://localhost:8000/base/dist/images/marker-icon.png)', // IE, Edge
+ ].map(stripUrl).forEach(function (str) { expect(str).to.be(properPath); });
+
+ [ // invalid
+ 'url("http://localhost:8000/base/dist/images/marker-icon.png?2x)"',
+ 'url("data:image/png;base64,iVBORw...")', // inline image (bundlers)
+ ].map(stripUrl).forEach(function (str) { expect(str).not.to.be.ok(); });
+ });
+ it("icon measures 25x41px", function () {
var img = map.getPane('markerPane').querySelector('img');
expect(img.clientHeight).to.be(41);
expect(img.clientWidth).to.be(25);
- document.body.removeChild(div);
});
it("shadow measures 41x41px", function () {
- var div = document.createElement('div');
- div.style.height = '100px';
- document.body.appendChild(div);
-
- var map = L.map(div).setView([0, 0], 0);
-
- var marker = new L.Marker([0, 0]).addTo(map);
-
var img = map.getPane('shadowPane').querySelector('img');
expect(img.clientHeight).to.be(41);
expect(img.clientWidth).to.be(41);
- document.body.removeChild(div);
});
-
});
diff --git a/spec/suites/layer/marker/Marker.DragSpec.js b/spec/suites/layer/marker/Marker.DragSpec.js
index 107f3296e48..72fea583658 100644
--- a/spec/suites/layer/marker/Marker.DragSpec.js
+++ b/spec/suites/layer/marker/Marker.DragSpec.js
@@ -13,6 +13,7 @@ describe("Marker.Drag", function () {
});
afterEach(function () {
+ map.remove();
document.body.removeChild(div);
});
@@ -20,8 +21,7 @@ describe("Marker.Drag", function () {
it("drags a marker with mouse", function (done) {
var marker = new L.Marker([0, 0], {
draggable: true
- });
- map.addLayer(marker);
+ }).addTo(map);
var hand = new Hand({
timing: 'fastframe',
@@ -55,16 +55,11 @@ describe("Marker.Drag", function () {
div.style.webkitTransform = 'scale(' + scaleX + ', ' + scaleY + ')';
});
- afterEach(function () {
- div.style.webkitTransformOrigin = '';
- div.style.webkitTransform = '';
- });
-
- it("drags a marker with mouse, compensating for CSS scale", function (done) {
+ // fixme IE
+ (L.Browser.ie ? it.skip : it)("drags a marker with mouse, compensating for CSS scale", function (done) {
var marker = new L.Marker([0, 0], {
draggable: true
- });
- map.addLayer(marker);
+ }).addTo(map);
var hand = new Hand({
timing: 'fastframe',
@@ -94,8 +89,7 @@ describe("Marker.Drag", function () {
var marker = new L.Marker([0, 0], {
draggable: true,
autoPan: true
- });
- map.addLayer(marker);
+ }).addTo(map);
var hand = new Hand({
timing: 'fastframe',
diff --git a/spec/suites/layer/marker/MarkerSpec.js b/spec/suites/layer/marker/MarkerSpec.js
index 63b9e306634..bfce336e70e 100644
--- a/spec/suites/layer/marker/MarkerSpec.js
+++ b/spec/suites/layer/marker/MarkerSpec.js
@@ -1,6 +1,5 @@
describe("Marker", function () {
var map,
- spy,
div,
icon1,
icon2;
@@ -19,6 +18,7 @@ describe("Marker", function () {
});
afterEach(function () {
+ map.remove();
document.body.removeChild(div);
});
@@ -139,7 +139,6 @@ describe("Marker", function () {
map.addLayer(marker);
marker.setIcon(new L.DivIcon());
- var afterIcon = marker._icon;
expect(marker._icon.innerHTML).to.not.contain('Inner1Text');
});
@@ -191,12 +190,12 @@ describe("Marker", function () {
expect(marker._shadow.parentNode).to.be(map._panes.shadowPane);
});
- it("sets the alt attribute to an empty string when no alt text is passed", function () {
+ it("sets the alt attribute to a default value when no alt text is passed", function () {
var marker = L.marker([0, 0], {icon: icon1});
map.addLayer(marker);
var icon = marker._icon;
expect(icon.hasAttribute('alt')).to.be(true);
- expect(icon.alt).to.be('');
+ expect(icon.alt).to.be('Marker');
});
it("doesn't set the alt attribute for DivIcons", function () {
@@ -328,6 +327,5 @@ describe("Marker", function () {
});
happen.mousemove(marker._icon);
});
-
});
});
diff --git a/spec/suites/layer/tile/GridLayerSpec.js b/spec/suites/layer/tile/GridLayerSpec.js
index 4698a7a3b6a..dd70c9081c0 100644
--- a/spec/suites/layer/tile/GridLayerSpec.js
+++ b/spec/suites/layer/tile/GridLayerSpec.js
@@ -1,6 +1,4 @@
-
describe('GridLayer', function () {
-
var div, map;
beforeEach(function () {
@@ -15,6 +13,7 @@ describe('GridLayer', function () {
});
afterEach(function () {
+ map.remove();
document.body.removeChild(div);
});
@@ -44,7 +43,6 @@ describe('GridLayer', function () {
});
it('positions tiles correctly with wrapping and bounding', function () {
-
map.setView([0, 0], 1);
var tiles = [];
@@ -107,7 +105,7 @@ describe('GridLayer', function () {
delete tiles[grid._tileCoordsToKey(e.coords)];
});
- grid.on('load', function (e) {
+ grid.on('load', function () {
if (Object.keys(tiles).length === 1) {
expect(Object.keys(tiles)).to.eql(['0:0:0']);
grid.off();
@@ -129,27 +127,21 @@ describe('GridLayer', function () {
div.style.width = '512px';
div.style.height = '512px';
- map.remove();
- map = L.map(div);
map.setView([0, 0], 10);
grid = L.gridLayer();
});
- afterEach(function () {
- div.style.width = '800px';
- div.style.height = '600px';
- });
-
// Passes on Firefox, but fails on phantomJS: done is never called.
it('only creates tiles for visible area on zoom in', function (done) {
+ map._zoomAnimated = false; // fixme https://github.com/Leaflet/Leaflet/issues/7116
var count = 0,
loadCount = 0;
- grid.createTile = function (coords) {
+ grid.createTile = function () {
count++;
return document.createElement('div');
};
- var onLoad = function (e) {
+ var onLoad = function () {
expect(count).to.eql(4);
count = 0;
loadCount++;
@@ -237,13 +229,15 @@ describe('GridLayer', function () {
});
describe("#getMaxZoom, #getMinZoom", function () {
- describe("when a tilelayer is added to a map with no other layers", function () {
- it("has the same zoomlevels as the tilelayer", function () {
+ beforeEach(function () {
+ map.setView([0, 0], 1);
+ });
+
+ describe("when a gridlayer is added to a map with no other layers", function () {
+ it("has the same zoomlevels as the gridlayer", function () {
var maxZoom = 10,
minZoom = 5;
- map.setView([0, 0], 1);
-
L.gridLayer({
maxZoom: maxZoom,
minZoom: minZoom
@@ -254,19 +248,15 @@ describe('GridLayer', function () {
});
});
- describe("accessing a tilelayer's properties", function () {
+ describe("accessing a gridlayer's properties", function () {
it('provides a container', function () {
- map.setView([0, 0], 1);
-
var layer = L.gridLayer().addTo(map);
expect(layer.getContainer()).to.be.ok();
});
});
- describe("when a tilelayer is added to a map that already has a tilelayer", function () {
+ describe("when a gridlayer is added to a map that already has a gridlayer", function () {
it("has its zoomlevels updated to fit the new layer", function () {
- map.setView([0, 0], 1);
-
L.gridLayer({minZoom: 10, maxZoom: 15}).addTo(map);
expect(map.getMinZoom()).to.be(10);
expect(map.getMaxZoom()).to.be(15);
@@ -294,31 +284,28 @@ describe('GridLayer', function () {
L.gridLayer({minZoom: 10, maxZoom: 20}).addTo(map),
L.gridLayer({minZoom: 0, maxZoom: 25}).addTo(map)
];
- map.whenReady(function () {
- expect(map.getMinZoom()).to.be(0);
- expect(map.getMaxZoom()).to.be(25);
+ expect(map.getMinZoom()).to.be(0);
+ expect(map.getMaxZoom()).to.be(25);
- map.removeLayer(tiles[0]);
- expect(map.getMinZoom()).to.be(0);
- expect(map.getMaxZoom()).to.be(25);
+ map.removeLayer(tiles[0]);
+ expect(map.getMinZoom()).to.be(0);
+ expect(map.getMaxZoom()).to.be(25);
- map.removeLayer(tiles[3]);
- expect(map.getMinZoom()).to.be(5);
- expect(map.getMaxZoom()).to.be(20);
+ map.removeLayer(tiles[3]);
+ expect(map.getMinZoom()).to.be(5);
+ expect(map.getMaxZoom()).to.be(20);
- map.removeLayer(tiles[2]);
- expect(map.getMinZoom()).to.be(5);
- expect(map.getMaxZoom()).to.be(10);
+ map.removeLayer(tiles[2]);
+ expect(map.getMinZoom()).to.be(5);
+ expect(map.getMaxZoom()).to.be(10);
- map.removeLayer(tiles[1]);
- expect(map.getMinZoom()).to.be(0);
- expect(map.getMaxZoom()).to.be(Infinity);
- });
+ map.removeLayer(tiles[1]);
+ expect(map.getMinZoom()).to.be(0);
+ expect(map.getMaxZoom()).to.be(Infinity);
});
});
});
-
describe("min/maxNativeZoom option", function () {
it("calls createTile() with maxNativeZoom when map zoom is larger", function (done) {
map.setView([0, 0], 10);
@@ -367,6 +354,18 @@ describe('GridLayer', function () {
map.addLayer(grid);
});
+
+ it("redraws tiles properly after changing maxNativeZoom", function () {
+ var initialZoom = 12;
+ map.setView([0, 0], initialZoom);
+
+ var grid = L.gridLayer().addTo(map);
+ expect(grid._tileZoom).to.be(initialZoom);
+
+ grid.options.maxNativeZoom = 11;
+ grid.redraw();
+ expect(grid._tileZoom).to.be(11);
+ });
});
describe("number of 256px tiles loaded in synchronous non-animated grid @800x600px", function () {
@@ -414,7 +413,6 @@ describe('GridLayer', function () {
});
it("Loads 8 tiles zoom 1", function (done) {
-
grid.on('load', function () {
expect(counts.tileloadstart).to.be(8);
expect(counts.tileload).to.be(8);
@@ -427,7 +425,6 @@ describe('GridLayer', function () {
});
it("Loads 5 tiles zoom 0", function (done) {
-
grid.on('load', function () {
expect(counts.tileloadstart).to.be(5);
expect(counts.tileload).to.be(5);
@@ -440,7 +437,6 @@ describe('GridLayer', function () {
});
it("Loads 16 tiles zoom 10", function (done) {
-
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@@ -455,7 +451,6 @@ describe('GridLayer', function () {
});
it("Loads 32, unloads 16 tiles zooming in 10-11", function (done) {
-
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@@ -479,7 +474,6 @@ describe('GridLayer', function () {
});
it("Loads 32, unloads 16 tiles zooming out 11-10", function (done) {
-
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@@ -502,9 +496,7 @@ describe('GridLayer', function () {
clock.tick(250);
});
-
it("Loads 32, unloads 16 tiles zooming out 18-10", function (done) {
-
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@@ -522,16 +514,12 @@ describe('GridLayer', function () {
clock.tick(250);
});
-
map.addLayer(grid).setView([0, 0], 18);
clock.tick(250);
});
-
});
-
describe("number of 256px tiles loaded in synchronous animated grid @800x600px", function () {
-
var clock, grid, counts;
beforeEach(function () {
@@ -569,6 +557,7 @@ describe('GridLayer', function () {
});
// Debug helper
+ /*
function logTiles(ev) {
var pending = 0;
for (var key in grid._tiles) {
@@ -576,7 +565,7 @@ describe('GridLayer', function () {
}
console.log(ev.type + ': ', ev.coords, grid._loading, counts, ' pending: ', pending);
}
-
+ */
// animationFrame helper, just runs requestAnimFrame() a given number of times
function runFrames(n) {
@@ -597,8 +586,7 @@ describe('GridLayer', function () {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
- it.skipInPhantom("Loads 32, unloads 16 tiles zooming in 10-11", function (done) {
-
+ it.skipIfNo3d("Loads 32, unloads 16 tiles zooming in 10-11", function (done) {
// Advance the time to !== 0 otherwise `tile.loaded` timestamp will appear to be falsy.
clock.tick(1);
// Date.now() is 1.
@@ -708,8 +696,7 @@ describe('GridLayer', function () {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
- it.skipInPhantom("Loads 32, unloads 16 tiles zooming out 11-10", function (done) {
-
+ it.skipIfNo3d("Loads 32, unloads 16 tiles zooming out 11-10", function (done) {
// Advance the time to !== 0 otherwise `tile.loaded` timestamp will appear to be falsy.
clock.tick(1);
// Date.now() is 1.
@@ -783,7 +770,6 @@ describe('GridLayer', function () {
});
it("Loads 32, unloads 16 tiles zooming out 18-10", function (done) {
-
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@@ -812,8 +798,7 @@ describe('GridLayer', function () {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
- it.skipInPhantom("Loads 290, unloads 275 tiles on MAD-TRD flyTo()", function (done) {
-
+ it.skipIfNo3d("Loads 290, unloads 275 tiles on MAD-TRD flyTo()", function (done) {
this.timeout(10000); // This test takes longer than usual due to frames
var mad = [40.40, -3.7], trd = [63.41, 10.41];
@@ -896,7 +881,6 @@ describe('GridLayer', function () {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it("Loads map, moves forth by 512 px, keepBuffer = 0", function (done) {
-
// Advance the time to !== 0 otherwise `tile.loaded` timestamp will appear to be falsy.
clock.tick(1);
// Date.now() is 1.
@@ -944,7 +928,6 @@ describe('GridLayer', function () {
// OOOO
map.panBy([512, 512], {animate: false});
// clock.tick(250);
-
});
});
@@ -958,7 +941,6 @@ describe('GridLayer', function () {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it("Loads map, moves forth and back by 512 px, keepBuffer = 0", function (done) {
-
grid.once('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@@ -1003,7 +985,6 @@ describe('GridLayer', function () {
});
it("Loads map, moves forth and back by 512 px, default keepBuffer", function (done) {
-
var spy = sinon.spy();
grid.on('load', function () {
@@ -1038,7 +1019,6 @@ describe('GridLayer', function () {
describe("nowrap option", function () {
it("When false, uses same coords at zoom 0 for all tiles", function (done) {
-
var grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
@@ -1060,7 +1040,6 @@ describe('GridLayer', function () {
});
it("When true, uses different coords at zoom level 0 for all tiles", function (done) {
-
var grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
@@ -1082,7 +1061,6 @@ describe('GridLayer', function () {
});
it("When true and with bounds, loads just one tile at zoom level 0", function (done) {
-
var grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
diff --git a/spec/suites/layer/tile/TileLayerSpec.js b/spec/suites/layer/tile/TileLayerSpec.js
index 2f1c032d408..84fde9ef1eb 100644
--- a/spec/suites/layer/tile/TileLayerSpec.js
+++ b/spec/suites/layer/tile/TileLayerSpec.js
@@ -1,10 +1,7 @@
-
-
describe('TileLayer', function () {
-
var div, map;
- // Placekitten via http://placekitten.com/attribution.html
+ // Placekitten via https://placekitten.com/attribution.html
// Image licensed under CC-by-sa by http://flickr.com/photos/lachlanrogers/
var placeKitten = "data:image/jpeg;base64," +
@@ -166,16 +163,13 @@ describe('TileLayer', function () {
div.style.width = '800px';
div.style.height = '600px';
div.style.visibility = 'hidden';
-
document.body.appendChild(div);
-
map = L.map(div);
});
afterEach(function () {
- if (div) {
- document.body.removeChild(div);
- }
+ map.remove();
+ document.body.removeChild(div);
});
function kittenLayerFactory(options) {
@@ -192,7 +186,6 @@ describe('TileLayer', function () {
}
describe("number of kittens loaded", function () {
-
var clock, kittenLayer, counts;
// animationFrame helper, just runs requestAnimFrame() a given number of times
@@ -244,7 +237,6 @@ describe('TileLayer', function () {
});
it("Loads 8 kittens zoom 1", function (done) {
-
kittenLayer.on('load', function () {
expect(counts.tileloadstart).to.be(8);
expect(counts.tileload).to.be(8);
@@ -257,11 +249,9 @@ describe('TileLayer', function () {
clock.tick(250);
});
-
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
- it.skipInPhantom("Loads 290, unloads 275 kittens on MAD-TRD flyTo()", function (done) {
-
+ it.skipIfNo3d("Loads 290, unloads 275 kittens on MAD-TRD flyTo()", function (done) {
this.timeout(10000); // This test takes longer than usual due to frames
var mad = [40.40, -3.7], trd = [63.41, 10.41];
@@ -300,14 +290,9 @@ describe('TileLayer', function () {
describe('url template', function () {
beforeEach(function () {
- div = document.createElement('div');
div.style.width = '400px';
div.style.height = '400px';
- div.style.visibility = 'hidden';
-
- document.body.appendChild(div);
-
- map = L.map(div).setView([0, 0], 2);
+ map.setView([0, 0], 2);
});
it('replaces {y} with y coordinate', function () {
@@ -422,19 +407,10 @@ describe('TileLayer', function () {
});
- describe('options', function () {
-
+ var _describe = 'crossOrigin' in L.DomUtil.create('img') ? describe : describe.skip; // skip in IE<11
+ _describe('crossOrigin option', function () {
beforeEach(function () {
- div = document.createElement('div');
- div.style.width = '400px';
- div.style.height = '400px';
-
- map = L.map(div).setView([0, 0], 2);
- });
-
- afterEach(function () {
- map = null;
- div = null;
+ map.setView([0, 0], 2);
});
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes
diff --git a/spec/suites/layer/vector/CanvasSpec.js b/spec/suites/layer/vector/CanvasSpec.js
index 3d03491765b..5faeaad1402 100644
--- a/spec/suites/layer/vector/CanvasSpec.js
+++ b/spec/suites/layer/vector/CanvasSpec.js
@@ -1,8 +1,12 @@
describe('Canvas', function () {
+ document.body.appendChild(document.createElement('div'));
+ var c, map, latLngs;
- var c, map, p2ll, latLngs;
+ function p2ll(x, y) {
+ return map.layerPointToLatLng([x, y]);
+ }
- before(function () {
+ beforeEach(function () {
c = document.createElement('div');
c.style.width = '400px';
c.style.height = '400px';
@@ -12,13 +16,13 @@ describe('Canvas', function () {
document.body.appendChild(c);
map = new L.Map(c, {preferCanvas: true, zoomControl: false});
map.setView([0, 0], 6);
- p2ll = function (x, y) {
- return map.layerPointToLatLng([x, y]);
- };
latLngs = [p2ll(0, 0), p2ll(0, 100), p2ll(100, 100), p2ll(100, 0)];
});
- after(function () {
+ afterEach(function () {
+ if (map._conteiner_id) {
+ map.remove();
+ }
document.body.removeChild(c);
});
@@ -29,10 +33,6 @@ describe('Canvas', function () {
layer = L.polygon(latLngs).addTo(map);
});
- afterEach(function () {
- layer.remove();
- });
-
it("should fire event when layer contains mouse", function () {
var spy = sinon.spy();
layer.on('click', spy);
@@ -40,7 +40,6 @@ describe('Canvas', function () {
expect(spy.callCount).to.eql(1);
happen.at('click', 150, 150); // Click outside layer.
expect(spy.callCount).to.eql(1);
- layer.off("click", spy);
});
it("DOM events propagate from canvas polygon to map", function () {
@@ -48,7 +47,6 @@ describe('Canvas', function () {
map.on("click", spy);
happen.at('click', 50, 50);
expect(spy.callCount).to.eql(1);
- map.off("click", spy);
});
it("DOM events fired on canvas polygon can be cancelled before being caught by the map", function () {
@@ -59,18 +57,48 @@ describe('Canvas', function () {
happen.at('click', 50, 50);
expect(layerSpy.callCount).to.eql(1);
expect(mapSpy.callCount).to.eql(0);
- map.off("click", mapSpy);
- layer.off("click", L.DomEvent.stopPropagation).off("click", layerSpy);
});
it("DOM events fired on canvas polygon are propagated only once to the map even when two layers contains the event", function () {
var spy = sinon.spy();
- var layer2 = L.polygon(latLngs).addTo(map);
+ L.polygon(latLngs).addTo(map); // layer 2
map.on("click", spy);
happen.at('click', 50, 50);
expect(spy.callCount).to.eql(1);
- layer2.remove();
- map.off("click", spy);
+ });
+
+ it("should be transparent for DOM events going to non-canvas features", function () {
+ var marker = L.marker(map.layerPointToLatLng([150, 150]))
+ .addTo(map);
+ var circle = L.circle(map.layerPointToLatLng([200, 200]), {
+ radius: 20000,
+ renderer: L.svg()
+ }).addTo(map);
+
+ var spyPolygon = sinon.spy();
+ var spyMap = sinon.spy();
+ var spyMarker = sinon.spy();
+ var spyCircle = sinon.spy();
+ layer.on("click", spyPolygon);
+ map.on("click", spyMap);
+ marker.on("click", spyMarker);
+ circle.on("click", spyCircle);
+
+ happen.at('click', 50, 50); // polygon (canvas)
+ happen.at('click', 151, 151); // empty space
+ happen.at('click', 150, 148); // marker
+ happen.at('click', 200, 200); // circle (svg)
+ expect(spyPolygon.callCount).to.eql(1);
+ expect(spyMap.callCount).to.eql(3); // except marker
+ expect(spyMarker.callCount).to.eql(1);
+ expect(spyCircle.callCount).to.eql(1);
+ });
+
+ it("should not block mousemove event going to non-canvas features", function () {
+ var spyMap = sinon.spy();
+ map.on("mousemove", spyMap);
+ happen.at('mousemove', 151, 151); // empty space
+ expect(spyMap.calledOnce).to.be.ok();
});
it("should fire preclick before click", function () {
@@ -78,7 +106,7 @@ describe('Canvas', function () {
var preclickSpy = sinon.spy();
layer.on('click', clickSpy);
layer.on('preclick', preclickSpy);
- layer.once('preclick', function (e) {
+ layer.once('preclick', function () {
expect(clickSpy.called).to.be(false);
});
happen.at('click', 50, 50); // Click on the layer.
@@ -87,7 +115,6 @@ describe('Canvas', function () {
happen.at('click', 150, 150); // Click outside layer.
expect(clickSpy.callCount).to.eql(1);
expect(preclickSpy.callCount).to.eql(1);
- layer.off();
});
it("should not fire click when dragging the map on top of it", function (done) {
@@ -106,7 +133,6 @@ describe('Canvas', function () {
expect(downSpy.called).to.be(true);
expect(clickSpy.called).to.be(false);
expect(preclickSpy.called).to.be(false);
- layer.off();
done();
}
});
@@ -118,37 +144,46 @@ describe('Canvas', function () {
.down().moveBy(20, 10, 200).up();
});
- });
-
- describe("#events(interactive=false)", function () {
- var layer;
+ it("does fire mousedown on layer after dragging map", function (done) { // #7775
+ var spy = sinon.spy();
+ var circle = L.circle(p2ll(300, 300)).addTo(map);
+ circle.on('mousedown', spy);
- beforeEach(function () {
- layer = L.polygon(latLngs, {interactive: false}).addTo(map);
- });
+ var hand = new Hand({
+ timing: 'fastframe',
+ onStop: function () {
+ expect(spy.callCount).to.eql(2);
+ done();
+ }
+ });
+ var mouse = hand.growFinger('mouse');
- afterEach(function () {
- layer.remove();
+ mouse.wait(100)
+ .moveTo(300, 300, 0).down().moveBy(5, 0, 20).up()
+ .moveTo(100, 100, 0).down().moveBy(5, 0, 20).up()
+ .moveTo(300, 300, 0).down().moveBy(5, 0, 20).up();
});
+ });
+ describe("#events(interactive=false)", function () {
it("should not fire click when not interactive", function () {
+ var layer = L.polygon(latLngs, {interactive: false}).addTo(map);
var spy = sinon.spy();
layer.on('click', spy);
happen.at('click', 50, 50); // Click on the layer.
expect(spy.callCount).to.eql(0);
happen.at('click', 150, 150); // Click outside layer.
expect(spy.callCount).to.eql(0);
- layer.off("click", spy);
});
-
});
describe('#dashArray', function () {
it('can add polyline with dashArray', function () {
- var layer = L.polygon(latLngs, {
+ L.polygon(latLngs, {
dashArray: "5,5"
}).addTo(map);
});
+
it('can setStyle with dashArray', function () {
var layer = L.polygon(latLngs).addTo(map);
layer.setStyle({
@@ -162,12 +197,12 @@ describe('Canvas', function () {
layerId = L.stamp(layer),
canvas = map.getRenderer(layer);
- expect(canvas._layers.hasOwnProperty(layerId)).to.be(true);
+ expect(canvas._layers).to.have.property(layerId);
map.removeLayer(layer);
// Defer check due to how Canvas renderer manages layer removal.
L.Util.requestAnimFrame(function () {
- expect(canvas._layers.hasOwnProperty(layerId)).to.be(false);
+ expect(canvas._layers).to.not.have.property(layerId);
done();
}, this);
});
@@ -177,35 +212,19 @@ describe('Canvas', function () {
layerId = L.stamp(layer),
canvas = map.getRenderer(layer);
- expect(canvas._layers.hasOwnProperty(layerId)).to.be(true);
+ expect(canvas._layers).to.have.property(layerId);
map.removeLayer(layer);
map.addLayer(layer);
- expect(canvas._layers.hasOwnProperty(layerId)).to.be(true);
+ expect(canvas._layers).to.have.property(layerId);
// Re-perform a deferred check due to how Canvas renderer manages layer removal.
L.Util.requestAnimFrame(function () {
- expect(canvas._layers.hasOwnProperty(layerId)).to.be(true);
+ expect(canvas._layers).to.have.property(layerId);
done();
}, this);
});
describe('#bringToBack', function () {
-
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c, {preferCanvas: true});
- map.setView(new L.LatLng(0, 0), 0);
- document.body.appendChild(c);
- });
-
- afterEach(function () {
- document.body.removeChild(c);
- });
-
it('is a no-op for layers not on a map', function () {
var path = new L.Polyline([[1, 2], [3, 4], [5, 6]]);
expect(path.bringToBack()).to.equal(path);
@@ -221,23 +240,7 @@ describe('Canvas', function () {
});
});
-
describe('#bringToFront', function () {
-
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c, {preferCanvas: true});
- map.setView(new L.LatLng(0, 0), 0);
- document.body.appendChild(c);
- });
-
- afterEach(function () {
- document.body.removeChild(c);
- });
it('is a no-op for layers not on a map', function () {
var path = new L.Polyline([[1, 2], [3, 4], [5, 6]]);
expect(path.bringToFront()).to.equal(path);
@@ -252,50 +255,25 @@ describe('Canvas', function () {
expect(path.bringToFront()).to.equal(path);
});
});
-});
-
-describe('Canvas remove', function () {
- var c;
-
- before(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- c.style.position = 'absolute';
- c.style.top = '0';
- c.style.left = '0';
- document.body.appendChild(c);
- });
-
- after(function () {
- document.body.removeChild(c);
- });
+ describe('Canvas #remove', function () {
+ it("can remove the map without errors", function (done) {
+ L.polygon(latLngs).addTo(map);
+ map.remove();
+ L.Util.requestAnimFrame(function () { done(); });
+ });
- function createCanvasMap(c, options) {
- var map = new L.Map(c, options);
- map.setView([0, 0], 6);
- var p2ll = function (x, y) {
- return map.layerPointToLatLng([x, y]);
- };
- var latLngs = [p2ll(0, 0), p2ll(0, 100), p2ll(100, 100), p2ll(100, 0)];
- var layer = L.polygon(latLngs).addTo(map);
- return map;
- }
+ it("can remove renderer without errors", function (done) {
+ map.remove();
- it("can remove the map without errors", function (done) {
- var map1 = createCanvasMap(c, {preferCanvas: true, zoomControl: false});
- map1.remove();
- L.Util.requestAnimFrame(function () { done(); });
- });
+ var canvas = L.canvas();
+ map = L.map(c, {renderer: canvas});
+ map.setView([0, 0], 6);
+ L.polygon(latLngs).addTo(map);
- it("can remove renderer without errors", function (done) {
- var canvas = L.canvas();
- var map = createCanvasMap(c, {renderer: canvas, zoomControl: false});
- canvas.remove();
- map.remove();
- L.Util.requestAnimFrame(function () { done(); });
+ canvas.remove();
+ map.remove();
+ L.Util.requestAnimFrame(function () { done(); });
+ });
});
-
});
-
diff --git a/spec/suites/layer/vector/CircleMarkerSpec.js b/spec/suites/layer/vector/CircleMarkerSpec.js
index 11094392da1..2a6a85cbadd 100644
--- a/spec/suites/layer/vector/CircleMarkerSpec.js
+++ b/spec/suites/layer/vector/CircleMarkerSpec.js
@@ -1,10 +1,16 @@
describe('CircleMarker', function () {
+ var map;
+
+ beforeEach(function () {
+ map = L.map(document.createElement('div'));
+ map.setView([0, 0], 1);
+ });
+
+ afterEach(function () {
+ map.remove();
+ });
+
describe("#_radius", function () {
- var map;
- beforeEach(function () {
- map = L.map(document.createElement('div'));
- map.setView([0, 0], 1);
- });
describe("when a CircleMarker is added to the map ", function () {
describe("with a radius set as an option", function () {
it("takes that radius", function () {
@@ -40,6 +46,7 @@
expect(marker._radius).to.be(15);
});
});
+
describe("and setStyle is used to change the radius before adding", function () {
it("takes the given radius", function () {
var marker = L.circleMarker([0, 0], {radius: 20});
@@ -50,4 +57,26 @@
});
});
});
+
+ describe("#setLatLng", function () {
+ it("fires a move event", function () {
+ var marker = new L.CircleMarker([0, 0]);
+ map.addLayer(marker);
+
+ var beforeLatLng = marker._latlng;
+ var afterLatLng = new L.LatLng(1, 2);
+
+ var eventArgs = null;
+ marker.on('move', function (e) {
+ eventArgs = e;
+ });
+
+ marker.setLatLng(afterLatLng);
+
+ expect(eventArgs).to.not.be(null);
+ expect(eventArgs.oldLatLng).to.be(beforeLatLng);
+ expect(eventArgs.latlng).to.be(afterLatLng);
+ expect(marker.getLatLng()).to.be(afterLatLng);
+ });
+ });
});
diff --git a/spec/suites/layer/vector/CircleSpec.js b/spec/suites/layer/vector/CircleSpec.js
index 65d4a349ce9..9a00e4c7c7f 100644
--- a/spec/suites/layer/vector/CircleSpec.js
+++ b/spec/suites/layer/vector/CircleSpec.js
@@ -1,7 +1,16 @@
describe('Circle', function () {
+ var map, circle;
- describe('#init', function () {
+ beforeEach(function () {
+ map = L.map(document.createElement('div')).setView([0, 0], 4);
+ circle = L.circle([50, 30], {radius: 200}).addTo(map);
+ });
+
+ afterEach(function () {
+ map.remove();
+ });
+ describe('#init', function () {
it('uses default radius if not given', function () {
var circle = L.circle([0, 0]);
expect(circle.getRadius()).to.eql(10);
@@ -16,37 +25,20 @@ describe('Circle', function () {
});
describe('#getBounds', function () {
-
- var map, circle;
-
- beforeEach(function () {
- map = L.map(document.createElement('div')).setView([0, 0], 4);
- circle = L.circle([50, 30], {radius: 200}).addTo(map);
- });
-
it('returns bounds', function () {
var bounds = circle.getBounds();
- expect(bounds.getSouthWest()).nearLatLng(new L.LatLng(49.99820, 29.99720));
- expect(bounds.getNorthEast()).nearLatLng(new L.LatLng(50.00179, 30.00279));
+ expect(bounds.getSouthWest()).nearLatLng([49.99820, 29.99720]);
+ expect(bounds.getNorthEast()).nearLatLng([50.00179, 30.00279]);
});
});
describe('Legacy factory', function () {
-
- var map, circle;
-
- beforeEach(function () {
- map = L.map(document.createElement('div')).setView([0, 0], 4);
- circle = L.circle([50, 30], 200).addTo(map);
- });
-
it('returns same bounds as 1.0 factory', function () {
var bounds = circle.getBounds();
- expect(bounds.getSouthWest()).nearLatLng(new L.LatLng(49.99820, 29.99720));
- expect(bounds.getNorthEast()).nearLatLng(new L.LatLng(50.00179, 30.00279));
+ expect(bounds.getSouthWest()).nearLatLng([49.99820, 29.99720]);
+ expect(bounds.getNorthEast()).nearLatLng([50.00179, 30.00279]);
});
});
-
});
diff --git a/spec/suites/layer/vector/PathSpec.js b/spec/suites/layer/vector/PathSpec.js
index ee35c1a1a22..2a31563bd4c 100644
--- a/spec/suites/layer/vector/PathSpec.js
+++ b/spec/suites/layer/vector/PathSpec.js
@@ -1,23 +1,23 @@
describe('Path', function () {
+ var c, map;
+
+ beforeEach(function () {
+ c = document.createElement('div');
+ c.style.width = '400px';
+ c.style.height = '400px';
+ map = new L.Map(c);
+ map.setView(new L.LatLng(0, 0), 0);
+ document.body.appendChild(c);
+ });
+
+ afterEach(function () {
+ map.remove();
+ document.body.removeChild(c);
+ });
// The following two tests are skipped, as the ES6-ifycation of Leaflet
// means that L.Path is no longer visible.
describe('#bringToBack', function () {
-
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c);
- map.setView(new L.LatLng(0, 0), 0);
- document.body.appendChild(c);
- });
-
- afterEach(function () {
- document.body.removeChild(c);
- });
it('is a no-op for layers not on a map', function () {
var path = new L.Polyline([[1, 2], [3, 4], [5, 6]]);
expect(path.bringToBack()).to.equal(path);
@@ -34,21 +34,6 @@ describe('Path', function () {
});
describe('#bringToFront', function () {
-
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c);
- map.setView(new L.LatLng(0, 0), 0);
- document.body.appendChild(c);
- });
-
- afterEach(function () {
- document.body.removeChild(c);
- });
it('is a no-op for layers not on a map', function () {
var path = new L.Polyline([[1, 2], [3, 4], [5, 6]]);
expect(path.bringToFront()).to.equal(path);
@@ -65,22 +50,6 @@ describe('Path', function () {
});
describe('#events', function () {
-
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c);
- map.setView(new L.LatLng(0, 0), 0);
- document.body.appendChild(c);
- });
-
- afterEach(function () {
- document.body.removeChild(c);
- });
-
it('fires click event', function () {
var spy = sinon.spy();
var layer = new L.Polygon([[1, 2], [3, 4], [5, 6]]).addTo(map);
@@ -130,13 +99,13 @@ describe('Path', function () {
it('it should return tolerance with stroke', function () {
var path = new L.Polyline([[1, 2], [3, 4], [5, 6]]);
- var layer = path.addTo(map);
+ path.addTo(map);
expect(path._clickTolerance()).to.equal(path.options.weight / 2);
});
it('it should return zero tolerance without stroke', function () {
var path = new L.Polyline([[1, 2], [3, 4], [5, 6]]);
- var layer = path.addTo(map);
+ path.addTo(map);
path.options.stroke = false;
expect(path._clickTolerance()).to.equal(0);
});
diff --git a/spec/suites/layer/vector/PolygonSpec.js b/spec/suites/layer/vector/PolygonSpec.js
index 05b97da9845..1518fe71a12 100644
--- a/spec/suites/layer/vector/PolygonSpec.js
+++ b/spec/suites/layer/vector/PolygonSpec.js
@@ -1,10 +1,13 @@
describe('Polygon', function () {
+ var map;
- var c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- var map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6);
+ before(function () {
+ map = new L.Map(document.createElement('div'), {center: [55.8, 37.6], zoom: 6});
+ });
+
+ after(function () {
+ map.remove();
+ });
describe("#initialize", function () {
it("should never be flat", function () {
@@ -67,7 +70,8 @@ describe('Polygon', function () {
it("can be added to the map when empty", function () {
var polygon = new L.Polygon([]).addTo(map);
- expect(map.hasLayer(polygon)).to.be(true);
+ var isAdded = map.hasLayer(polygon);
+ expect(isAdded).to.be(true);
});
});
@@ -144,13 +148,12 @@ describe('Polygon', function () {
});
describe('#getCenter', function () {
-
it('should compute center of a big simple polygon around equator', function () {
var latlngs = [
[[0, 0], [10, 0], [10, 10], [0, 10]]
];
var layer = new L.Polygon(latlngs).addTo(map);
- expect(layer.getCenter()).to.be.nearLatLng(L.latLng([5, 5]), 1e-1);
+ expect(layer.getCenter()).to.be.nearLatLng([5, 5], 1e-1);
});
it('should compute center of a small simple polygon', function () {
@@ -159,7 +162,7 @@ describe('Polygon', function () {
];
var layer = new L.Polygon(latlngs).addTo(map);
map.setZoom(0); // Make the polygon disappear in screen.
- expect(layer.getCenter()).to.be.nearLatLng(L.latLng([0, 0]));
+ expect(layer.getCenter()).to.be.nearLatLng([0, 0]);
});
it('throws error if not yet added to map', function () {
@@ -168,14 +171,13 @@ describe('Polygon', function () {
[[0, 0], [10, 0], [10, 10], [0, 10]]
];
var layer = new L.Polygon(latlngs);
- var center = layer.getCenter();
+ layer.getCenter();
}).to.throwException('Must add layer to map before using getCenter()');
});
});
describe("#_defaultShape", function () {
-
it("should return latlngs on a simple polygon", function () {
var latlngs = [
L.latLng([1, 2]),
@@ -220,7 +222,6 @@ describe('Polygon', function () {
expect(polygon._defaultShape()).to.eql(latlngs[0][0]);
});
-
});
describe("#addLatLng", function () {
@@ -322,7 +323,21 @@ describe('Polygon', function () {
expect(polygon._latlngs[1][0]).to.eql([L.latLng([0, 10]), L.latLng([10, 10]), L.latLng([10, 0])]);
expect(polygon._latlngs[1][1]).to.eql([L.latLng([2, 3]), L.latLng([2, 4]), L.latLng([3, 4]), L.latLng([2, 2])]);
});
-
});
+ describe("#setStyle", function () {
+ it("succeeds for empty Polygon already added to the map", function () {
+ var style = {
+ weight: 3
+ };
+ var polygon = L.polygon([]);
+
+ polygon.addTo(map);
+ polygon.setStyle(style);
+
+ for (var prop in style) {
+ expect(polygon.options[prop]).to.be(style[prop]);
+ }
+ });
+ });
});
diff --git a/spec/suites/layer/vector/PolylineGeometrySpec.js b/spec/suites/layer/vector/PolylineGeometrySpec.js
index 02fa07677f0..939c89c01c4 100644
--- a/spec/suites/layer/vector/PolylineGeometrySpec.js
+++ b/spec/suites/layer/vector/PolylineGeometrySpec.js
@@ -1,10 +1,9 @@
describe('PolylineGeometry', function () {
+ var map = new L.Map(document.createElement('div'), {center: [55.8, 37.6], zoom: 6});
- var c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- var map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6);
+ after(function () {
+ map.remove();
+ });
describe("#distanceTo", function () {
it("calculates distances to points", function () {
@@ -36,8 +35,6 @@ describe('PolylineGeometry', function () {
describe('LineUtil', function () {
describe('#isFlat', function () {
- var layer = L.polyline([]);
-
it('should return true for an array of LatLngs', function () {
expect(L.LineUtil.isFlat([L.latLng([0, 0])])).to.be(true);
});
diff --git a/spec/suites/layer/vector/PolylineSpec.js b/spec/suites/layer/vector/PolylineSpec.js
index a4b7ba382ef..b0835fd6e1b 100644
--- a/spec/suites/layer/vector/PolylineSpec.js
+++ b/spec/suites/layer/vector/PolylineSpec.js
@@ -1,10 +1,13 @@
describe('Polyline', function () {
+ var map;
- var c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- var map = new L.Map(c);
- map.setView(new L.LatLng(55.8, 37.6), 6);
+ before(function () {
+ map = new L.Map(document.createElement('div'), {center: [55.8, 37.6], zoom: 6});
+ });
+
+ after(function () {
+ map.remove();
+ });
describe("#initialize", function () {
it("doesn't overwrite the given latlng array", function () {
@@ -35,7 +38,6 @@ describe('Polyline', function () {
});
it("should accept an empty array", function () {
-
var polyline = new L.Polyline([]);
expect(polyline._latlngs).to.eql([]);
@@ -50,7 +52,6 @@ describe('Polyline', function () {
});
describe("#isEmpty", function () {
-
it('should return true for a polyline with no latlngs', function () {
var polyline = new L.Polyline([]);
expect(polyline.isEmpty()).to.be(true);
@@ -103,7 +104,6 @@ describe('Polyline', function () {
});
describe('#getCenter', function () {
-
it('should compute center of a big flat line on equator', function () {
var polyline = new L.Polyline([[0, 0], [0, 90]]).addTo(map);
expect(polyline.getCenter()).to.eql(L.latLng([0, 45]));
@@ -111,42 +111,40 @@ describe('Polyline', function () {
it('should compute center of a big flat line close to the pole', function () {
var polyline = new L.Polyline([[80, 0], [80, 90]]).addTo(map);
- expect(polyline.getCenter()).to.be.nearLatLng(L.latLng([80, 45]), 1e-2);
+ expect(polyline.getCenter()).to.be.nearLatLng([80, 45], 1e-2);
});
it('should compute center of a big diagonal line', function () {
var polyline = new L.Polyline([[0, 0], [80, 80]]).addTo(map);
- expect(polyline.getCenter()).to.be.nearLatLng(L.latLng([57, 40]), 1);
+ expect(polyline.getCenter()).to.be.nearLatLng([57, 40], 1);
});
it('should compute center of a diagonal line close to the pole', function () {
var polyline = new L.Polyline([[70, 70], [84, 84]]).addTo(map);
- expect(polyline.getCenter()).to.be.nearLatLng(L.latLng([79, 77]), 1);
+ expect(polyline.getCenter()).to.be.nearLatLng([79, 77], 1);
});
it('should compute center of a big multiline', function () {
var polyline = new L.Polyline([[10, -80], [0, 0], [0, 10], [10, 90]]).addTo(map);
- expect(polyline.getCenter()).to.be.nearLatLng(L.latLng([0, 5]), 1);
+ expect(polyline.getCenter()).to.be.nearLatLng([0, 5], 1);
});
it('should compute center of a small flat line', function () {
var polyline = new L.Polyline([[0, 0], [0, 0.090]]).addTo(map);
map.setZoom(0); // Make the line disappear in screen;
- expect(polyline.getCenter()).to.be.nearLatLng(L.latLng([0, 0]), 1e-2);
+ expect(polyline.getCenter()).to.be.nearLatLng([0, 0], 1e-2);
});
it('throws error if not yet added to map', function () {
expect(function () {
var polyline = new L.Polyline([[0, 0], [0, 0.090]]);
- var center = polyline.getCenter();
+ polyline.getCenter();
}).to.throwException('Must add layer to map before using getCenter()');
});
});
-
describe("#_defaultShape", function () {
-
it("should return latlngs when flat", function () {
var latLngs = [L.latLng([1, 2]), L.latLng([3, 4])];
@@ -169,7 +167,6 @@ describe('Polyline', function () {
});
describe("#addLatLng", function () {
-
it("should add latlng to latlngs", function () {
var latLngs = [
[1, 2],
@@ -218,7 +215,21 @@ describe('Polyline', function () {
expect(polyline._latlngs).to.eql([L.latLng([1, 2])]);
});
-
});
+ describe("#setStyle", function () {
+ it("succeeds for empty Polyline already added to the map", function () {
+ var style = {
+ weight: 3
+ };
+ var polyline = L.polyline([]);
+
+ polyline.addTo(map);
+ polyline.setStyle(style);
+
+ for (var prop in style) {
+ expect(polyline.options[prop]).to.be(style[prop]);
+ }
+ });
+ });
});
diff --git a/spec/suites/map/MapSpec.js b/spec/suites/map/MapSpec.js
index e66f54aea9d..75a9c2b5c28 100644
--- a/spec/suites/map/MapSpec.js
+++ b/spec/suites/map/MapSpec.js
@@ -1,64 +1,68 @@
describe("Map", function () {
- var map,
- spy;
+ var container,
+ map;
+
beforeEach(function () {
- map = L.map(document.createElement('div'));
+ container = document.createElement("div");
+ document.body.appendChild(container);
+ map = L.map(container);
+ });
+
+ afterEach(function () {
+ if (container._leaflet_id) {
+ map.remove();
+ }
+ document.body.removeChild(container);
});
describe("#remove", function () {
+ var spy;
+
+ beforeEach(function () {
+ spy = sinon.spy();
+ });
+
it("fires an unload event if loaded", function () {
- var container = document.createElement('div'),
- map = new L.Map(container).setView([0, 0], 0),
- spy = sinon.spy();
- map.on('unload', spy);
+ map.setView([0, 0], 0);
+ map.on("unload", spy);
map.remove();
expect(spy.called).to.be.ok();
});
it("fires no unload event if not loaded", function () {
- var container = document.createElement('div'),
- map = new L.Map(container),
- spy = sinon.spy();
- map.on('unload', spy);
+ map.on("unload", spy);
map.remove();
expect(spy.called).not.to.be.ok();
});
describe("corner case checking", function () {
it("throws an exception upon reinitialization", function () {
- var container = document.createElement('div'),
- map = new L.Map(container);
- expect(function () {
- L.map(container);
- }).to.throwException(function (e) {
- expect(e.message).to.eql("Map container is already initialized.");
- });
- map.remove();
+ expect(L.map).withArgs(container)
+ .to.throwException("Map container is already initialized.");
});
it("throws an exception if a container is not found", function () {
- expect(function () {
- L.map('nonexistentdivelement');
- }).to.throwException(function (e) {
- expect(e.message).to.eql("Map container not found.");
- });
- map.remove();
+ expect(L.map).withArgs("nonexistentdivelement")
+ .to.throwException("Map container not found.");
});
});
- it("undefines container._leaflet", function () {
- var container = document.createElement('div'),
- map = new L.Map(container);
+ it("undefines container._leaflet_id", function () {
+ expect(container._leaflet_id).to.be.ok();
map.remove();
- expect(container._leaflet).to.be(undefined);
+ expect(container._leaflet_id).to.be(undefined);
});
it("unbinds events", function () {
- var container = document.createElement('div'),
- map = new L.Map(container).setView([0, 0], 1),
- spy = sinon.spy();
+ // before actual test: make sure that events are ok
+ map.setView([0, 0], 0);
+ map.on("click", spy);
+ happen.click(container);
+ expect(spy.called).to.be.ok();
- map.on('click dblclick mousedown mouseup mousemove', spy);
+ // actual test
+ spy = sinon.spy();
+ map.on("click dblclick mousedown mouseup mousemove", spy);
map.remove();
happen.click(container);
@@ -71,50 +75,48 @@ describe("Map", function () {
});
it("does not throw if removed during animation", function () {
- var container = document.createElement('div'),
- map = new L.Map(container).setView([0, 0], 1);
+ map.setView([0, 0], 1).setMaxBounds([[0, 1], [2, 3]]);
// Force creation of animation proxy,
// otherwise browser checks disable it
map._createAnimProxy();
// #6775 Remove the map in the middle of the animation
- map.on("zoom", map.remove);
+ map.on("zoom", map.remove.bind(map));
map.setZoom(2);
});
it("throws error if container is reused by other instance", function () {
- var container = document.createElement('div'),
- map = L.map(container),
- map2;
-
map.remove();
- map2 = L.map(container);
+ var map2 = L.map(container);
expect(function () {
map.remove();
}).to.throwException();
+
+ map2.remove(); // clean up
});
});
- describe('#getCenter', function () {
- it('throws if not set before', function () {
+ describe("#getCenter", function () {
+ it("throws if not set before", function () {
expect(function () {
map.getCenter();
}).to.throwError();
});
- it('returns a precise center when zoomed in after being set (#426)', function () {
+ it("returns a precise center when zoomed in after being set (#426)", function () {
var center = L.latLng(10, 10);
map.setView(center, 1);
map.setZoom(19);
expect(map.getCenter()).to.eql(center);
});
- it('returns correct center after invalidateSize (#1919)', function () {
- map.setView(L.latLng(10, 10), 1);
+ it("returns correct center after invalidateSize (#1919)", function () {
+ var center = L.latLng(10, 10);
+ map.setView(center, 1);
map.invalidateSize();
- expect(map.getCenter()).not.to.eql(L.latLng(10, 10));
+ expect(map.getCenter()).not.to.eql(center);
});
});
@@ -164,15 +166,17 @@ describe("Map", function () {
});
it("defaults to zoom passed as map option", function () {
- map = L.map(document.createElement('div'), {zoom: 13});
- expect(map.setView([51.605, -0.11])).to.be(map);
- expect(map.getZoom()).to.be(13);
+ var map = L.map(document.createElement("div"), {zoom: 13});
+ var zoom = map.setView([51.605, -0.11]).getZoom();
+ map.remove(); // clean up
+ expect(zoom).to.be(13);
});
it("passes duration option to panBy", function () {
- map = L.map(document.createElement('div'), {zoom: 13, center: [0, 0]});
+ var map = L.map(document.createElement("div"), {zoom: 13, center: [0, 0]});
map.panBy = sinon.spy();
map.setView([51.605, -0.11], 13, {animate: true, duration: 13});
+ map.remove(); // clean up
expect(map.panBy.callCount).to.eql(1);
expect(map.panBy.args[0][1].duration).to.eql(13);
});
@@ -180,11 +184,12 @@ describe("Map", function () {
describe("#getBounds", function () {
it("is safe to call from within a moveend callback during initial load (#1027)", function () {
+ var map = L.map(document.createElement("div"));
map.on("moveend", function () {
map.getBounds();
});
-
map.setView([51.505, -0.09], 13);
+ map.remove(); // clean up
});
});
@@ -193,20 +198,15 @@ describe("Map", function () {
var bounds = [[-halfLength, -halfLength], [halfLength, halfLength]];
var wideBounds = [[-halfLength, -halfLength * 10], [halfLength, halfLength * 10]];
var padding = [100, 100];
- var height = '400px';
+ var height = "400px";
it("returns high levels of zoom with small areas and big padding", function () {
- var container = map.getContainer();
container.style.height = height;
- document.body.appendChild(container);
expect(map.getBoundsZoom(bounds, false, padding)).to.be.equal(19);
});
- it.skipInPhantom("returns multiples of zoomSnap when zoomSnap > 0 on any3d browsers", function () {
- var container = map.getContainer();
+ it.skipIfNo3d("returns multiples of zoomSnap when zoomSnap > 0 on any3d browsers", function () {
container.style.height = height;
- document.body.appendChild(container);
- // L.Browser.any3d = true; // L.Browser is frozen since ES6ication
map.options.zoomSnap = 0.5;
expect(map.getBoundsZoom(bounds, false, padding)).to.be.equal(19.5);
map.options.zoomSnap = 0.2;
@@ -216,46 +216,44 @@ describe("Map", function () {
});
it("getBoundsZoom does not return Infinity when projected SE - NW has negative components", function () {
- var container = map.getContainer();
container.style.height = 369;
container.style.width = 1048;
- document.body.appendChild(container);
- var bounds = L.latLngBounds(L.latLng([62.18475569507688, 6.926335173954951]), L.latLng([62.140483526511694, 6.923933370740089]));
+ map.setZoom(16);
+ var bounds = L.latLngBounds(
+ [62.18475569507688, 6.926335173954951],
+ [62.140483526511694, 6.923933370740089]);
+ var padding = L.point(-50, -50);
+
+ // control case: default crs
+ var boundsZoom = map.getBoundsZoom(bounds, false, padding);
+ expect(boundsZoom).to.eql(9);
+
+ // test case: EPSG:25833 (mocked, for simplicity)
// The following coordinates are bounds projected with proj4leaflet crs = EPSG:25833', '+proj=utm +zone=33 +ellps=GRS80 +units=m +no_defs
- var projectedSE = L.point(7800503.059925064, 6440062.353052008);
- var projectedNW = L.point(7801987.203481699, 6425186.447901004);
var crsMock = sinon.mock(map.options.crs);
- crsMock.expects("project").withArgs(bounds.getNorthWest()).returns(projectedNW);
- crsMock.expects("project").withArgs(bounds.getSouthEast()).returns(projectedSE);
+ crsMock.expects("latLngToPoint")
+ .withExactArgs(bounds.getNorthWest(), 16)
+ .returns(L.point(7800503.059925064, 6440062.353052008));
+ crsMock.expects("latLngToPoint")
+ .withExactArgs(bounds.getSouthEast(), 16)
+ .returns(L.point(7801987.203481699, 6425186.447901004));
+ boundsZoom = map.getBoundsZoom(bounds, false, padding);
+ crsMock.restore();
- var padding = L.point(-50, -50);
- map.setZoom(16);
- expect(map.getBoundsZoom(bounds, false, padding)).to.eql(9);
+ crsMock.verify(); // ensure that latLngToPoint was called with expected args
+ expect(boundsZoom).to.eql(7); // result expected for EPSG:25833
});
it("respects the 'inside' parameter", function () {
- var container = map.getContainer();
container.style.height = height;
- container.style.width = '1024px'; // Make sure the width is defined for browsers other than PhantomJS (in particular Firefox).
- document.body.appendChild(container);
+ container.style.width = "1024px"; // Make sure the width is defined for browsers other than PhantomJS (in particular Firefox).
expect(map.getBoundsZoom(wideBounds, false, padding)).to.be.equal(17);
expect(map.getBoundsZoom(wideBounds, true, padding)).to.be.equal(20);
});
});
- describe('#setMaxBounds', function () {
- var container;
-
- beforeEach(function () {
- container = map.getContainer();
- document.body.appendChild(container);
- });
-
- afterEach(function () {
- // document.body.removeChild(container);
- });
-
+ describe("#setMaxBounds", function () {
it("aligns pixel-wise map view center with maxBounds center if it cannot move view bounds inside maxBounds (#1908)", function () {
// large view, cannot fit within maxBounds
container.style.width = container.style.height = "1000px";
@@ -288,77 +286,88 @@ describe("Map", function () {
expect(bounds.contains(map.getBounds())).to.be(true);
});
- it("remove listeners when called without arguments", function () {
- L.tileLayer('http://tilecache.openstreetmap.fr/hot/{z}/{x}/{y}.png', {minZoom: 0, maxZoom: 20}).addTo(map);
+ it("remove listeners when called without arguments", function (done) {
+ L.tileLayer("", {minZoom: 0, maxZoom: 20}).addTo(map);
container.style.width = container.style.height = "500px";
var bounds = L.latLngBounds([51.5, -0.05], [51.55, 0.05]);
map.setMaxBounds(bounds, {animate: false});
map.setMaxBounds();
// set view outside
var center = L.latLng([0, 0]);
- map.once('moveend', function () {
+ map.once("moveend", function () {
expect(center.equals(map.getCenter())).to.be(true);
+ done();
});
map.setView(center, 18, {animate: false});
});
-
});
describe("#getMinZoom and #getMaxZoom", function () {
- describe('#getMinZoom', function () {
- it('returns 0 if not set by Map options or TileLayer options', function () {
- var map = L.map(document.createElement('div'));
+ var map;
+
+ afterEach(function () {
+ map.remove(); // clean up
+ });
+
+ describe("#getMinZoom", function () {
+ it("returns 0 if not set by Map options or TileLayer options", function () {
+ map = L.map(document.createElement("div"));
expect(map.getMinZoom()).to.be(0);
});
});
it("minZoom and maxZoom options overrides any minZoom and maxZoom set on layers", function () {
+ map = L.map(document.createElement("div"), {minZoom: 2, maxZoom: 20});
- var map = L.map(document.createElement('div'), {minZoom: 2, maxZoom: 20});
-
- L.tileLayer("{z}{x}{y}", {minZoom: 4, maxZoom: 10}).addTo(map);
- L.tileLayer("{z}{x}{y}", {minZoom: 6, maxZoom: 17}).addTo(map);
- L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 22}).addTo(map);
+ L.tileLayer("", {minZoom: 4, maxZoom: 10}).addTo(map);
+ L.tileLayer("", {minZoom: 6, maxZoom: 17}).addTo(map);
+ L.tileLayer("", {minZoom: 0, maxZoom: 22}).addTo(map);
expect(map.getMinZoom()).to.be(2);
expect(map.getMaxZoom()).to.be(20);
});
it("layer minZoom overrides map zoom if map has no minZoom set and layer minZoom is bigger than map zoom", function () {
- var map = L.map(document.createElement("div"), {zoom: 10});
- L.tileLayer("{z}{x}{y}", {minZoom: 15}).addTo(map);
+ map = L.map(document.createElement("div"), {zoom: 10});
+ L.tileLayer("", {minZoom: 15}).addTo(map);
expect(map.getMinZoom()).to.be(15);
});
it("layer maxZoom overrides map zoom if map has no maxZoom set and layer maxZoom is smaller than map zoom", function () {
- var map = L.map(document.createElement("div"), {zoom: 20});
- L.tileLayer("{z}{x}{y}", {maxZoom: 15}).addTo(map);
+ map = L.map(document.createElement("div"), {zoom: 20});
+ L.tileLayer("", {maxZoom: 15}).addTo(map);
expect(map.getMaxZoom()).to.be(15);
});
it("map's zoom is adjusted to layer's minZoom even if initialized with smaller value", function () {
- var map = L.map(document.createElement("div"), {zoom: 10});
- L.tileLayer("{z}{x}{y}", {minZoom: 15}).addTo(map);
+ map = L.map(document.createElement("div"), {zoom: 10});
+ L.tileLayer("", {minZoom: 15}).addTo(map);
expect(map.getZoom()).to.be(15);
});
it("map's zoom is adjusted to layer's maxZoom even if initialized with larger value", function () {
- var map = L.map(document.createElement("div"), {zoom: 20});
- L.tileLayer("{z}{x}{y}", {maxZoom: 15}).addTo(map);
+ map = L.map(document.createElement("div"), {zoom: 20});
+ L.tileLayer("", {maxZoom: 15}).addTo(map);
expect(map.getZoom()).to.be(15);
});
});
describe("#hasLayer", function () {
- it("returns false when passed undefined, null, or false", function () {
- var map = L.map(document.createElement('div'));
- expect(map.hasLayer(undefined)).to.equal(false);
- expect(map.hasLayer(null)).to.equal(false);
- expect(map.hasLayer(false)).to.equal(false);
+ it("throws when called without proper argument", function () {
+ var map = L.map(document.createElement("div"));
+ var hasLayer = L.Util.bind(map.hasLayer, map);
+ expect(hasLayer).withArgs(new L.Layer()).to.not.throwException(); // control case
+
+ expect(hasLayer).withArgs(undefined).to.throwException();
+ expect(hasLayer).withArgs(null).to.throwException();
+ expect(hasLayer).withArgs(false).to.throwException();
+ expect(hasLayer).to.throwException();
+
+ map.remove(); // clean up
});
});
@@ -370,7 +379,6 @@ describe("Map", function () {
}
describe("#addLayer", function () {
-
it("calls layer.onAdd immediately if the map is ready", function () {
var layer = layerSpy();
map.setView([0, 0], 0);
@@ -397,7 +405,7 @@ describe("Map", function () {
it("fires a layeradd event immediately if the map is ready", function () {
var layer = layerSpy(),
spy = sinon.spy();
- map.on('layeradd', spy);
+ map.on("layeradd", spy);
map.setView([0, 0], 0);
map.addLayer(layer);
expect(spy.called).to.be.ok();
@@ -406,7 +414,7 @@ describe("Map", function () {
it("fires a layeradd event when the map becomes ready", function () {
var layer = layerSpy(),
spy = sinon.spy();
- map.on('layeradd', spy);
+ map.on("layeradd", spy);
map.addLayer(layer);
expect(spy.called).not.to.be.ok();
map.setView([0, 0], 0);
@@ -416,7 +424,7 @@ describe("Map", function () {
it("does not fire a layeradd event if the layer is removed before the map becomes ready", function () {
var layer = layerSpy(),
spy = sinon.spy();
- map.on('layeradd', spy);
+ map.on("layeradd", spy);
map.addLayer(layer);
map.removeLayer(layer);
map.setView([0, 0], 0);
@@ -425,7 +433,7 @@ describe("Map", function () {
it("adds the layer before firing layeradd", function (done) {
var layer = layerSpy();
- map.on('layeradd', function () {
+ map.on("layeradd", function () {
expect(map.hasLayer(layer)).to.be.ok();
done();
});
@@ -445,7 +453,7 @@ describe("Map", function () {
var spy = sinon.spy();
map.on("zoomlevelschange", spy);
expect(spy.called).not.to.be.ok();
- L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map);
+ L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map);
expect(spy.called).to.be.ok();
});
});
@@ -453,10 +461,10 @@ describe("Map", function () {
describe("when a new layer with greater zoomlevel coverage than the current layer is added to a map", function () {
it("fires a zoomlevelschange event", function () {
var spy = sinon.spy();
- L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map);
+ L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map);
map.on("zoomlevelschange", spy);
expect(spy.called).not.to.be.ok();
- L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 15}).addTo(map);
+ L.tileLayer("", {minZoom: 0, maxZoom: 15}).addTo(map);
expect(spy.called).to.be.ok();
});
});
@@ -464,12 +472,12 @@ describe("Map", function () {
describe("when a new layer with the same or lower zoomlevel coverage as the current layer is added to a map", function () {
it("fires no zoomlevelschange event", function () {
var spy = sinon.spy();
- L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map);
+ L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map);
map.on("zoomlevelschange", spy);
expect(spy.called).not.to.be.ok();
- L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map);
+ L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map);
expect(spy.called).not.to.be.ok();
- L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 5}).addTo(map);
+ L.tileLayer("", {minZoom: 0, maxZoom: 5}).addTo(map);
expect(spy.called).not.to.be.ok();
});
});
@@ -501,7 +509,7 @@ describe("Map", function () {
it("fires a layerremove event if the map is ready", function () {
var layer = layerSpy(),
spy = sinon.spy();
- map.on('layerremove', spy);
+ map.on("layerremove", spy);
map.setView([0, 0], 0);
map.addLayer(layer);
map.removeLayer(layer);
@@ -511,7 +519,7 @@ describe("Map", function () {
it("does not fire a layerremove if the layer was not added", function () {
var layer = layerSpy(),
spy = sinon.spy();
- map.on('layerremove', spy);
+ map.on("layerremove", spy);
map.setView([0, 0], 0);
map.removeLayer(layer);
expect(spy.called).not.to.be.ok();
@@ -520,7 +528,7 @@ describe("Map", function () {
it("does not fire a layerremove if the map is not ready", function () {
var layer = layerSpy(),
spy = sinon.spy();
- map.on('layerremove', spy);
+ map.on("layerremove", spy);
map.addLayer(layer);
map.removeLayer(layer);
expect(spy.called).not.to.be.ok();
@@ -528,7 +536,7 @@ describe("Map", function () {
it("removes the layer before firing layerremove", function (done) {
var layer = layerSpy();
- map.on('layerremove', function () {
+ map.on("layerremove", function () {
expect(map.hasLayer(layer)).not.to.be.ok();
done();
});
@@ -538,7 +546,7 @@ describe("Map", function () {
});
it("supports adding and removing a tile layer without initializing the map", function () {
- var layer = L.tileLayer("{z}{x}{y}");
+ var layer = L.tileLayer("");
map.addLayer(layer);
map.removeLayer(layer);
});
@@ -552,59 +560,58 @@ describe("Map", function () {
describe("when the last tile layer on a map is removed", function () {
it("fires a zoomlevelschange event", function () {
- map.whenReady(function () {
- var spy = sinon.spy();
- var tl = L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map);
-
- map.on("zoomlevelschange", spy);
- expect(spy.called).not.to.be.ok();
- map.removeLayer(tl);
- expect(spy.called).to.be.ok();
- });
+ map.setView([0, 0], 0);
+ var spy = sinon.spy();
+ var tl = L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map);
+
+ map.on("zoomlevelschange", spy);
+ expect(spy.called).not.to.be.ok();
+ map.removeLayer(tl);
+ expect(spy.called).to.be.ok();
});
});
describe("when a tile layer is removed from a map and it had greater zoom level coverage than the remainding layer", function () {
it("fires a zoomlevelschange event", function () {
- map.whenReady(function () {
- var spy = sinon.spy(),
- tl = L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map),
- t2 = L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 15}).addTo(map);
-
- map.on("zoomlevelschange", spy);
- expect(spy.called).to.not.be.ok();
- map.removeLayer(t2);
- expect(spy.called).to.be.ok();
- });
+ map.setView([0, 0], 0);
+ L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map);
+ var spy = sinon.spy(),
+ t2 = L.tileLayer("", {minZoom: 0, maxZoom: 15}).addTo(map);
+
+ map.on("zoomlevelschange", spy);
+ expect(spy.called).to.not.be.ok();
+ map.removeLayer(t2);
+ expect(spy.called).to.be.ok();
});
});
- describe("when a tile layer is removed from a map it and it had lesser or the sa,e zoom level coverage as the remainding layer(s)", function () {
+ describe("when a tile layer is removed from a map it and it had lesser or the same zoom level coverage as the remainding layer(s)", function () {
it("fires no zoomlevelschange event", function () {
- map.whenReady(function () {
- var tl = L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map),
- t2 = L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 10}).addTo(map),
- t3 = L.tileLayer("{z}{x}{y}", {minZoom: 0, maxZoom: 5}).addTo(map);
-
- map.on("zoomlevelschange", spy);
- expect(spy).not.toHaveBeenCalled();
- map.removeLayer(t2);
- expect(spy).not.toHaveBeenCalled();
- map.removeLayer(t3);
- expect(spy).not.toHaveBeenCalled();
- });
+ map.setView([0, 0], 0);
+ var spy = sinon.spy(),
+ t1 = L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map),
+ t2 = L.tileLayer("", {minZoom: 0, maxZoom: 10}).addTo(map),
+ t3 = L.tileLayer("", {minZoom: 0, maxZoom: 5}).addTo(map);
+
+ map.on("zoomlevelschange", spy);
+ map.removeLayer(t2);
+ expect(spy.called).to.not.be.ok();
+ map.removeLayer(t3);
+ expect(spy.called).to.not.be.ok();
+ map.removeLayer(t1);
+ expect(spy.called).to.be.ok();
});
});
});
describe("#eachLayer", function () {
it("returns self", function () {
- expect(map.eachLayer(function () {})).to.be(map);
+ expect(map.eachLayer(L.Util.falseFn)).to.be(map);
});
it("calls the provided function for each layer", function () {
- var t1 = L.tileLayer("{z}{x}{y}").addTo(map),
- t2 = L.tileLayer("{z}{x}{y}").addTo(map),
+ var t1 = L.tileLayer("").addTo(map),
+ t2 = L.tileLayer("").addTo(map),
spy = sinon.spy();
map.eachLayer(spy);
@@ -615,31 +622,28 @@ describe("Map", function () {
});
it("calls the provided function with the provided context", function () {
- var t1 = L.tileLayer("{z}{x}{y}").addTo(map),
- spy = sinon.spy();
+ var spy = sinon.spy();
+ L.tileLayer("").addTo(map);
map.eachLayer(spy, map);
- expect(spy.thisValues[0]).to.eql(map);
+ expect(spy.alwaysCalledOn(map)).to.be.ok();
});
});
describe("#invalidateSize", function () {
- var container,
- origWidth = 100,
+ var origWidth = 100,
clock;
beforeEach(function () {
- container = map.getContainer();
+ container.style.height = "100px";
container.style.width = origWidth + "px";
- document.body.appendChild(container);
map.setView([0, 0], 0);
map.invalidateSize({pan: false});
clock = sinon.useFakeTimers();
});
afterEach(function () {
- document.body.removeChild(container);
clock.restore();
});
@@ -737,7 +741,7 @@ describe("Map", function () {
});
// Change the container size
- container.style.width = '600px';
+ container.style.width = "600px";
// The map should not be aware yet of container size change,
// otherwise the next invalidateSize will not be able to
@@ -754,48 +758,34 @@ describe("Map", function () {
});
});
- describe('#flyTo', function () {
- var div;
-
+ describe("#flyTo", function () {
beforeEach(function () {
- div = document.createElement('div');
- div.style.width = '800px';
- div.style.height = '600px';
- div.style.visibility = 'hidden';
-
- document.body.appendChild(div);
-
- map = L.map(div);
- });
-
- afterEach(function () {
- document.body.removeChild(div);
+ container.style.width = "800px";
+ container.style.height = "600px";
+ container.style.visibility = "hidden";
});
- it('move to requested center and zoom, and call zoomend once', function (done) {
+ it("move to requested center and zoom, and call zoomend once", function (done) {
this.timeout(10000); // This test takes longer than usual due to frames
- var spy = sinon.spy(),
- newCenter = new L.LatLng(10, 11),
+ var newCenter = new L.LatLng(10, 11),
newZoom = 12;
var callback = function () {
expect(map.getCenter()).to.eql(newCenter);
expect(map.getZoom()).to.eql(newZoom);
- spy();
- expect(spy.calledOnce).to.be.ok();
done();
};
map.setView([0, 0], 0);
- map.on('zoomend', callback).flyTo(newCenter, newZoom);
+ map.on("zoomend", callback).flyTo(newCenter, newZoom);
});
- it('flyTo start latlng == end latlng', function (done) {
+ it("flyTo start latlng == end latlng", function (done) {
this.timeout(10000); // This test takes longer than usual due to frames
var dc = new L.LatLng(38.91, -77.04);
map.setView(dc, 14);
- map.on('zoomend', function () {
+ map.on("zoomend", function () {
expect(map.getCenter()).to.eql(dc);
expect(map.getZoom()).to.eql(4);
done();
@@ -805,14 +795,14 @@ describe("Map", function () {
});
});
- describe('#zoomIn and #zoomOut', function () {
+ describe("#zoomIn and #zoomOut", function () {
var center = L.latLng(22, 33);
beforeEach(function () {
map.setView(center, 10);
});
- it('zoomIn zooms by 1 zoom level by default', function (done) {
- map.once('zoomend', function () {
+ it("zoomIn zooms by 1 zoom level by default", function (done) {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(11);
expect(map.getCenter()).to.eql(center);
done();
@@ -820,8 +810,8 @@ describe("Map", function () {
map.zoomIn(null, {animate: false});
});
- it('zoomOut zooms by 1 zoom level by default', function (done) {
- map.once('zoomend', function () {
+ it("zoomOut zooms by 1 zoom level by default", function (done) {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(9);
expect(map.getCenter()).to.eql(center);
done();
@@ -829,11 +819,10 @@ describe("Map", function () {
map.zoomOut(null, {animate: false});
});
- it.skipInNonPhantom('zoomIn ignores the zoomDelta option on non-any3d browsers', function (done) {
- L.Browser.any3d = false;
+ it.skipIf3d("zoomIn ignores the zoomDelta option on non-any3d browsers", function (done) {
map.options.zoomSnap = 0.25;
map.options.zoomDelta = 0.25;
- map.once('zoomend', function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(11);
expect(map.getCenter()).to.eql(center);
done();
@@ -841,12 +830,11 @@ describe("Map", function () {
map.zoomIn(null, {animate: false});
});
- it.skipInPhantom('zoomIn respects the zoomDelta option on any3d browsers', function (done) {
- L.Browser.any3d = true;
+ it.skipIfNo3d("zoomIn respects the zoomDelta option on any3d browsers", function (done) {
map.options.zoomSnap = 0.25;
map.options.zoomDelta = 0.25;
map.setView(center, 10);
- map.once('zoomend', function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(10.25);
expect(map.getCenter()).to.eql(center);
done();
@@ -854,12 +842,11 @@ describe("Map", function () {
map.zoomIn(null, {animate: false});
});
- it.skipInPhantom('zoomOut respects the zoomDelta option on any3d browsers', function (done) {
- L.Browser.any3d = true;
+ it.skipIfNo3d("zoomOut respects the zoomDelta option on any3d browsers", function (done) {
map.options.zoomSnap = 0.25;
map.options.zoomDelta = 0.25;
map.setView(center, 10);
- map.once('zoomend', function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(9.75);
expect(map.getCenter()).to.eql(center);
done();
@@ -867,35 +854,33 @@ describe("Map", function () {
map.zoomOut(null, {animate: false});
});
- it.skipInPhantom('zoomIn snaps to zoomSnap on any3d browsers', function (done) {
+ it.skipIfNo3d("zoomIn snaps to zoomSnap on any3d browsers", function (done) {
map.options.zoomSnap = 0.25;
map.setView(center, 10);
- map.once('zoomend', function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(10.25);
expect(map.getCenter()).to.eql(center);
done();
});
- L.Browser.any3d = true;
map.zoomIn(0.22, {animate: false});
});
- it.skipInPhantom('zoomOut snaps to zoomSnap on any3d browsers', function (done) {
+ it.skipIfNo3d("zoomOut snaps to zoomSnap on any3d browsers", function (done) {
map.options.zoomSnap = 0.25;
map.setView(center, 10);
- map.once('zoomend', function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(9.75);
expect(map.getCenter()).to.eql(center);
done();
});
- L.Browser.any3d = true;
map.zoomOut(0.22, {animate: false});
});
});
- describe('#_getBoundsCenterZoom', function () {
+ describe("#_getBoundsCenterZoom", function () {
var center = L.latLng(50.5, 30.51);
- it('Returns valid center on empty bounds in unitialized map', function () {
+ it("Returns valid center on empty bounds in unitialized map", function () {
// Edge case from #5153
var centerAndZoom = map._getBoundsCenterZoom([center, center]);
expect(centerAndZoom.center).to.eql(center);
@@ -903,25 +888,19 @@ describe("Map", function () {
});
});
- describe('#fitBounds', function () {
+ describe("#fitBounds", function () {
var center = L.latLng(50.5, 30.51),
bounds = L.latLngBounds(L.latLng(1, 102), L.latLng(11, 122)),
boundsCenter = bounds.getCenter();
beforeEach(function () {
// fitBounds needs a map container with non-null area
- var container = map.getContainer();
container.style.width = container.style.height = "100px";
- document.body.appendChild(container);
map.setView(center, 15);
});
- afterEach(function () {
- document.body.removeChild(map.getContainer());
- });
-
- it('Snaps zoom level to integer by default', function (done) {
- map.once('zoomend', function () {
+ it("Snaps zoom level to integer by default", function (done) {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(2);
expect(map.getCenter().equals(boundsCenter, 0.05)).to.eql(true);
done();
@@ -929,10 +908,9 @@ describe("Map", function () {
map.fitBounds(bounds, {animate: false});
});
- it.skipInPhantom('Snaps zoom to zoomSnap on any3d browsers', function (done) {
+ it.skipIfNo3d("Snaps zoom to zoomSnap on any3d browsers", function (done) {
map.options.zoomSnap = 0.25;
- L.Browser.any3d = true;
- map.once('zoomend', function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(2.75);
expect(map.getCenter().equals(boundsCenter, 0.05)).to.eql(true);
done();
@@ -940,10 +918,9 @@ describe("Map", function () {
map.fitBounds(bounds, {animate: false});
});
- it.skipInNonPhantom('Ignores zoomSnap on non-any3d browsers', function (done) {
+ it.skipIf3d("Ignores zoomSnap on non-any3d browsers", function (done) {
map.options.zoomSnap = 0.25;
- L.Browser.any3d = false;
- map.once('zoomend', function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(2);
expect(map.getCenter().equals(boundsCenter, 0.05)).to.eql(true);
done();
@@ -951,8 +928,8 @@ describe("Map", function () {
map.fitBounds(bounds, {animate: false});
});
- it('can be called with an array', function (done) {
- map.once('zoomend', function () {
+ it("can be called with an array", function (done) {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(2);
expect(map.getCenter().equals(boundsCenter, 0.05)).to.eql(true);
done();
@@ -961,16 +938,16 @@ describe("Map", function () {
map.fitBounds(bounds, {animate: false});
});
- it('throws an error with invalid bounds', function () {
+ it("throws an error with invalid bounds", function () {
expect(function () {
map.fitBounds(NaN);
}).to.throwError();
});
- it('Fits to same scale and zoom', function (done) {
+ it("Fits to same scale and zoom", function (done) {
var bounds = map.getBounds(),
zoom = map.getZoom();
- map.once('moveend zoomend', function () {
+ map.once("moveend zoomend", function () {
var newBounds = map.getBounds();
expect(newBounds.getSouthWest()).to.nearLatLng(bounds.getSouthWest());
expect(newBounds.getNorthEast()).to.nearLatLng(bounds.getNorthEast());
@@ -980,9 +957,9 @@ describe("Map", function () {
map.fitBounds(bounds, {animate: false});
});
- it('Fits to small bounds from small zoom', function (done) {
- map.once('zoomend', function () {
- map.once('zoomend', function () {
+ it("Fits to small bounds from small zoom", function (done) {
+ map.once("zoomend", function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(11);
expect(map.getCenter().equals(boundsCenter, 0.05)).to.eql(true);
done();
@@ -995,9 +972,9 @@ describe("Map", function () {
map.setZoom(0);
});
- it('Fits to large bounds from large zoom', function (done) {
- map.once('zoomend', function () {
- map.once('zoomend', function () {
+ it("Fits to large bounds from large zoom", function (done) {
+ map.once("zoomend", function () {
+ map.once("zoomend", function () {
expect(map.getZoom()).to.eql(0);
expect(map.getCenter().equals(boundsCenter, 0.05)).to.eql(true);
done();
@@ -1011,63 +988,46 @@ describe("Map", function () {
});
});
-
- describe('#fitBounds after layers set', function () {
+ describe("#fitBounds after layers set", function () {
var center = L.latLng(22, 33),
- bounds = L.latLngBounds(L.latLng(1, 102), L.latLng(11, 122)),
- boundsCenter = bounds.getCenter();
+ bounds = L.latLngBounds(L.latLng(1, 102), L.latLng(11, 122));
beforeEach(function () {
// fitBounds needs a map container with non-null area
- var container = map.getContainer();
container.style.width = container.style.height = "100px";
- document.body.appendChild(container);
- });
-
- afterEach(function () {
- document.body.removeChild(map.getContainer());
});
- it('Snaps to a number after adding tile layer', function (done) {
- L.Browser.any3d = true;
- map.addLayer(L.tileLayer('file:///dev/null'));
+ it("Snaps to a number after adding tile layer", function () {
+ // expect(L.Browser.any3d).to.be.ok(); // precondition
+ map.addLayer(L.tileLayer(""));
expect(map.getZoom()).to.be(undefined);
map.fitBounds(bounds);
expect(map.getZoom()).to.be(2);
- done();
});
- it('Snaps to a number after adding marker', function (done) {
- L.Browser.any3d = true;
+ it("Snaps to a number after adding marker", function () {
+ // expect(L.Browser.any3d).to.be.ok(); // precondition
map.addLayer(L.marker(center));
expect(map.getZoom()).to.be(undefined);
map.fitBounds(bounds);
expect(map.getZoom()).to.be(2);
- done();
});
});
-
describe("#panInside", function () {
var center,
tl,
tlPix;
beforeEach(function () {
- var container = map.getContainer();
container.style.height = container.style.width = "500px";
- document.body.appendChild(container);
map.setView(L.latLng([53.0, 0.15]), 12, {animate: false});
center = map.getCenter();
tl = map.getBounds().getNorthWest();
tlPix = map.getPixelBounds().min;
});
- afterEach(function () {
- document.body.removeChild(map.getContainer());
- });
-
it("does not pan the map when the target is within bounds", function () {
map.panInside(tl, {animate:false});
expect(center).to.equal(map.getCenter());
@@ -1102,7 +1062,6 @@ describe("Map", function () {
it("supports different padding values for each border", function () {
var p = tlPix.add([40, 0]), // Top-Left
- distanceMoved,
opts = {paddingTL: [60, 20], paddingBR: [10, 10]};
map.panInside(map.unproject(p), opts);
expect(center).to.equal(map.getCenter());
@@ -1137,24 +1096,26 @@ describe("Map", function () {
var dy = map.getCenter().lat - center.lat;
expect(dy).to.be.lessThan(1.0E-9);
});
- });
-
- describe('#DOM events', function () {
-
- var c, map;
-
- beforeEach(function () {
- c = document.createElement('div');
- c.style.width = '400px';
- c.style.height = '400px';
- map = new L.Map(c);
- map.setView(new L.LatLng(0, 0), 0);
- document.body.appendChild(c);
+ it("pans correctly when padding takes up more than half the display bounds", function () {
+ var oldCenter = map.project(center);
+ var targetOffset = L.point(0, -5); // arbitrary point above center
+ var target = oldCenter.add(targetOffset);
+ var paddingOffset = L.point(0, 15);
+ var padding = map.getSize().divideBy(2) // half size
+ .add(paddingOffset); // padding more than half the display bounds (replicates issue #7445)
+ map.panInside(map.unproject(target), {paddingBottomRight: [0, padding.y], animate: false});
+ var offset = map.project(map.getCenter()).subtract(oldCenter); // distance moved during the pan
+ var result = paddingOffset.add(targetOffset).subtract(offset);
+ expect(result.trunc()).to.eql(L.point(0, 0));
});
+ });
- afterEach(function () {
- document.body.removeChild(c);
+ describe("#DOM events", function () {
+ beforeEach(function () {
+ container.style.width = "400px";
+ container.style.height = "400px";
+ map.setView([0, 0], 0);
});
it("DOM events propagate from polygon to map", function () {
@@ -1204,7 +1165,7 @@ describe("Map", function () {
map.on("mouseout", mapSpy);
layer.on("mouseout", layerSpy);
other.on("mouseout", otherSpy);
- happen.mouseout(layer._path, {relatedTarget: map._container});
+ happen.mouseout(layer._path, {relatedTarget: container});
expect(mapSpy.called).not.to.be.ok();
expect(otherSpy.called).not.to.be.ok();
expect(layerSpy.calledOnce).to.be.ok();
@@ -1220,7 +1181,7 @@ describe("Map", function () {
layer = L.marker([1, 2], {icon: icon}).addTo(map);
map.on("mouseout", mapSpy);
layer.on("mouseout", layerSpy);
- happen.mouseout(layer._icon, {relatedTarget: map._container});
+ happen.mouseout(layer._icon, {relatedTarget: container});
expect(mapSpy.called).not.to.be.ok();
expect(layerSpy.calledOnce).to.be.ok();
});
@@ -1233,12 +1194,12 @@ describe("Map", function () {
var mapSpy = sinon.spy(),
layerSpy = sinon.spy(),
layer = L.marker([1, 2], {icon: icon}).addTo(map),
- child = layer._icon.querySelector('p');
+ child = layer._icon.querySelector("p");
map.on("mouseout", mapSpy);
layer.on("mouseout", layerSpy);
happen.mouseout(layer._icon, {relatedTarget: child});
expect(mapSpy.called).not.to.be.ok();
- expect(layerSpy.calledOnce).not.to.be.ok();
+ expect(layerSpy.called).not.to.be.ok();
});
it("mouseout is not forwarded if fired on target's child", function () {
@@ -1249,12 +1210,12 @@ describe("Map", function () {
var mapSpy = sinon.spy(),
layerSpy = sinon.spy(),
layer = L.marker([1, 2], {icon: icon}).addTo(map),
- child = layer._icon.querySelector('p');
+ child = layer._icon.querySelector("p");
map.on("mouseout", mapSpy);
layer.on("mouseout", layerSpy);
happen.mouseout(child, {relatedTarget: layer._icon});
expect(mapSpy.called).not.to.be.ok();
- expect(layerSpy.calledOnce).not.to.be.ok();
+ expect(layerSpy.called).not.to.be.ok();
});
it("mouseout is not forwarded to layers if fired on the map", function () {
@@ -1266,7 +1227,7 @@ describe("Map", function () {
map.on("mouseout", mapSpy);
layer.on("mouseout", layerSpy);
other.on("mouseout", otherSpy);
- happen.mouseout(map._container);
+ happen.mouseout(container);
expect(otherSpy.called).not.to.be.ok();
expect(layerSpy.called).not.to.be.ok();
expect(mapSpy.calledOnce).to.be.ok();
@@ -1274,7 +1235,7 @@ describe("Map", function () {
it("preclick is fired before click on marker and map", function () {
var called = 0;
- var layer = new L.Marker([1, 2]).addTo(map);
+ var layer = new L.Marker([1, 2], {bubblingMouseEvents: true}).addTo(map);
layer.on("preclick", function (e) {
expect(called++).to.eql(0);
expect(e.latlng).to.ok();
@@ -1292,11 +1253,44 @@ describe("Map", function () {
expect(e.latlng).to.ok();
});
happen.click(layer._icon);
+ expect(called).to.eql(4);
});
+ it("prevents default action of contextmenu if there is any listener", function () {
+ if (!L.Browser.canvas) { this.skip(); }
+
+ map.remove();
+ var container = document.createElement('div');
+ container.style.width = container.style.height = '300px';
+ container.style.top = container.style.left = 0;
+ container.style.position = 'absolute';
+ document.body.appendChild(container);
+
+ map = L.map(container, {
+ renderer: L.canvas(),
+ center: [0, 0],
+ zoom: 0
+ });
+ map.setView(L.latLng([0, 0]), 12);
+ var spy = sinon.spy();
+ map.on('contextmenu', function (e) {
+ spy(e.originalEvent.defaultPrevented);
+ });
+ var marker = L.circleMarker([0, 0]).addTo(map);
+
+ happen.at('contextmenu', 0, 0); // first
+
+ happen.at('contextmenu', marker._point.x, marker._point.y); // second (#5995)
+
+ document.body.removeChild(container); // cleanup
+
+ expect(spy.callCount).to.be(2);
+ expect(spy.firstCall.lastArg).to.be.ok();
+ expect(spy.secondCall.lastArg).to.be.ok();
+ });
});
- describe('#getScaleZoom && #getZoomScale', function () {
+ describe("#getScaleZoom && #getZoomScale", function () {
it("converts zoom to scale and vice versa and returns the same values", function () {
var toZoom = 6.25;
var fromZoom = 8.5;
@@ -1314,14 +1308,32 @@ describe("Map", function () {
});
});
- describe('#getZoom', function () {
+ describe("#getZoom", function () {
it("returns undefined if map not initialized", function () {
expect(map.getZoom()).to.be(undefined);
});
it("returns undefined if map not initialized but layers added", function () {
- map.addLayer(L.tileLayer('file:///dev/null'));
+ map.addLayer(L.tileLayer(""));
expect(map.getZoom()).to.be(undefined);
});
});
+
+ describe("#Geolocation", function () {
+ it("doesn't throw error if location is found and map is not existing", function () {
+ var fn = L.Util.bind(map._handleGeolocationResponse, map);
+ map.remove();
+ expect(function () {
+ fn({coords: {latitude: 40.415296, longitude: 10.7419264, accuracy: 1129.5646101470752}});
+ }).to.not.throwException();
+ });
+ it("doesn't throw error if location is not found and map is not existing", function () {
+ map._locateOptions = {setView: true};
+ var fn = L.Util.bind(map._handleGeolocationError, map);
+ map.remove();
+ expect(function () {
+ fn({coords: {latitude: 40.415296, longitude: 10.7419264, accuracy: 1129.5646101470752}});
+ }).to.not.throwException();
+ });
+ });
});
diff --git a/spec/suites/map/handler/Map.BoxZoom.js b/spec/suites/map/handler/Map.BoxZoom.js
new file mode 100644
index 00000000000..c5d7f57f10b
--- /dev/null
+++ b/spec/suites/map/handler/Map.BoxZoom.js
@@ -0,0 +1,65 @@
+describe("Map.BoxZoom", function () {
+ var container, map;
+
+ beforeEach(function () {
+ container = document.createElement('div');
+ container.style.width = container.style.height = '600px';
+ container.style.top = container.style.left = 0;
+ container.style.top = container.style.top = 0;
+ container.style.position = 'absolute';
+ document.body.appendChild(container);
+ });
+
+ afterEach(function () {
+ map.remove();
+ document.body.removeChild(container);
+ });
+
+
+ it("cancel boxZoom by pressing ESC and re-enable click event on the map", function () {
+ map = new L.Map(container, {
+ center: [0, 0],
+ zoom: 3
+ });
+
+ var mapClick = false;
+ map.on('click', function () {
+ mapClick = true;
+ });
+
+ // check if click event on the map is fired
+ happen.click(map._container);
+ expect(mapClick).to.be(true);
+
+ // fire mousedown event with shiftKey = true, to start drawing the boxZoom
+ var clientX = 100;
+ var clientY = 100;
+ var event = new CustomEvent("mousedown");
+ event.shiftKey = true;
+ event.clientX = clientX;
+ event.clientY = clientY;
+ event.button = 1;
+ map._container.dispatchEvent(event);
+
+ // fire mousemove event with shiftKey = true, to draw the boxZoom
+ clientX += 100;
+ clientY += 100;
+ event = new CustomEvent("mousemove");
+ event.shiftKey = true;
+ event.clientX = clientX;
+ event.clientY = clientY;
+ event.button = 1;
+ document.dispatchEvent(event);
+
+ // fire keydown event with keyCode = 27 (ESC) to cancel boxZoom
+ event = new CustomEvent("keydown");
+ event.keyCode = 27;
+ document.dispatchEvent(event);
+
+ // check if click event on the map is fired
+ mapClick = false;
+ happen.click(map._container);
+ expect(mapClick).to.be(true);
+ });
+
+});
diff --git a/spec/suites/map/handler/Map.DragSpec.js b/spec/suites/map/handler/Map.DragSpec.js
index 3a66daaa29e..c86701104d6 100644
--- a/spec/suites/map/handler/Map.DragSpec.js
+++ b/spec/suites/map/handler/Map.DragSpec.js
@@ -1,8 +1,17 @@
describe("Map.Drag", function () {
describe("#addHook", function () {
+ var container, map;
+
+ before(function () {
+ container = document.createElement('div');
+ });
+
+ afterEach(function () {
+ map.remove();
+ });
+
it("calls the map with dragging enabled", function () {
- var container = document.createElement('div');
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true
});
@@ -10,9 +19,9 @@ describe("Map.Drag", function () {
map.setView([0, 0], 0);
expect(map.dragging.enabled()).to.be(true);
});
+
it("calls the map with dragging and worldCopyJump enabled", function () {
- var container = document.createElement('div');
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
worldCopyJump: true
});
@@ -21,10 +30,10 @@ describe("Map.Drag", function () {
map.setView([0, 0], 0);
expect(map.dragging.enabled()).to.be(true);
});
+
it("calls the map with dragging disabled and worldCopyJump enabled; " +
"enables dragging after setting center and zoom", function () {
- var container = document.createElement('div');
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: false,
worldCopyJump: true
});
@@ -36,9 +45,8 @@ describe("Map.Drag", function () {
});
});
-
describe("mouse events", function () {
- var container;
+ var container, map;
beforeEach(function () {
container = document.createElement('div');
@@ -49,11 +57,12 @@ describe("Map.Drag", function () {
});
afterEach(function () {
+ map.remove();
document.body.removeChild(container);
});
it("change the center of the map", function (done) {
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -88,13 +97,9 @@ describe("Map.Drag", function () {
container.style.webkitTransform = 'scale(' + scaleX + ', ' + scaleY + ')';
});
- afterEach(function () {
- container.style.webkitTransformOrigin = '';
- container.style.webkitTransform = '';
- });
-
- it("change the center of the map, compensating for CSS scale", function (done) {
- var map = new L.Map(container, {
+ // fixme IE
+ (L.Browser.ie ? it.skip : it)("change the center of the map, compensating for CSS scale", function (done) {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -122,7 +127,7 @@ describe("Map.Drag", function () {
});
it("does not change the center of the map when mouse is moved less than the drag threshold", function (done) {
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -154,7 +159,7 @@ describe("Map.Drag", function () {
});
it("does not trigger preclick nor click", function (done) {
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -187,7 +192,7 @@ describe("Map.Drag", function () {
});
it("does not trigger preclick nor click when dragging on top of a static marker", function (done) {
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -226,7 +231,7 @@ describe("Map.Drag", function () {
});
it("does not trigger preclick nor click when dragging a marker", function (done) {
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -265,14 +270,7 @@ describe("Map.Drag", function () {
});
it("does not change the center of the map when drag is disabled on click", function (done) {
- var container = document.createElement('div');
- container.style.width = container.style.height = '600px';
- container.style.top = container.style.left = 0;
- container.style.position = 'absolute';
-
- document.body.appendChild(container);
-
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -290,7 +288,6 @@ describe("Map.Drag", function () {
onStop: function () {
var center = map.getCenter();
var zoom = map.getZoom();
- document.body.removeChild(container);
expect(center).to.be(originalCenter); // Expect center point to be the same as before the click
expect(spy.callCount).to.eql(0); // No drag event should have been fired.
expect(zoom).to.be(1);
@@ -309,16 +306,25 @@ describe("Map.Drag", function () {
});
describe("touch events", function () {
- it.skipIfNotTouch("change the center of the map", function (done) {
- var container = document.createElement('div');
+ var container, map;
+
+ beforeEach(function () {
+ container = document.createElement('div');
container.style.width = container.style.height = '600px';
container.style.top = container.style.left = 0;
container.style.position = 'absolute';
// container.style.background = '#808080';
document.body.appendChild(container);
+ });
+
+ afterEach(function () {
+ map.remove();
+ document.body.removeChild(container);
+ });
- var map = new L.Map(container, {
+ it.skipIfNotTouch("change the center of the map", function (done) {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -329,7 +335,6 @@ describe("Map.Drag", function () {
onStop: function () {
var center = map.getCenter();
var zoom = map.getZoom();
- document.body.removeChild(container);
expect(center.lat).to.be.within(21.9430, 21.9431);
expect(center.lng).to.be(-180);
expect(zoom).to.be(1);
@@ -337,7 +342,7 @@ describe("Map.Drag", function () {
done();
}
});
- var toucher = hand.growFinger('touch');
+ var toucher = hand.growFinger(touchEventType);
// We move 5 pixels first to overcome the 3-pixel threshold of
// L.Draggable.
@@ -346,14 +351,7 @@ describe("Map.Drag", function () {
});
it.skipIfNotTouch("does not change the center of the map when finger is moved less than the drag threshold", function (done) {
- var container = document.createElement('div');
- container.style.width = container.style.height = '600px';
- container.style.top = container.style.left = 0;
- container.style.position = 'absolute';
-
- document.body.appendChild(container);
-
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false
});
@@ -369,8 +367,7 @@ describe("Map.Drag", function () {
onStop: function () {
var center = map.getCenter();
var zoom = map.getZoom();
- document.body.removeChild(container);
- expect(center).to.be(originalCenter); // Expect center point to be the same as before the click
+ expect(center.equals(originalCenter)).to.be(true); // Expect center point to be the same as before the click
expect(spy.callCount).to.eql(0); // No drag event should have been fired.
expect(zoom).to.be(1);
@@ -378,7 +375,7 @@ describe("Map.Drag", function () {
}
});
- var toucher = hand.growFinger('touch');
+ var toucher = hand.growFinger(touchEventType);
// We move 2 pixels to stay below the default 3-pixel threshold of
// L.Draggable. This should result in a click and not a drag.
@@ -387,13 +384,7 @@ describe("Map.Drag", function () {
});
it.skipIfNotTouch('reset itself after touchend', function (done) {
-
- var container = document.createElement('div');
- container.style.width = container.style.height = '600px';
- container.style.top = container.style.left = 0;
- container.style.position = 'absolute';
- document.body.appendChild(container);
- var map = new L.Map(container, {
+ map = new L.Map(container, {
dragging: true,
inertia: false,
zoomAnimation: false // If true, the test has to wait extra 250msec
@@ -412,7 +403,6 @@ describe("Map.Drag", function () {
var mouseHand = new Hand({
timing: 'fastframe',
onStop: function () {
- document.body.removeChild(container);
expect(map.getCenter()).to.eql(center);
expect(map.getZoom()).to.eql(zoom);
@@ -431,8 +421,8 @@ describe("Map.Drag", function () {
}
});
- var f1 = hand.growFinger('touch');
- var f2 = hand.growFinger('touch');
+ var f1 = hand.growFinger(touchEventType);
+ var f2 = hand.growFinger(touchEventType);
hand.sync(5);
f1.wait(100).moveTo(275, 300, 0)
@@ -440,9 +430,6 @@ describe("Map.Drag", function () {
// This finger should touch me map after the other one.
f2.wait(110).moveTo(325, 300, 0)
.down().moveBy(210, 0, 1000).up(200);
-
});
-
});
-
});
diff --git a/spec/suites/map/handler/Map.KeyboardSpec.js b/spec/suites/map/handler/Map.KeyboardSpec.js
index 4c0c43df40e..a3b5a5e76ba 100644
--- a/spec/suites/map/handler/Map.KeyboardSpec.js
+++ b/spec/suites/map/handler/Map.KeyboardSpec.js
@@ -1,13 +1,12 @@
describe("Map.Keyboard", function () {
-
- const KEYCODE_LOWERCASE_A = 65;
- const KEYCODE_ARROW_LEFT = 37;
- const KEYCODE_ARROW_UP = 38;
- const KEYCODE_ARROW_RIGHT = 39;
- const KEYCODE_ARROW_DOWN = 40;
- const KEYCODE_PLUS = 171;
- const KEYCODE_MINUS = 173;
- const KEYCODE_ESC = 27;
+ var KEYCODE_LOWERCASE_A = 65;
+ var KEYCODE_ARROW_LEFT = 37;
+ var KEYCODE_ARROW_UP = 38;
+ var KEYCODE_ARROW_RIGHT = 39;
+ var KEYCODE_ARROW_DOWN = 40;
+ var KEYCODE_PLUS = 171;
+ var KEYCODE_MINUS = 173;
+ var KEYCODE_ESC = 27;
var map, container;
diff --git a/spec/suites/map/handler/Map.TapHoldSpec.js b/spec/suites/map/handler/Map.TapHoldSpec.js
new file mode 100644
index 00000000000..6378ff08ca8
--- /dev/null
+++ b/spec/suites/map/handler/Map.TapHoldSpec.js
@@ -0,0 +1,209 @@
+describe('Map.TapHoldSpec.js', function () {
+ var el, clock, spy, map;
+
+ var posStart = {clientX:1, clientY:1};
+ var posNear = {clientX:10, clientY:10};
+ var posFar = {clientX:100, clientY:100};
+
+ beforeEach(function () {
+ el = document.createElement('div');
+ document.body.appendChild(el);
+
+ clock = sinon.useFakeTimers();
+ clock.tick(1000);
+ spy = sinon.spy();
+
+ map = L.map(el, {
+ center: [51.505, -0.09],
+ zoom: 13,
+ tapHold: true
+ });
+ map.on('contextmenu', spy);
+
+ posStart.target = el;
+ posNear.target = el;
+ posFar.target = el;
+ });
+
+ afterEach(function () {
+ happen.once(el, {type: 'touchend'});
+ for (var id = 0; id <= 2; id++) { // reset pointers (for prosphetic-hand)
+ happen.once(el, {type: 'pointercancel', pointerId:id});
+ }
+ clock.restore();
+ map.remove();
+ document.body.removeChild(el);
+ });
+
+ it('fires synthetic contextmenu after hold delay>600', function () {
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(550);
+
+ expect(spy.notCalled).to.be.ok();
+
+ clock.tick(100);
+
+ expect(spy.called).to.be.ok();
+ expect(spy.calledOnce).to.be.ok();
+
+ var event = spy.lastCall.args[0];
+ expect(event.type).to.be('contextmenu');
+ expect(event.originalEvent._simulated).to.be.ok();
+ });
+
+ it('does not fire contextmenu when touches > 1', function () {
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(100);
+ happen.once(el, {type: 'touchstart', touches: [posStart, posNear]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:1}, posNear));
+ clock.tick(550);
+
+ expect(spy.notCalled).to.be.ok();
+ });
+
+ it('does not fire contextmenu when touches > 1 (case:2)', function () {
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(100);
+ happen.once(el, {type: 'touchstart', touches: [posStart, posNear]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:1}, posNear));
+ clock.tick(100);
+ happen.once(el, {type: 'touchend', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerup', pointerId:0}, posNear));
+ clock.tick(450);
+
+ expect(spy.notCalled).to.be.ok();
+ });
+
+ (L.Browser.pointer ? it : it.skip)('ignores events from mouse', function () {
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0, pointerType:'mouse'}, posStart));
+ clock.tick(650);
+
+ expect(spy.notCalled).to.be.ok();
+ });
+
+ it('does not conflict with native contextmenu', function () {
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(550);
+
+ happen.once(el, {type: 'contextmenu'});
+
+ clock.tick(100);
+
+ expect(spy.called).to.be.ok();
+ expect(spy.calledOnce).to.be.ok();
+ expect(spy.lastCall.args[0].originalEvent._simulated).not.to.be.ok();
+
+ // Note: depending on tapHoldDelay value it's also possible that native contextmenu may come after simulated one
+ // and the only way to handle this gracefully - increase tapHoldDelay value.
+ // Anyway that is edge case, as tapHold is meant for browsers where native contextmenu is not fired on touch.
+ });
+
+ it.skip('prevents native click', function () { // to be performed by hand
+ // Not valid here, as there is no way to initiate native click with fake touch
+ var clickSpy = sinon.spy();
+ map.on('click', clickSpy);
+
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(650);
+ happen.once(el, {type: 'touchend', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerup', pointerId:0}, posNear));
+
+ expect(clickSpy.notCalled).to.be.ok();
+ });
+
+ it('allows short movements', function () {
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(550);
+
+ happen.once(el, {type: 'touchmove', touches: [posNear]});
+ happen.once(el, L.extend({type: 'pointermove', pointerId:0}, posNear));
+
+ clock.tick(100);
+
+ expect(spy.called).to.be.ok();
+ });
+
+ it('ignores long movements', function () {
+ expect(L.point(posStart.clientX, posStart.clientY).distanceTo([posFar.clientX, posFar.clientY]))
+ .to.be.above(map.options.tapTolerance);
+
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(550);
+
+ happen.once(el, {type: 'touchmove', touches: [posFar]});
+ happen.once(el, L.extend({type: 'pointermove', pointerId:0}, posFar));
+
+ clock.tick(100);
+
+ expect(spy.notCalled).to.be.ok();
+ });
+
+ it('.originalEvent has expected properties', function () {
+ L.extend(posStart, {
+ screenX: 2,
+ screenY: 2,
+ });
+
+ happen.once(el, {type: 'touchstart', touches: [posStart]});
+ happen.once(el, L.extend({type: 'pointerdown', pointerId:0}, posStart));
+ clock.tick(650);
+
+ var originalEvent = spy.lastCall.args[0].originalEvent;
+ var expectedProps = L.extend({
+ type: 'contextmenu',
+ bubbles: true,
+ cancelable: true,
+ target: el
+ }, posStart);
+ for (var prop in expectedProps) {
+ expect(originalEvent[prop]).to.be(expectedProps[prop]);
+ }
+ });
+});
+
+// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent#polyfill
+// required for PhantomJS
+
+(function (window) {
+ try {
+ new MouseEvent('test'); // eslint-disable-line no-new
+ return false; // No need to polyfill
+ } catch (e) {
+ // Need to polyfill - fall through
+ }
+
+ // Polyfills DOM4 MouseEvent
+ var MouseEventPolyfill = function (eventType, params) {
+ params = params || {bubbles: false, cancelable: false};
+ var mouseEvent = document.createEvent('MouseEvent');
+ mouseEvent.initMouseEvent(eventType,
+ params.bubbles,
+ params.cancelable,
+ window,
+ 0,
+ params.screenX || 0,
+ params.screenY || 0,
+ params.clientX || 0,
+ params.clientY || 0,
+ params.ctrlKey || false,
+ params.altKey || false,
+ params.shiftKey || false,
+ params.metaKey || false,
+ params.button || 0,
+ params.relatedTarget || null
+ );
+
+ return mouseEvent;
+ };
+
+ MouseEventPolyfill.prototype = Event.prototype;
+
+ window.MouseEvent = MouseEventPolyfill;
+})(window);
diff --git a/spec/suites/map/handler/Map.TouchZoomSpec.js b/spec/suites/map/handler/Map.TouchZoomSpec.js
index 553417f113b..6ec6cd40af1 100644
--- a/spec/suites/map/handler/Map.TouchZoomSpec.js
+++ b/spec/suites/map/handler/Map.TouchZoomSpec.js
@@ -1,37 +1,38 @@
describe("Map.TouchZoom", function () {
- it.skipIfNotTouch("Increases zoom when pinching out", function (done) {
- var container = document.createElement('div');
+ var container, map;
+
+ beforeEach(function () {
+ container = document.createElement('div');
container.style.width = container.style.height = '600px';
container.style.top = container.style.left = 0;
container.style.position = 'absolute';
document.body.appendChild(container);
- var map = new L.Map(container, {
+ map = new L.Map(container, {
touchZoom: true,
inertia: false,
zoomAnimation: false // If true, the test has to wait extra 250msec
});
- map.setView([0, 0], 1);
+ });
- var hand = new Hand({
- timing: 'fastframe',
- onStop: function () {
- map.once('zoomend', function () {
- var center = map.getCenter();
- var zoom = map.getZoom();
- document.body.removeChild(container);
- expect(center.lat).to.be(0);
- expect(center.lng).to.be(0);
+ afterEach(function () {
+ map.remove();
+ document.body.removeChild(container);
+ });
- // Initial zoom 1, initial distance 50px, final distance 450px
- expect(zoom).to.be(4);
+ it.skipIfNotTouch("Increases zoom when pinching out", function (done) {
+ map.setView([0, 0], 1);
+ map.once('zoomend', function () {
+ expect(map.getCenter()).to.eql({lat:0, lng:0});
+ // Initial zoom 1, initial distance 50px, final distance 450px
+ expect(map.getZoom()).to.be(4);
- done();
- });
- }
+ done();
});
- var f1 = hand.growFinger('touch');
- var f2 = hand.growFinger('touch');
+
+ var hand = new Hand({timing: 'fastframe'});
+ var f1 = hand.growFinger(touchEventType);
+ var f2 = hand.growFinger(touchEventType);
hand.sync(5);
f1.wait(100).moveTo(275, 300, 0)
@@ -40,40 +41,19 @@ describe("Map.TouchZoom", function () {
.down().moveBy(200, 0, 500).up(100);
});
-
it.skipIfNotTouch("Decreases zoom when pinching in", function (done) {
- var container = document.createElement('div');
- container.style.width = container.style.height = '600px';
- container.style.top = container.style.left = 0;
- container.style.position = 'absolute';
- document.body.appendChild(container);
-
- var map = new L.Map(container, {
- touchZoom: true,
- inertia: false,
- zoomAnimation: false // If true, the test has to wait extra 250msec
- });
map.setView([0, 0], 4);
+ map.once('zoomend', function () {
+ expect(map.getCenter()).to.eql({lat:0, lng:0});
+ // Initial zoom 4, initial distance 450px, final distance 50px
+ expect(map.getZoom()).to.be(1);
- var hand = new Hand({
- timing: 'fastframe',
- onStop: function () {
- map.once('zoomend', function () {
- var center = map.getCenter();
- var zoom = map.getZoom();
- document.body.removeChild(container);
- expect(center.lat).to.be(0);
- expect(center.lng).to.be(0);
-
- // Initial zoom 4, initial distance 450px, final distance 50px
- expect(zoom).to.be(1);
-
- done();
- });
- }
+ done();
});
- var f1 = hand.growFinger('touch');
- var f2 = hand.growFinger('touch');
+
+ var hand = new Hand({timing: 'fastframe'});
+ var f1 = hand.growFinger(touchEventType);
+ var f2 = hand.growFinger(touchEventType);
hand.sync(5);
f1.wait(100).moveTo(75, 300, 0)
@@ -81,7 +61,4 @@ describe("Map.TouchZoom", function () {
f2.wait(100).moveTo(525, 300, 0)
.down().moveBy(-200, 0, 500).up(100);
});
-
-
-
});
diff --git a/src/Leaflet.js b/src/Leaflet.js
index 2b18450274a..f4339b9b812 100644
--- a/src/Leaflet.js
+++ b/src/Leaflet.js
@@ -22,6 +22,3 @@ export * from './layer/index';
// map
export * from './map/index';
-
-import {freeze} from './core/Util';
-Object.freeze = freeze;
diff --git a/src/control/Control.Attribution.js b/src/control/Control.Attribution.js
index 4b362331bae..6177c48e6dc 100644
--- a/src/control/Control.Attribution.js
+++ b/src/control/Control.Attribution.js
@@ -21,7 +21,8 @@ export var Attribution = Control.extend({
// @option prefix: String = 'Leaflet'
// The HTML text shown before the attributions. Pass `false` to disable.
- prefix: 'Leaflet'
+ prefix: 'Leaflet'
+
},
initialize: function (options) {
@@ -44,9 +45,24 @@ export var Attribution = Control.extend({
this._update();
+ map.on('layeradd', this._addAttribution, this);
+
return this._container;
},
+ onRemove: function (map) {
+ map.off('layeradd', this._addAttribution, this);
+ },
+
+ _addAttribution: function (ev) {
+ if (ev.layer.getAttribution) {
+ this.addAttribution(ev.layer.getAttribution());
+ ev.layer.once('remove', function () {
+ this.removeAttribution(ev.layer.getAttribution());
+ }, this);
+ }
+ },
+
// @method setPrefix(prefix: String): this
// Sets the text before the attributions.
setPrefix: function (prefix) {
diff --git a/src/control/Control.Layers.js b/src/control/Control.Layers.js
index 38cfa4cc0c3..f5718709d03 100644
--- a/src/control/Control.Layers.js
+++ b/src/control/Control.Layers.js
@@ -1,7 +1,6 @@
import {Control} from './Control';
import * as Util from '../core/Util';
-import * as Browser from '../core/Browser';
import * as DomEvent from '../dom/DomEvent';
import * as DomUtil from '../dom/DomUtil';
@@ -10,7 +9,7 @@ import * as DomUtil from '../dom/DomUtil';
* @aka L.Control.Layers
* @inherits Control
*
- * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`.
+ * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](https://leafletjs.com/examples/layers-control/)). Extends `Control`.
*
* @example
*
@@ -187,24 +186,25 @@ export var Layers = Control.extend({
if (collapsed) {
this._map.on('click', this.collapse, this);
- if (!Browser.android) {
- DomEvent.on(container, {
- mouseenter: this.expand,
- mouseleave: this.collapse
- }, this);
- }
+ DomEvent.on(container, {
+ mouseenter: function () {
+ DomEvent.on(section, 'click', DomEvent.preventDefault);
+ this.expand();
+ setTimeout(function () {
+ DomEvent.off(section, 'click', DomEvent.preventDefault);
+ });
+ },
+ mouseleave: this.collapse
+ }, this);
}
var link = this._layersLink = DomUtil.create('a', className + '-toggle', container);
link.href = '#';
link.title = 'Layers';
+ link.setAttribute('role', 'button');
- if (Browser.touch) {
- DomEvent.on(link, 'click', DomEvent.stop);
- DomEvent.on(link, 'click', this.expand, this);
- } else {
- DomEvent.on(link, 'focus', this.expand, this);
- }
+ DomEvent.on(link, 'click', DomEvent.preventDefault); // prevent link function
+ DomEvent.on(link, 'focus', this.expand, this);
if (!collapsed) {
this.expand();
@@ -289,11 +289,11 @@ export var Layers = Control.extend({
// @namespace Map
// @section Layer events
// @event baselayerchange: LayersControlEvent
- // Fired when the base layer is changed through the [layer control](#control-layers).
+ // Fired when the base layer is changed through the [layers control](#control-layers).
// @event overlayadd: LayersControlEvent
- // Fired when an overlay is selected through the [layer control](#control-layers).
+ // Fired when an overlay is selected through the [layers control](#control-layers).
// @event overlayremove: LayersControlEvent
- // Fired when an overlay is deselected through the [layer control](#control-layers).
+ // Fired when an overlay is deselected through the [layers control](#control-layers).
// @namespace Control.Layers
var type = obj.overlay ?
(e.type === 'add' ? 'overlayadd' : 'overlayremove') :
@@ -304,7 +304,7 @@ export var Layers = Control.extend({
}
},
- // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
+ // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see https://stackoverflow.com/a/119079)
_createRadioElement: function (name, checked) {
var radioHtml = '+'
// The text set on the 'zoom in' button.
- zoomInText: '+',
+ zoomInText: '',
// @option zoomInTitle: String = 'Zoom in'
// The title set on the 'zoom in' button.
zoomInTitle: 'Zoom in',
- // @option zoomOutText: String = '−'
+ // @option zoomOutText: String = ''
// The text set on the 'zoom out' button.
- zoomOutText: '−',
+ zoomOutText: '',
// @option zoomOutTitle: String = 'Zoom out'
// The title set on the 'zoom out' button.
@@ -105,12 +105,16 @@ export var Zoom = Control.extend({
DomUtil.removeClass(this._zoomInButton, className);
DomUtil.removeClass(this._zoomOutButton, className);
+ this._zoomInButton.setAttribute('aria-disabled', 'false');
+ this._zoomOutButton.setAttribute('aria-disabled', 'false');
if (this._disabled || map._zoom === map.getMinZoom()) {
DomUtil.addClass(this._zoomOutButton, className);
+ this._zoomOutButton.setAttribute('aria-disabled', 'true');
}
if (this._disabled || map._zoom === map.getMaxZoom()) {
DomUtil.addClass(this._zoomInButton, className);
+ this._zoomInButton.setAttribute('aria-disabled', 'true');
}
}
});
diff --git a/src/control/Control.js b/src/control/Control.js
index 301541914c4..1a07f2a5d9d 100644
--- a/src/control/Control.js
+++ b/src/control/Control.js
@@ -15,7 +15,7 @@ import * as DomUtil from '../dom/DomUtil';
export var Control = Class.extend({
// @section
- // @aka Control options
+ // @aka Control Options
options: {
// @option position: String = 'topright'
// The position of the control (one of the map corners). Possible values are `'topleft'`,
diff --git a/src/core/Browser.js b/src/core/Browser.js
index 669a1ecdfe9..0187d811686 100644
--- a/src/core/Browser.js
+++ b/src/core/Browser.js
@@ -19,108 +19,112 @@ import {svgCreate} from '../layer/vector/SVG.Util';
var style = document.documentElement.style;
// @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).
-export var ie = 'ActiveXObject' in window;
+var ie = 'ActiveXObject' in window;
// @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.
-export var ielt9 = ie && !document.addEventListener;
+var ielt9 = ie && !document.addEventListener;
// @property edge: Boolean; `true` for the Edge web browser.
-export var edge = 'msLaunchUri' in navigator && !('documentMode' in document);
+var edge = 'msLaunchUri' in navigator && !('documentMode' in document);
// @property webkit: Boolean;
// `true` for webkit-based browsers like Chrome and Safari (including mobile versions).
-export var webkit = userAgentContains('webkit');
+var webkit = userAgentContains('webkit');
// @property android: Boolean
-// `true` for any browser running on an Android platform.
-export var android = userAgentContains('android');
+// **Deprecated.** `true` for any browser running on an Android platform.
+var android = userAgentContains('android');
-// @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.
-export var android23 = userAgentContains('android 2') || userAgentContains('android 3');
+// @property android23: Boolean; **Deprecated.** `true` for browsers running on Android 2 or Android 3.
+var android23 = userAgentContains('android 2') || userAgentContains('android 3');
/* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */
var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit
-// @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome)
-export var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);
+// @property androidStock: Boolean; **Deprecated.** `true` for the Android stock browser (i.e. not Chrome)
+var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);
// @property opera: Boolean; `true` for the Opera browser
-export var opera = !!window.opera;
+var opera = !!window.opera;
// @property chrome: Boolean; `true` for the Chrome browser.
-export var chrome = userAgentContains('chrome');
+var chrome = !edge && userAgentContains('chrome');
// @property gecko: Boolean; `true` for gecko-based browsers like Firefox.
-export var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;
+var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;
// @property safari: Boolean; `true` for the Safari browser.
-export var safari = !chrome && userAgentContains('safari');
+var safari = !chrome && userAgentContains('safari');
-export var phantom = userAgentContains('phantom');
+var phantom = userAgentContains('phantom');
// @property opera12: Boolean
// `true` for the Opera browser supporting CSS transforms (version 12 or later).
-export var opera12 = 'OTransition' in style;
+var opera12 = 'OTransition' in style;
// @property win: Boolean; `true` when the browser is running in a Windows platform
-export var win = navigator.platform.indexOf('Win') === 0;
+var win = navigator.platform.indexOf('Win') === 0;
// @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.
-export var ie3d = ie && ('transition' in style);
+var ie3d = ie && ('transition' in style);
// @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.
-export var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;
+var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;
// @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.
-export var gecko3d = 'MozPerspective' in style;
+var gecko3d = 'MozPerspective' in style;
// @property any3d: Boolean
// `true` for all browsers supporting CSS transforms.
-export var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;
+var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;
// @property mobile: Boolean; `true` for all browsers running in a mobile device.
-export var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');
+var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');
// @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.
-export var mobileWebkit = mobile && webkit;
+var mobileWebkit = mobile && webkit;
// @property mobileWebkit3d: Boolean
// `true` for all webkit-based browsers in a mobile device supporting CSS transforms.
-export var mobileWebkit3d = mobile && webkit3d;
+var mobileWebkit3d = mobile && webkit3d;
// @property msPointer: Boolean
// `true` for browsers implementing the Microsoft touch events model (notably IE10).
-export var msPointer = !window.PointerEvent && window.MSPointerEvent;
+var msPointer = !window.PointerEvent && window.MSPointerEvent;
// @property pointer: Boolean
// `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
-export var pointer = !webkit && !!(window.PointerEvent || msPointer);
+var pointer = !!(window.PointerEvent || msPointer);
-// @property touch: Boolean
+// @property touchNative: Boolean
// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
-// This does not necessarily mean that the browser is running in a computer with
+// **This does not necessarily mean** that the browser is running in a computer with
// a touchscreen, it only means that the browser is capable of understanding
// touch events.
-export var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||
- (window.DocumentTouch && document instanceof window.DocumentTouch));
+var touchNative = 'ontouchstart' in window || !!window.TouchEvent;
+
+// @property touch: Boolean
+// `true` for all browsers supporting either [touch](#browser-touch) or [pointer](#browser-pointer) events.
+// Note: pointer events will be preferred (if available), and processed for all `touch*` listeners.
+var touch = !window.L_NO_TOUCH && (touchNative || pointer);
// @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.
-export var mobileOpera = mobile && opera;
+var mobileOpera = mobile && opera;
// @property mobileGecko: Boolean
// `true` for gecko-based browsers running in a mobile device.
-export var mobileGecko = mobile && gecko;
+var mobileGecko = mobile && gecko;
// @property retina: Boolean
// `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
-export var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
+var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
// @property passiveEvents: Boolean
// `true` for browsers that support passive events.
-export var passiveEvents = (function () {
+var passiveEvents = (function () {
var supportsPassiveOption = false;
try {
var opts = Object.defineProperty({}, 'passive', {
- get: function () {
+ get: function () { // eslint-disable-line getter-return
supportsPassiveOption = true;
}
});
@@ -130,21 +134,21 @@ export var passiveEvents = (function () {
// Errors can safely be ignored since this is only a browser support test.
}
return supportsPassiveOption;
-});
+}());
// @property canvas: Boolean
// `true` when the browser supports [`
map.getPaneor -map.getPanesmethods. New panes can be created with the -map.createPanemethod. -Every map has the following default panes that differ only in zIndex.