From 05e7d53486af0899a9c16d017ad5adbf37e8a092 Mon Sep 17 00:00:00 2001
From: Vladimir Agafonkin
center
- LatLng
+ null
null
Initial geographical center of the map.
zoom
- Number
+ null
null
Initial map zoom.
layers
- ILayer[]
+ null
null
Layers that will be added to the map initially.
minZoom
- Number
+ null
null
Minimum zoom level of the map. Overrides any
minZoom
set on map layers.
maxZoom
- Number
+ null
null
Maximum zoom level of the map. This overrides any
maxZoom
set on map layers.
maxBounds
- LatLngBounds
+ null
null
When this option is set, the map restricts the view to the given geographical bounds, bouncing the user back when he tries to pan outside the view. To set the restriction dynamically, use setMaxBounds method
@@ -228,68 +228,68 @@ var map = L.map('map', {
dragging
- Boolean
+ true
true
Whether the map be draggable with mouse/touch or not.
touchZoom
- Boolean
+ true
true
Whether the map can be zoomed by touch-dragging with two fingers.
scrollWheelZoom
- Boolean
- 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.
+ 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.
doubleClickZoom
- Boolean
- 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.
+ 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.
boxZoom
- Boolean
+ true
true
Whether the map can be zoomed to a rectangular area specified by dragging the mouse while pressing shift.
tap
- Boolean
+ true
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
15
The max number of pixels a user can shift his finger during touch for it to be considered a valid tap.
trackResize
- Boolean
+ true
true
Whether the map automatically handles browser window resize to update itself.
worldCopyJump
- Boolean
+ false
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.
closePopupOnClick
- Boolean
- true
Set it to
+ false
if you don't want popups to close when user clicks the map.
+ true
Set it to
false
if you don't want popups to close when user clicks the map.
@@ -305,19 +305,19 @@ var map = L.map('map', {
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.
+ 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.
keyboard
- Boolean
+ true
true
Makes the map focusable and allows users to navigate the map with keyboard arrows and
+
/-
keys.
keyboardPanOffset
- Number
+ 80
80
Amount of pixels to pan when pressing an arrow key.
@@ -334,26 +334,26 @@ var map = L.map('map', {
keyboardZoomOffset
- Number
+ 1
1
Number of zoom levels to change when pressing
+
or -
key.
inertia
- Boolean
+ true
true
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.
inertiaDeceleration
- Number
+ 3000
3000
The rate with which the inertial movement slows down, in pixels/second2.
inertiaMaxSpeed
- Number
+ 1500
1500
Max speed of the inertial movement, in pixels/second.
@@ -369,13 +369,13 @@ var map = L.map('map', {
inertiaThreshold
Number
- depends
Number of milliseconds that should pass between stopping the movement and releasing the mouse or touch to prevent inertial movement.
+ 32
for touch devices and 14
for the rest by default.Number of milliseconds that should pass between stopping the movement and releasing the mouse or touch to prevent inertial movement.
32
for touch devices and 14
for the rest by default.
zoomControl
- Boolean
+ true
true
Whether the zoom control is added to the map by default.
@@ -404,7 +404,7 @@ var map = L.map('map', {
attributionControl
- Boolean
+ true
true
Whether the attribution control is added to the map by default.
zoomAnimationThreshold
- Number
4
+ 4
Won't animate zoom if the zoom difference exceeds this value.
@@ -613,7 +613,7 @@ var map = L.map('map', {
+ this
this
Sets the view of the map (geographical center and zoom) with the given animation options.
@@ -621,7 +621,7 @@ var map = L.map('map', {
+ this
this
Sets the zoom of the map.
@@ -629,16 +629,16 @@ var map = L.map('map', {
- this
Increases the zoom of the map by
+ delta
(1
by default).
+ this
Increases the zoom of the map by
delta
(1
by default).
- zoomOut(
- this
Decreases the zoom of the map by
+ delta
(1
by default).
+ this
Decreases the zoom of the map by
delta
(1
by default).
- setZoomAround(
@@ -646,7 +646,7 @@ var map = L.map('map', {
+ this
this
Zooms the map while keeping a specified point on the map stationary (e.g. used internally for scroll zoom and double-click zoom).
@@ -654,14 +654,14 @@ var map = L.map('map', {
+ this
this
Sets a map view that contains the given geographical bounds with the maximum zoom level possible.
- fitWorld(
+ this
this
Sets a map view that mostly contains the whole world with the maximum zoom level possible.
@@ -669,7 +669,7 @@ var map = L.map('map', {
+ this
this
Pans the map to a given center. Makes an animated pan if new center is not more than one screen away from the current one.
@@ -677,7 +677,7 @@ var map = L.map('map', {
+ this
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.
@@ -685,46 +685,46 @@ var map = L.map('map', {
+ this
this
Pans the map by a given number of pixels (animated).
- invalidateSize(
+ this
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.
- invalidateSize(
- 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.
+ 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.
- setMaxBounds(
+ this
this
Restricts the map view to the given bounds (see map maxBounds option).
- locate(
+ this
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). See Locate options for more details.
- stopLocate()
+ this
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}
.
@@ -770,7 +770,7 @@ var map = L.map('map', {
- remove()
+ this
this
Destroys the map and clears all related event listeners.
- 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.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.
@@ -802,7 +802,7 @@ var map = L.map('map', {
getSize()
+ this
this
Adds the given layer to the map.
@@ -810,7 +810,7 @@ var map = L.map('map', {
+ this
this
Removes the given layer from the map.
@@ -819,14 +819,14 @@ var map = L.map('map', {
- Boolean
Returns
+ true
if the given layer is currently added to the map.Returns
true
if the given layer is currently added to the map.
- eachLayer(
+ this
this
Iterates over the layers of the map, optionally specifying context of the iterator function.
- map.eachLayer(function (layer) {
layer.bindPopup('Hello');
@@ -839,7 +839,7 @@ var map = L.map('map', {
+ this
this
Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
@@ -849,14 +849,14 @@ var map = L.map('map', {
+ this
this
Creates a popup with the specified options and opens it in the given point on a map.
- closePopup(
+ this
this
Closes the popup previously opened with openPopup (or the given one).
@@ -864,7 +864,7 @@ var map = L.map('map', {
+ this
this
Adds the given control to the map.
@@ -872,7 +872,7 @@ var map = L.map('map', {
@@ -1017,37 +1017,37 @@ var map = L.map('map', {
+ this
this
Removes the given control from the map.
watch
- Boolean
- false
If
+ true
, starts continous watching of location changes (instead of detecting it once) using W3C watchPosition
method. You can later stop watching using map.stopLocate()
method.
+ false
If
true
, starts continous 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.
+ 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
Infinity
The maximum zoom for automatic view setting when using `setView` option.
timeout
- Number
+ 10000
10000
Number of milliseconds to wait for a response from geolocation before firing a
locationerror
event.
maximumAge
- Number
+ 0
0
Maximum age of detected location. If less than this amount of milliseconds passed since last geolocation response,
locate
will return a cached location.
@@ -1065,8 +1065,8 @@ var map = L.map('map', {
enableHighAccuracy
- Boolean
+ false
false
Enables high accuracy, see description in the W3C spec.
reset
- Boolean
- false
If
+ true
, the map view will be completely reset (without any animations).
+ false
If
true
, the map view will be completely reset (without any animations).
@@ -1083,7 +1083,7 @@ var map = L.map('map', {
pan
@@ -1101,25 +1101,25 @@ var map = L.map('map', {
animate
- Boolean
+ -
-
An equivalent of passing
animate
to both zoom and pan options (see below).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).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
0.25
Duration of animated panning.
easeLinearity
- Number
- 0.25
The curvature factor of panning animation easing (third parameter of the Cubic Bezier curve). 1.0 means linear animation, the less the more bowed the curve.
+
+ 0.25
The curvature factor of panning animation easing (third parameter of the Cubic Bezier curve). 1.0 means linear animation, the less the more bowed the curve.
@@ -1136,7 +1136,7 @@ var map = L.map('map', {
noMoveStart
- Boolean
- false
If
+ true
, panning won't fire movestart
event on start (used internally for panning inertia).
+ false
If
true
, panning won't fire movestart
event on start (used internally for panning inertia).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.If not specified, zoom animation will happen if the zoom origin is inside the current view. If
@@ -1154,25 +1154,25 @@ var map = L.map('map', {
true
, the map will attempt animating zoom disregarding where zoom origin is. Setting false
will make it always reset the view completely without animation.
paddingTopLeft
- Point
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
The same for bottom right corner of the map.
padding
- Point
Equivalent of setting both top left and bottom right padding to the same value.
@@ -1332,55 +1332,55 @@ var map = L.map('map', {
maxZoom
- Number
+ The maximum possible zoom to use.
clickable
- Boolean
- true
If
+ false
, the marker will not emit mouse events and will act as a part of the underlying map.
+ true
If
false
, the marker will not emit mouse events and will act as a part of the underlying map.
draggable
- Boolean
+ false
false
Whether the marker is draggable with mouse/touch or not.
keyboard
- Boolean
+ true
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
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
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.
+ false
If
true
, the marker will get on top of others when you hover the mouse over it.
@@ -1480,7 +1480,7 @@ var map = L.map('map', {
riseOffset
- Number
+ 250
250
The z-index offset used for the
riseOnHover
feature.
+ this
this
Adds the marker to the map.
@@ -1493,7 +1493,7 @@ var map = L.map('map', {
+ this
this
Changes the marker position to the given point.
@@ -1501,7 +1501,7 @@ var map = L.map('map', {
+ this
this
Changes the marker icon.
@@ -1509,21 +1509,21 @@ var map = L.map('map', {
+ this
this
Changes the zIndex offset of the marker.
- setOpacity(
+ this
this
Changes the opacity of the marker.
- update()
+ this
this
Updates the marker position, useful if coordinates of its
latLng
object were changed directly.
@@ -1532,17 +1532,17 @@ var map = L.map('map', {
+ this
this
Binds a popup with a particular HTML content to a click on this marker. You can also open the bound popup with the Marker openPopup method.
- unbindPopup()
+ this
this
Unbinds the popup previously bound to the marker with
bindPopup
.
- openPopup()
+ this
this
Opens the popup previously bound by the bindPopup method.
@@ -1552,12 +1552,12 @@ var map = L.map('map', {
- closePopup()
+ this
this
Closes the bound popup of the marker if it's opened.
- togglePopup()
+ this
this
Toggles the popup previously bound by the bindPopup method.
@@ -1565,7 +1565,7 @@ var map = L.map('map', {
+ this
this
Sets an HTML content of the popup of this marker.
@@ -1641,83 +1641,83 @@ var map = L.map('map', {
maxWidth
- Number
+ 300
300
Max width of the popup.
minWidth
- Number
+ 50
50
Min width of the popup.
maxHeight
- Number
+ null
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.
+ true
Set it to
false
if you don't want the map to do panning animation to fit the opened popup.
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.
+ 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
true
Controls the presense of a close button in the popup.
offset
- Point
The offset of the popup position. Useful to control the anchor of the popup when opening it on some overlays.
autoPanPaddingTopLeft
- Point
+ null
null
The margin between the popup and the top left corner of the map view after autopanning was performed.
autoPanPaddingBottomRight
- Point
+ null
null
The margin between the popup and the bottom right corner of the map view after autopanning was performed.
autoPanPadding
- Point
Equivalent of setting both top left and bottom right autopan padding to the same value.
zoomAnimation
- Boolean
+ true
true
Whether to animate the popup on zoom. Disable it if you have problems with Flash content inside popups.
closeOnClick
- Boolean
- null
Set it to
+ false
if you want to override the default behavior of the popup closing when user clicks the map (set globally by the Map
closePopupOnClick
option).
+ null
Set it to
false
if you want to override the default behavior of the popup closing when user clicks the map (set globally by the Map
closePopupOnClick
option).
@@ -1735,7 +1735,7 @@ var map = L.map('map', {
className
- String
+ ''
''
A custom class name to assign to the popup.
+ this
this
Adds the popup to the map.
@@ -1743,7 +1743,7 @@ var map = L.map('map', {
+ this
this
Adds the popup to the map and closes the previous one. The same as
map.openPopup(popup)
.
@@ -1751,7 +1751,7 @@ var map = L.map('map', {
+ this
this
Sets the geographical point where the popup will open.
@@ -1764,7 +1764,7 @@ var map = L.map('map', {
+ this
this
Sets the HTML content of the popup.
@@ -1775,7 +1775,7 @@ var map = L.map('map', {
@@ -1833,115 +1833,115 @@ var map = L.map('map', {
- update()
+ this
this
Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
minZoom
- Number
+ 0
0
Minimum zoom number.
maxZoom
- Number
+ 18
18
Maximum zoom number.
maxNativeZoom
- Number
+ null
null
Maximum zoom number the tiles source has available. If it is specified, the tiles on all zoom levels higher than
maxNativeZoom
will be loaded from maxZoom
level and auto-scaled.
tileSize
- Number
+ 256
256
Tile size (width and height in pixels, assuming tiles are square).
subdomains
- String
or String[]
+ 'abc'
'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.
attribution
- String
+ ''
''
e.g. "© Mapbox" — the string used by the attribution control, describes the layer data.
tms
- Boolean
- false
If
+ true
, inverses Y axis numbering for tiles (turn this on for TMS services).
+ false
If
true
, inverses Y axis numbering for tiles (turn this on for TMS services).
continuousWorld
- Boolean
- false
If set to
+ true
, the tile coordinates won't be wrapped by world width (-180 to 180 longitude) or clamped to lie within world height (-90 to 90). Use this if you use Leaflet for maps that don't reflect the real world (e.g. game, indoor or photo maps).
+ false
If set to
true
, the tile coordinates won't be wrapped by world width (-180 to 180 longitude) or clamped to lie within world height (-90 to 90). Use this if you use Leaflet for maps that don't reflect the real world (e.g. game, indoor or photo maps).
noWrap
- Boolean
- false
If set to
+ true
, the tiles just won't load outside the world width (-180 to 180 longitude) instead of repeating.
+ false
If set to
true
, the tiles just won't load outside the world width (-180 to 180 longitude) instead of repeating.
zoomOffset
- Number
+ 0
0
The zoom number used in tile URLs will be offset with this value.
zoomReverse
- Boolean
- false
If set to
+ true
, the zoom number used in tile URLs will be reversed (maxZoom - zoom
instead of zoom
)
+ false
If set to
true
, the zoom number used in tile URLs will be reversed (maxZoom - zoom
instead of zoom
)
opacity
- Number
+ 1.0
1.0
The opacity of the tile layer.
zIndex
- Number
+ null
null
The explicit zIndex of the tile layer. Not set by default.
unloadInvisibleTiles
Boolean
depends
- If
+ true
, all the tiles that are not visible after panning are removed (for better performance). true
by default on mobile WebKit, otherwise false
.If
true
, all the tiles that are not visible after panning are removed (for better performance). true
by default on mobile WebKit, otherwise false
.
updateWhenIdle
Boolean
depends
- If
+ false
, new tiles are loaded during panning, otherwise only after it (for better performance). true
by default on mobile WebKit, otherwise false
.If
false
, new tiles are loaded during panning, otherwise only after it (for better performance). true
by default on mobile WebKit, otherwise false
.
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.
+ 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.
reuseTiles
- Boolean
- false
If
+ true
, all the tiles that are not visible after panning are placed in a reuse queue from which they will be fetched when new tiles become visible (as opposed to dynamically creating new ones). This will in theory keep memory usage low and eliminate the need for reserving new memory whenever a new tile is needed.
+ false
If
true
, all the tiles that are not visible after panning are placed in a reuse queue from which they will be fetched when new tiles become visible (as opposed to dynamically creating new ones). This will in theory keep memory usage low and eliminate the need for reserving new memory whenever a new tile is needed.
@@ -1996,17 +1996,17 @@ var map = L.map('map', {
bounds
- LatLngBounds
+ null
null
When this option is set, the TileLayer only loads tiles that are in the given geographical bounds.
+ this
this
Adds the layer to the map.
- bringToFront()
+ this
this
Brings the tile layer to the top of all tile layers.
- bringToBack()
+ this
this
Brings the tile layer to the bottom of all tile layers.
@@ -2014,7 +2014,7 @@ var map = L.map('map', {
+ this
this
Changes the opacity of the tile layer.
@@ -2022,19 +2022,19 @@ var map = L.map('map', {
+ this
this
Sets the zIndex of the tile layer.
- redraw()
+ this
this
Causes the layer to clear all the tiles and request them again.
- setUrl(
+ this
this
Updates the layer's URL template and redraws it.
@@ -2092,37 +2092,37 @@ var map = L.map('map', {
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).
+ '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.
+ false
If
true
, the WMS service will return images with transparency.
version
- String
+ '1.1.1'
'1.1.1'
Version of the WMS service to use.
@@ -2140,8 +2140,8 @@ var map = L.map('map', {
crs
- CRS
+ null
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.
- this
Merges an object with the new parameters and re-requests tiles on the current screen (unless
+ noRedraw
was set to true
).
+ this
Merges an object with the new parameters and re-requests tiles on the current screen (unless
@@ -2187,7 +2187,7 @@ canvasTiles.drawTile = function(canvas, tilePoint, zoom) {
noRedraw
was set to true
).
@@ -2206,7 +2206,7 @@ canvasTiles.drawTile = function(canvas, tilePoint, zoom) {
async
- Boolean
+ false
false
Indicates that tiles will be drawn asynchronously. tileDrawn method should be called for each tile after drawing completion.
+ this
this
You need to define this method after creating the instance to draw tiles;
canvas
is the actual canvas tile on which you can draw, tilePoint
represents the tile numbers, and zoom
is the current zoom.
@@ -2259,13 +2259,13 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
opacity
- Number
+ 1.0
1.0
The opacity of the image overlay.
@@ -2282,7 +2282,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
attribution
- String
+ ''
''
The attribution text of the image overlay.
+ this
this
Adds the overlay to the map.
@@ -2290,7 +2290,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
+ this
this
Sets the opacity of the overlay.
@@ -2298,17 +2298,17 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
+ this
this
Changes the URL of the image.
- bringToFront()
+ this
this
Brings the layer to the top of all overlays.
@@ -2328,32 +2328,32 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
- bringToBack()
+ this
this
Brings the layer to the bottom of all overlays.
stroke
- Boolean
- true
Whether to draw stroke along the path. Set it to
+ false
to disable borders on polygons or circles.
+ true
Whether to draw stroke along the path. Set it to
false
to disable borders on polygons or circles.
color
- String
+ '#03f'
'#03f'
Stroke color.
weight
- Number
+ 5
5
Stroke width in pixels.
opacity
- Number
+ 0.5
0.5
Stroke opacity.
fill
Boolean
depends
- Whether to fill the path with color. Set it to
+ false
to disable filling on polygons or circles.Whether to fill the path with color. Set it to
false
to disable filling on polygons or circles.
@@ -2364,49 +2364,49 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
fillColor
fillOpacity
- Number
+ 0.2
0.2
Fill opacity.
fillRule
- String
+ 'evenodd'
'evenodd'
A string that defines how the inside of a shape is determined.
dashArray
- String
+ null
null
A string that defines the stroke dash pattern. Doesn't work on canvas-powered layers (e.g. Android 2).
lineCap
- String
+ null
null
A string that defines shape to be used at the end of the stroke.
lineJoin
- String
+ null
null
A string that defines shape to be used at the corners of the stroke.
clickable
- Boolean
- true
If
+ false
, the vector will not emit mouse events and will act as a part of the underlying map.
+ true
If
false
, the vector will not emit mouse events and will act as a part of the underlying map.
pointerEvents
- String
+ null
null
Sets the
pointer-events
attribute on the path if SVG backend is used.
@@ -2485,7 +2485,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
className
- String
+ ''
''
Custom class name set on an element.
+ this
this
Adds the layer to the map.
@@ -2494,7 +2494,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
+ this
this
Binds a popup with a particular HTML content to a click on this path.
@@ -2503,12 +2503,12 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
+ this
this
Binds a given popup object to the path.
- unbindPopup()
+ this
this
Unbinds the popup previously bound to the path with
bindPopup
.
@@ -2516,13 +2516,13 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
+ this
this
Opens the popup previously bound by the bindPopup method in the given point, or in one of the path's points if not specified.
- closePopup()
+ this
this
Closes the path's bound popup if it is opened.
@@ -2530,7 +2530,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
+ this
this
Changes the appearance of a Path based on the options in the Path options object.
@@ -2540,17 +2540,17 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
- bringToFront()
+ this
this
Brings the layer to the top of all path layers.
- bringToBack()
+ this
this
Brings the layer to the bottom of all path layers.
@@ -2579,12 +2579,12 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map);
- redraw()
+ this
this
Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
CANVAS
Boolean
depends
- True if Canvas is used for vector rendering (Android 2). You can also force this by setting global variable
+ L_PREFER_CANVAS
to true
before the Leaflet include on your page — sometimes it can increase performance dramatically when rendering thousands of circle markers, but currently suffers from a bug that causes removing such layers to be extremely slow.True if Canvas is used for vector rendering (Android 2). You can also force this by setting global variable
L_PREFER_CANVAS
to true
before the Leaflet include on your page — sometimes it can increase performance dramatically when rendering thousands of circle markers, but currently suffers from a bug that causes removing such layers to be extremely slow.
@@ -2634,13 +2634,13 @@ map.fitBounds(polyline.getBounds());
CLIP_PADDING
- Number
+ 0.5
for SVG0.02
for VML0.5
for SVG0.02
for VMLHow much to extend the clip area around the map view (relative to its size, e.g. 0.5 is half the screen in each direction). Smaller values mean that you will see clipped ends of paths while you're dragging the map, and bigger values decrease drawing performance.
smoothFactor
- Number
+ 1.0
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.
@@ -2660,7 +2660,7 @@ map.fitBounds(polyline.getBounds());
noClip
- Boolean
+ false
false
Disabled polyline clipping.
+ this
this
Adds a given point to the polyline.
@@ -2668,7 +2668,7 @@ map.fitBounds(polyline.getBounds());
+ this
this
Replaces all the points in the polyline with the given array of geographical points.
@@ -2742,7 +2742,7 @@ multiple line features:
@@ -2851,7 +2851,7 @@ multiple polygon features:
+ this
this
Replace all lines and their paths with the given array of arrays of
geographical points.
this
this
this
this
this
this
this
this
this
this
this
this
this
this
this
this
this
this
this
this
Boolean
true
if the given layer is currently added to the group.true
if the given layer is currently added to the group.getLayer(
@@ -3142,7 +3142,7 @@ map.fitBounds(bounds);
clearLayers()
this
this
this
this
group.eachLayer(function (layer) {
layer.bindPopup('Hello');
@@ -3210,7 +3210,7 @@ map.fitBounds(bounds);
this
this
bindPopup
method.setStyle(
<Path options> style )
this
this
setStyle
method.bringToFront()
this
this
bringToBack()
this
this
this
this
this
this
LatLng
reverse
is set to true
, the numbers will be interpreted as (longitude, latitude).reverse
is set to true
, the numbers will be interpreted as (longitude, latitude).coordsToLatLngs(
@@ -3439,7 +3439,7 @@ map.fitBounds(bounds);
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). If reverse
is set to true
, the numbers will be interpreted as (longitude, latitude).levelsDeep
specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). If reverse
is set to true
, the numbers will be interpreted as (longitude, latitude).Boolean
true
if the given LatLng point is at the same position (within a small margin of error).true
if the given LatLng point is at the same position (within a small margin of error).toString()
LatLng
LatLng
object with the longitude wrapped around left
and right
boundaries (-180
to 180
by default).LatLng
object with the longitude wrapped around left
and right
boundaries (-180
to 180
by default).DEG_TO_RAD
Number
Math.PI / 180
Math.PI / 180
RAD_TO_DEG
Number
180 / Math.PI
180 / Math.PI
MAX_MARGIN
Number
1.0E-9
1.0E-9
this
this
Boolean
true
if the rectangle contains the given one.true
if the rectangle contains the given one.contains(
@@ -3686,7 +3686,7 @@ map.panTo(L.latLng(50, 30));
Boolean
true
if the rectangle contains the given point.true
if the rectangle contains the given point.intersects(
@@ -3694,7 +3694,7 @@ map.panTo(L.latLng(50, 30));
Boolean
true
if the rectangle intersects the given bounds.true
if the rectangle intersects the given bounds.equals(
@@ -3702,12 +3702,12 @@ map.panTo(L.latLng(50, 30));
Boolean
true
if the rectangle is equivalent (within a small margin of error) to the given bounds.true
if the rectangle is equivalent (within a small margin of error) to the given bounds.toBBoxString()
String
'southwest_lng,southwest_lat,northeast_lng,northeast_lat'
format. Useful for sending requests to web services that return geo data.'southwest_lng,southwest_lat,northeast_lng,northeast_lat'
format. Useful for sending requests to web services that return geo data.pad(
@@ -3722,7 +3722,7 @@ map.panTo(L.latLng(50, 30));
Boolean
true
if the bounds are properly initialized.true
if the bounds are properly initialized.x
and y
coordinates. If optional round
is set to true
, rounds the x
and y
values.x
and y
coordinates. If optional round
is set to true
, rounds the x
and y
values.Point
round
is set to true
, returns a rounded result.round
is set to true
, returns a rounded result.distanceTo(
@@ -3847,7 +3847,7 @@ map.panBy(L.point(200, 300));
Boolean
true
if the given point has the same coordinates.true
if the given point has the same coordinates.contains(
@@ -3855,7 +3855,7 @@ map.panBy(L.point(200, 300));
Boolean
true
if the both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).true
if the both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).toString()
Boolean
true
if the rectangle contains the given one.true
if the rectangle contains the given one.contains(
@@ -3960,7 +3960,7 @@ map.panBy(L.point(200, 300));
Boolean
true
if the rectangle contains the given point.true
if the rectangle contains the given point.intersects(
@@ -3968,13 +3968,13 @@ map.panBy(L.point(200, 300));
Boolean
true
if the rectangle intersects the given bounds.true
if the rectangle intersects the given bounds.isValid()
Boolean
true
if the bounds are properly initialized.true
if the bounds are properly initialized.getSize()
By default, it has a 'leaflet-div-icon'
class and is styled as a little white square with a shadow.
By default, it has a 'leaflet-div-icon'
class and is styled as a little white square with a shadow.
className
String
- 'leaflet-div-icon'
by default.'leaflet-div-icon'
by default.html
position
String
'topright'
'topright'
this
this
this
this
this
this
'topleft'
'topleft'
'topright'
'topright'
'bottomleft'
'bottomleft'
'bottomright'
'bottomright'
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.
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.
position |
String |
- 'topleft' |
+ 'topleft' |
The position of the control (one of the map corners). See control positions. |
zoomInText |
String |
- '+' |
+ '+' |
The text set on the zoom in button. |
zoomOutText |
String |
- '-' |
+ '-' |
The text set on the zoom out button. |
zoomInTitle |
String |
- 'Zoom in' |
+ 'Zoom in' |
The title set on the zoom in button. |
zoomOutTitle |
String |
- 'Zoom out' |
+ 'Zoom out' |
The title set on the zoom out button. |
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 getAttribution
method automatically. Extends Control.
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 getAttribution
method automatically. Extends Control.
position |
String |
- 'bottomright' |
+ 'bottomright' |
The position of the control (one of the map corners). See control positions. | |
prefix |
String |
- 'Leaflet' |
- The HTML text shown before the attributions. Pass false to disable. |
+ 'Leaflet' |
+ The HTML text shown before the attributions. Pass false to disable. |
setPrefix(
<String> prefix )
this
this
addAttribution(
<String> text )
this
'Vector data © Mapbox'
).this
'Vector data © Mapbox'
).removeAttribution(
<String> text )
this
this
this
this
this
this
removeLayer(
<ILayer> layer )
this
this
position
String
'topright'
'topright'
collapsed
Boolean
true
true
, the control will be collapsed into an icon and expanded on mouse hover or touch.true
true
, the control will be collapsed into an icon and expanded on mouse hover or touch.autoZIndex
Boolean
true
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.true
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.position
String
'bottomleft'
'bottomleft'
maxWidth
Number
100
100
metric
Boolean
true
true
imperial
Boolean
true
true
updateWhenIdle
Boolean
false
true
, the control is updated on moveend
, otherwise it's always up-to-date (updated on move
).false
true
, the control is updated on moveend
, otherwise it's always up-to-date (updated on move
).A set of methods shared between event-powered classes (like Map). 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 'click'
event).
A set of methods shared between event-powered classes (like Map). 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 'click'
event).
this
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'
).this
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'
).addOneTimeEventListener(
@@ -4648,7 +4648,7 @@ map.off('click', onClick);
this
this
this
this
{click: onClick, mousemove: onMouseMove}
this
this
addEventListener
, you must pass the same context to removeEventListener
in order to remove the listener.this
this
removeEventListener()
this
this
clearAllEventListeners
when you use it without arguments.Boolean
true
if a particular event type has some listeners attached to it.true
if a particular event type has some listeners attached to it.fireEvent(
@@ -4699,33 +4699,33 @@ map.off('click', onClick);
this
this
clearAllEventListeners()
this
this
on( … )
this
this
addEventListener
.once( … )
this
this
addOneTimeEventListener
.off( … )
this
this
removeEventListener
.fire( … )
this
this
fireEvent
.type
String
'click'
).'click'
).target
ie
Boolean
true
for all Internet Explorer versions.true
for all Internet Explorer versions.ie6
Boolean
true
for Internet Explorer 6.true
for Internet Explorer 6.ie7
Boolean
true
for Internet Explorer 7.true
for Internet Explorer 7.webkit
Boolean
true
for webkit-based browsers like Chrome and Safari (including mobile versions).true
for webkit-based browsers like Chrome and Safari (including mobile versions).webkit3d
Boolean
true
for webkit-based browsers that support CSS 3D transformations.true
for webkit-based browsers that support CSS 3D transformations.android
Boolean
true
for Android mobile browser.true
for Android mobile browser.android23
Boolean
true
for old Android stock browsers (2 and 3).true
for old Android stock browsers (2 and 3).mobile
Boolean
true
for modern mobile browsers (including iOS Safari and different Android browsers).true
for modern mobile browsers (including iOS Safari and different Android browsers).mobileWebkit
Boolean
true
for mobile webkit-based browsers.true
for mobile webkit-based browsers.mobileOpera
Boolean
true
for mobile Opera.true
for mobile Opera.touch
Boolean
true
for all browsers on touch devices.true
for all browsers on touch devices.msTouch
Boolean
true
for browsers with Microsoft touch model (e.g. IE10).true
for browsers with Microsoft touch model (e.g. IE10).retina
Boolean
true
for devices with Retina screens.true
for devices with Retina screens.Function
fn
with the given scope obj
(so that this
keyword refers to obj
inside the function code). Has an L.bind
shortcut. Not a polyfill for ES 5 bind
(compare L.bind
to the MDN-recommended polyfill for Function.prototype.bind
).fn
with the given scope obj
(so that this
keyword refers to obj
inside the function code). Has an L.bind
shortcut. Not a polyfill for ES 5 bind
(compare L.bind
to the MDN-recommended polyfill for Function.prototype.bind
).stamp( <Object> obj )
falseFn()
Function
false
.false
.formatNum(
@@ -5351,7 +5351,7 @@ MyClass.FOO; // 'bar'
String
{a: "foo", b: "bar"}
'?a=foo&b=bar'
.{a: "foo", b: "bar"}
'?a=foo&b=bar'
.template(
@@ -5359,7 +5359,7 @@ MyClass.FOO; // 'bar'
String
'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.'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(
@@ -5367,7 +5367,7 @@ MyClass.FOO; // 'bar'
Boolean
true
if the given object is an array.true
if the given object is an array.trim(
@@ -5562,8 +5562,8 @@ MyClass.FOO; // 'bar'
this
fn
to the element's DOM event of the specified type. this
keyword inside the listener will point to context
, or to the element if not specified.this
fn
to the element's DOM event of the specified type. this
keyword inside the listener will point to context
, or to the element if not specified.removeListener(
@@ -5572,7 +5572,7 @@ MyClass.FOO; // 'bar'
this
this
this
this
L.DomEvent.addListener(div, 'click', function (e) {
L.DomEvent.stopPropagation(e);
@@ -5592,7 +5592,7 @@ MyClass.FOO; // 'bar'
this
this
href
of the a
element, or doing a POST
request with page reload when form
is submitted). Use it inside listener functions.
this
this
stopPropagation
and preventDefault
at the same time.this
stopPropagation
to the element's 'click'
, 'doubleclick'
, 'mousedown'
and 'touchstart'
events.this
stopPropagation
to the element's 'click'
, 'doubleclick'
, 'mousedown'
and 'touchstart'
events.getMousePosition(
@@ -5700,7 +5700,7 @@ MyClass.FOO; // 'bar'
Boolean
true
if the element class attribute contains name
.true
if the element class attribute contains name
.addClass(
@@ -5736,8 +5736,8 @@ MyClass.FOO; // 'bar'
String
or false
false
. Useful for vendor-prefixed styles like transform
.String
or false
false
. Useful for vendor-prefixed styles like transform
.getTranslateString(
@@ -5764,7 +5764,7 @@ MyClass.FOO; // 'bar'
point
, using CSS translate or top/left positioning depending on the browser (used by Leaflet internally to position its layers). Forces top/left positioning if disable3D
is true
.point
, using CSS translate or top/left positioning depending on the browser (used by Leaflet internally to position its layers). Forces top/left positioning if disable3D
is true
.getPosition(
@@ -5788,7 +5788,7 @@ MyClass.FOO; // 'bar'
TRANSITION
String
'webkitTransition'
for WebKit).'webkitTransition'
for WebKit).TRANSFORM
@@ -5837,8 +5837,8 @@ fx.run(el, [300, 500], 0.5);
this
0.25
by default) and easing linearity factor (3rd argument of the cubic bezier curve, 0.5
by default)this
0.25
by default) and easing linearity factor (3rd argument of the cubic bezier curve, 0.5
by default)START
String
'mousedown'
for desktop browsers, 'touchstart'
for mobile devices.'mousedown'
for desktop browsers, 'touchstart'
for mobile devices.MOVE
String
'mousemove'
for desktop browsers, 'touchmove'
for mobile devices.'mousemove'
for desktop browsers, 'touchmove'
for mobile devices.END
String
'mouseup'
for desktop browsers, 'touchend'
for mobile devices.'mouseup'
for desktop browsers, 'touchend'
for mobile devices.enabled()
Boolean
true
if the handler is enabled.true
if the handler is enabled.code
String
'EPSG:3857'
).'EPSG:3857'
).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:
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_PREFER_CANVAS = true;</script>
<script src="leaflet.js"></script>