@types/leaflet
- Version 1.9.16
- Published
- 113 kB
- 1 dependency
- MIT license
Install
npm i @types/leaflet
yarn add @types/leaflet
pnpm add @types/leaflet
Overview
TypeScript definitions for leaflet
Index
Variables
Functions
Classes
Layer
- addInteractiveTarget()
- addTo()
- beforeAdd()
- bindPopup()
- bindTooltip()
- closePopup()
- closeTooltip()
- getAttribution()
- getEvents()
- getPane()
- getPopup()
- getTooltip()
- isPopupOpen()
- isTooltipOpen()
- onAdd()
- onRemove()
- openPopup()
- openTooltip()
- options
- remove()
- removeFrom()
- removeInteractiveTarget()
- setPopupContent()
- setTooltipContent()
- togglePopup()
- toggleTooltip()
- unbindPopup()
- unbindTooltip()
Map
- addControl()
- addHandler()
- addLayer()
- attributionControl
- boxZoom
- closePopup()
- closeTooltip()
- containerPointToLatLng()
- containerPointToLayerPoint()
- createPane()
- distance()
- doubleClickZoom
- dragging
- eachLayer()
- fitBounds()
- fitWorld()
- flyTo()
- flyToBounds()
- getBounds()
- getBoundsZoom()
- getCenter()
- getContainer()
- getMaxZoom()
- getMinZoom()
- getPane()
- getPanes()
- getPixelBounds()
- getPixelOrigin()
- getPixelWorldBounds()
- getRenderer()
- getScaleZoom()
- getSize()
- getZoom()
- getZoomScale()
- hasLayer()
- invalidateSize()
- keyboard
- latLngToContainerPoint()
- latLngToLayerPoint()
- layerPointToContainerPoint()
- layerPointToLatLng()
- locate()
- mouseEventToContainerPoint()
- mouseEventToLatLng()
- mouseEventToLayerPoint()
- openPopup()
- openTooltip()
- options
- panBy()
- panInside()
- panInsideBounds()
- panTo()
- project()
- remove()
- removeControl()
- removeLayer()
- scrollWheelZoom
- setMaxBounds()
- setMaxZoom()
- setMinZoom()
- setView()
- setZoom()
- setZoomAround()
- stop()
- stopLocate()
- tapHold
- touchZoom
- unproject()
- whenReady()
- wrapLatLng()
- wrapLatLngBounds()
- zoomControl
- zoomIn()
- zoomOut()
Interfaces
LeafletEventHandlerFnMap
- add
- autopanstart
- baselayerchange
- click
- contextmenu
- dblclick
- down
- drag
- dragend
- dragstart
- error
- keydown
- keypress
- keyup
- layeradd
- layerremove
- load
- loading
- locationerror
- locationfound
- mousedown
- mousemove
- mouseout
- mouseover
- mouseup
- move
- moveend
- movestart
- overlayadd
- overlayremove
- popupclose
- popupopen
- preclick
- predrag
- remove
- resize
- tileabort
- tileerror
- tileload
- tileloadstart
- tileunload
- tooltipclose
- tooltipopen
- unload
- update
- viewreset
- zoom
- zoomanim
- zoomend
- zoomlevelschange
- zoomstart
MapOptions
- attributionControl
- bounceAtZoomLimits
- boxZoom
- center
- closePopupOnClick
- crs
- doubleClickZoom
- dragging
- easeLinearity
- fadeAnimation
- inertia
- inertiaDeceleration
- inertiaMaxSpeed
- keyboard
- keyboardPanDelta
- layers
- markerZoomAnimation
- maxBounds
- maxBoundsViscosity
- maxZoom
- minZoom
- preferCanvas
- renderer
- scrollWheelZoom
- tapHold
- tapTolerance
- touchZoom
- trackResize
- transform3DLimit
- wheelDebounceTime
- wheelPxPerZoomLevel
- worldCopyJump
- zoom
- zoomAnimation
- zoomAnimationThreshold
- zoomControl
- zoomDelta
- zoomSnap
Type Aliases
- BoundsExpression
- BoundsLiteral
- CircleOptions
- Content
- ControlPosition
- CrossOrigin
- Direction
- DoneCallback
- DragEndEventHandlerFn
- ErrorEventHandlerFn
- FillRule
- LatLngBoundsExpression
- LatLngBoundsLiteral
- LatLngExpression
- LatLngTuple
- LayerEventHandlerFn
- LayersControlEventHandlerFn
- LeafletEventHandlerFn
- LeafletKeyboardEventHandlerFn
- LeafletMouseEventHandlerFn
- LineCapShape
- LineJoinShape
- LocationEventHandlerFn
- PointExpression
- PointTuple
- PopupEventHandlerFn
- ReferrerPolicy
- ResizeEventHandlerFn
- StyleFunction
- SVGOverlayStyleOptions
- TileErrorEventHandlerFn
- TileEventHandlerFn
- TooltipEventHandlerFn
- Zoom
- ZoomAnimEventHandlerFn
Namespaces
DomUtil
- addClass()
- create()
- disableImageDrag()
- disableTextSelection()
- empty()
- enableImageDrag()
- enableTextSelection()
- get()
- getClass()
- getPosition()
- getScale()
- getSizedParentNode()
- getStyle()
- hasClass()
- preventOutline()
- remove()
- removeClass()
- restoreOutline()
- setClass()
- setOpacity()
- setPosition()
- setTransform()
- testProp()
- toBack()
- toFront()
- TRANSFORM
- TRANSITION
- TRANSITION_END
Variables
variable bind
const bind: (fn: (...args: any[]) => void, ...obj: any[]) => () => void;
variable extend
const extend: { <D extends object, S1 extends object = {}>(dest: D, src?: S1): D & S1; <D extends object, S1 extends object, S2 extends object>( dest: D, src1: S1, src2: S2 ): D & S1 & S2; <D extends object, S1 extends object, S2 extends object, S3 extends object>( dest: D, src1: S1, src2: S2, src3: S3 ): D & S1 & S2 & S3; (dest: any, ...src: any[]): any;};
variable Mixin
const Mixin: MixinType;
variable setOptions
const setOptions: (obj: any, options: any) => any;
variable stamp
const stamp: (obj: any) => number;
variable version
const version: string;
A constant that represents the Leaflet version in use.
Functions
function bounds
bounds: { (topLeft: PointExpression, bottomRight: PointExpression): Bounds; (points: Point[] | BoundsLiteral): Bounds;};
function canvas
canvas: (options?: RendererOptions) => Canvas;
function circle
circle: { <P = any>(latlng: LatLngExpression, options: CircleMarkerOptions): Circle<P>; <P = any>( latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions ): Circle<P>;};
Deprecated
Passing the radius outside the options is deperecated. Use instead.
function circleMarker
circleMarker: <P = any>( latlng: LatLngExpression, options?: CircleMarkerOptions) => CircleMarker<P>;
function divIcon
divIcon: (options?: DivIconOptions) => DivIcon;
function featureGroup
featureGroup: <P = any>( layers?: Layer[], options?: LayerOptions) => FeatureGroup<P>;
Create a feature group, optionally given an initial set of layers.
function geoJson
geoJson: <P = any, G extends geojson.GeometryObject = geojson.GeometryObject>( geojson?: geojson.GeoJsonObject | geojson.GeoJsonObject[] | null, options?: GeoJSONOptions<P, G> | null) => GeoJSON<P, G>;
function geoJSON
geoJSON: <P = any, G extends geojson.GeometryObject = geojson.GeometryObject>( geojson?: geojson.GeoJsonObject | geojson.GeoJsonObject[] | null, options?: GeoJSONOptions<P, G> | null) => GeoJSON<P, G>;
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.
function gridLayer
gridLayer: (options?: GridLayerOptions) => GridLayer;
function icon
icon: (options: IconOptions) => Icon;
function imageOverlay
imageOverlay: ( imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions) => ImageOverlay;
function latLng
latLng: { (latitude: number, longitude: number, altitude?: number): LatLng; ( coords: | LatLngTuple | [number, number, number] | LatLngLiteral | { lat: number; lng: number; alt?: number } ): LatLng;};
function latLngBounds
latLngBounds: { (southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds; (latlngs: LatLngExpression[]): LatLngBounds;};
function layerGroup
layerGroup: <P = any>(layers?: Layer[], options?: LayerOptions) => LayerGroup<P>;
Create a layer group, optionally given an initial set of layers and an
options
object.
function map
map: (element: string | HTMLElement, options?: MapOptions) => Map;
ID of a HTML-Element as string or the HTML-ELement itself
function marker
marker: <P = any>( latlng: LatLngExpression, options?: MarkerOptions) => Marker<P>;
function noConflict
noConflict: () => any;
function point
point: { (x: number, y: number, round?: boolean): Point; (coords: PointTuple | { x: number; y: number }): Point;};
function polygon
polygon: <P = any>( latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options?: PolylineOptions) => Polygon<P>;
function polyline
polyline: <T extends geojson.GeometryObject = any, P = any>( latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions) => Polyline<T, P>;
function popup
popup: (options?: PopupOptions, source?: Layer) => Popup;
function rectangle
rectangle: <P = any>( latLngBounds: LatLngBoundsExpression, options?: PolylineOptions) => Rectangle<P>;
function svg
svg: (options?: RendererOptions) => SVG;
function svgOverlay
svgOverlay: ( svgImage: string | SVGElement, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions) => SVGOverlay;
function tileLayer
tileLayer: typeof tileLayer;
function tooltip
tooltip: (options?: TooltipOptions, source?: Layer) => Tooltip;
function transformation
transformation: { (a: number, b: number, c: number, d: number): Transformation; (coefficients: [number, number, number, number]): Transformation;};
Instantiates a Transformation object with the given coefficients.
Expects an coefficients array of the form
[a: Number, b: Number, c: Number, d: Number]
.
function videoOverlay
videoOverlay: ( video: string | string[] | HTMLVideoElement, bounds: LatLngBoundsExpression, options?: VideoOverlayOptions) => VideoOverlay;
Classes
class Bounds
class Bounds {}
constructor
constructor(topLeft: PointExpression, bottomRight: PointExpression);
constructor
constructor(points?: Point[] | BoundsLiteral);
property max
max?: Point;
property min
min?: Point;
method contains
contains: (pointOrBounds: BoundsExpression | PointExpression) => boolean;
method equals
equals: (otherBounds: BoundsExpression) => boolean;
method extend
extend: { (point: PointExpression): this; (otherBounds: BoundsExpression): this;};
method getBottomLeft
getBottomLeft: () => Point;
method getBottomRight
getBottomRight: () => Point;
method getCenter
getCenter: (round?: boolean) => Point;
method getSize
getSize: () => Point;
method getTopLeft
getTopLeft: () => Point;
method getTopRight
getTopRight: () => Point;
method intersects
intersects: (otherBounds: BoundsExpression) => boolean;
method isValid
isValid: () => boolean;
method overlaps
overlaps: (otherBounds: BoundsExpression) => boolean;
method pad
pad: (bufferRatio: number) => Bounds;
class Canvas
class Canvas extends Renderer {}
class Circle
class Circle<P = any> extends CircleMarker<P> {}
constructor
constructor(latlng: LatLngExpression, options: CircleMarkerOptions);
constructor
constructor( latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions);
method getBounds
getBounds: () => LatLngBounds;
method getRadius
getRadius: () => number;
method setRadius
setRadius: (radius: number) => this;
method setStyle
setStyle: (style: PathOptions) => this;
method toGeoJSON
toGeoJSON: (precision?: number | false) => any;
class CircleMarker
class CircleMarker<P = any> extends Path {}
constructor
constructor(latlng: LatLngExpression, options: CircleMarkerOptions);
property feature
feature?: any;
property options
options: CircleMarkerOptions;
method getLatLng
getLatLng: () => LatLng;
method getRadius
getRadius: () => number;
method setLatLng
setLatLng: (latLng: LatLngExpression) => this;
method setRadius
setRadius: (radius: number) => this;
method setStyle
setStyle: (options: Partial<CircleMarkerOptions>) => this;
method toGeoJSON
toGeoJSON: (precision?: number | false) => geojson.Feature<geojson.Point, P>;
class Class
class Class {}
method addInitHook
static addInitHook: { (initHookFn: () => void): any & typeof Class; (methodName: string, ...args: any[]): any;};
method callInitHooks
static callInitHooks: () => void;
method extend
static extend: (props: any) => (new (...args: any[]) => any) & typeof Class;
method include
static include: (props: any) => any & typeof Class;
method mergeOptions
static mergeOptions: (props: any) => any & typeof Class;
class Control
class Control<Options extends ControlOptions = ControlOptions> extends Class {}
constructor
constructor(options?: ControlOptions);
property options
options: ControlOptions;
method addTo
addTo: (map: Map) => this;
method extend
static extend: any;
method getContainer
getContainer: () => HTMLElement | undefined;
method getPosition
getPosition: () => ControlPosition;
method onAdd
onAdd: (map: Map) => HTMLElement;
method onRemove
onRemove: (map: Map) => void;
method remove
remove: () => this;
method setPosition
setPosition: (position: ControlPosition) => this;
class DivIcon
class DivIcon extends Icon<DivIconOptions> {}
constructor
constructor(options?: DivIconOptions);
class DivOverlay
abstract class DivOverlay extends Layer {}
constructor
constructor(latlng: LatLngExpression, options?: TooltipOptions);
constructor
constructor(options?: DivOverlayOptions, source?: Layer);
property options
options: DivOverlayOptions;
method bringToBack
bringToBack: () => this;
method bringToFront
bringToFront: () => this;
method close
close: () => this;
method getContent
getContent: () => Content | ((source: Layer) => Content);
method getElement
getElement: () => HTMLElement | undefined;
method getLatLng
getLatLng: () => LatLng | undefined;
method isOpen
isOpen: () => boolean;
method openOn
openOn: (map: Map) => this;
method setContent
setContent: (htmlContent: Content | ((source: Layer) => Content)) => this;
method setLatLng
setLatLng: (latlng: LatLngExpression) => this;
method toggle
toggle: (layer?: Layer) => this;
method update
update: () => void;
class Draggable
class Draggable extends Evented {}
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
](#domutil-setposition).
constructor
constructor( element: HTMLElement, dragStartTarget?: HTMLElement, preventOutline?: boolean, options?: DraggableOptions);
method disable
disable: () => void;
method enable
enable: () => void;
method finishDrag
finishDrag: () => void;
class Evented
abstract class Evented extends Class {}
Base class of Leaflet classes supporting events
method addEventListener
addEventListener: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileErrorEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Alias for on(...)
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').
Alias for on(...)
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
method addEventParent
addEventParent: (obj: Evented) => this;
Adds an event parent - an Evented that will receive propagated events
method addOneTimeEventListener
addOneTimeEventListener: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileErrorEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Alias for once(...)
Behaves as on(...), except the listener will only get fired once and then removed.
method clearAllEventListeners
clearAllEventListeners: () => this;
Alias for off()
Removes all listeners to all events on the object.
method fire
fire: (type: string, data?: any, propagate?: boolean) => this;
Fires an event of the specified type. You can optionally provide a data object — the first argument of the listener function will contain its properties. The event might can optionally be propagated to event parents.
method fireEvent
fireEvent: (type: string, data?: any, propagate?: boolean) => this;
Alias for fire(...)
Fires an event of the specified type. You can optionally provide a data object — the first argument of the listener function will contain its properties. The event might can optionally be propagated to event parents.
method hasEventListeners
hasEventListeners: (type: string) => boolean;
Alias for listens(...)
Returns true if a particular event type has any listeners attached to it.
method listens
listens: { ( type: | 'baselayerchange' | 'overlayadd' | 'overlayremove' | 'layeradd' | 'layerremove' | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag' | 'resize' | 'popupopen' | 'tooltipopen' | 'tooltipclose' | 'locationerror' | 'locationfound' | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick' | 'keypress' | 'keydown' | 'keyup' | 'zoomanim' | 'dragend' | 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort' | 'tileerror', propagate?: boolean ): boolean; ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'resize', fn: ResizeEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'locationerror', fn: ErrorEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'locationfound', fn: LocationEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'dragend', fn: DragEndEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'tileerror', fn: TileEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: string, fn: LeafletEventHandlerFn, context?: any, propagate?: boolean ): boolean;};
Returns true if a particular event type has any listeners attached to it.
method off
off: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn?: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn?: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn?: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn?: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn?: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn?: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn?: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn?: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn?: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn?: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn?: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn?: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn?: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn?: TileErrorEventHandlerFn, context?: any): this; (type: string, fn?: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this; (): 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.
Removes a set of type/listener pairs.
Removes all listeners to all events on the object.
method on
on: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileErrorEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): 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').
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
method once
once: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Behaves as on(...), except the listener will only get fired once and then removed.
method removeEventListener
removeEventListener: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn?: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn?: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn?: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn?: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn?: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn?: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn?: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn?: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn?: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn?: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn?: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn?: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn?: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn?: TileErrorEventHandlerFn, context?: any): this; (type: string, fn?: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Alias for off(...)
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.
Alias for off(...)
Removes a set of type/listener pairs.
method removeEventParent
removeEventParent: (obj: Evented) => this;
Removes an event parent, so it will stop receiving propagated events
class Events
class Events {}
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).
method addEventListener
addEventListener: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileErrorEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Alias for on(...)
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').
Alias for on(...)
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
method addEventParent
addEventParent: (obj: Evented) => this;
Adds an event parent - an Evented that will receive propagated events
method addOneTimeEventListener
addOneTimeEventListener: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileErrorEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Alias for once(...)
Behaves as on(...), except the listener will only get fired once and then removed.
method clearAllEventListeners
clearAllEventListeners: () => this;
Alias for off()
Removes all listeners to all events on the object.
method fire
fire: (type: string, data?: any, propagate?: boolean) => this;
Fires an event of the specified type. You can optionally provide a data object — the first argument of the listener function will contain its properties. The event might can optionally be propagated to event parents.
method fireEvent
fireEvent: (type: string, data?: any, propagate?: boolean) => this;
Alias for fire(...)
Fires an event of the specified type. You can optionally provide a data object — the first argument of the listener function will contain its properties. The event might can optionally be propagated to event parents.
method hasEventListeners
hasEventListeners: (type: string) => boolean;
Alias for listens(...)
Returns true if a particular event type has any listeners attached to it.
method listens
listens: { ( type: | 'baselayerchange' | 'overlayadd' | 'overlayremove' | 'layeradd' | 'layerremove' | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag' | 'resize' | 'popupopen' | 'tooltipopen' | 'tooltipclose' | 'locationerror' | 'locationfound' | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick' | 'keypress' | 'keydown' | 'keyup' | 'zoomanim' | 'dragend' | 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort' | 'tileerror', propagate?: boolean ): boolean; ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'resize', fn: ResizeEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'locationerror', fn: ErrorEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'locationfound', fn: LocationEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'dragend', fn: DragEndEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: 'tileerror', fn: TileEventHandlerFn, context?: any, propagate?: boolean ): boolean; ( type: string, fn: LeafletEventHandlerFn, context?: any, propagate?: boolean ): boolean;};
Returns true if a particular event type has any listeners attached to it.
method off
off: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn?: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn?: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn?: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn?: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn?: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn?: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn?: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn?: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn?: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn?: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn?: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn?: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn?: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn?: TileErrorEventHandlerFn, context?: any): this; (type: string, fn?: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this; (): 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.
Removes a set of type/listener pairs.
Removes all listeners to all events on the object.
method on
on: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileErrorEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): 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').
Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
method once
once: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn: TileEventHandlerFn, context?: any): this; (type: string, fn: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Behaves as on(...), except the listener will only get fired once and then removed.
method removeEventListener
removeEventListener: { ( type: 'baselayerchange' | 'overlayadd' | 'overlayremove', fn?: LayersControlEventHandlerFn, context?: any ): this; ( type: 'layeradd' | 'layerremove', fn?: LayerEventHandlerFn, context?: any ): this; ( type: | 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' | 'down' | 'predrag', fn?: LeafletEventHandlerFn, context?: any ): this; (type: 'resize', fn?: ResizeEventHandlerFn, context?: any): this; ( type: 'popupopen' | 'popupclose', fn?: PopupEventHandlerFn, context?: any ): this; ( type: 'tooltipopen' | 'tooltipclose', fn?: TooltipEventHandlerFn, context?: any ): this; (type: 'locationerror', fn?: ErrorEventHandlerFn, context?: any): this; (type: 'locationfound', fn?: LocationEventHandlerFn, context?: any): this; ( type: | 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick', fn?: LeafletMouseEventHandlerFn, context?: any ): this; ( type: 'keypress' | 'keydown' | 'keyup', fn?: LeafletKeyboardEventHandlerFn, context?: any ): this; (type: 'zoomanim', fn?: ZoomAnimEventHandlerFn, context?: any): this; (type: 'dragend', fn?: DragEndEventHandlerFn, context?: any): this; ( type: 'tileunload' | 'tileloadstart' | 'tileload' | 'tileabort', fn?: TileEventHandlerFn, context?: any ): this; (type: 'tileerror', fn?: TileErrorEventHandlerFn, context?: any): this; (type: string, fn?: LeafletEventHandlerFn, context?: any): this; (eventMap: LeafletEventHandlerFnMap): this;};
Alias for off(...)
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.
Alias for off(...)
Removes a set of type/listener pairs.
method removeEventParent
removeEventParent: (obj: Evented) => this;
Removes an event parent, so it will stop receiving propagated events
class FeatureGroup
class FeatureGroup<P = any> extends LayerGroup<P> {}
Extended LayerGroup that also has mouse events (propagated from members of the group) and a shared bindPopup method.
method addLayer
addLayer: (layer: Layer) => this;
Adds the given layer to the group.
method bringToBack
bringToBack: () => this;
Brings the layer group to the top [sic] of all other layers
method bringToFront
bringToFront: () => this;
Brings the layer group to the top of all other layers
method getBounds
getBounds: () => LatLngBounds;
Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
method removeLayer
removeLayer: (layer: number | Layer) => this;
Removes the layer with the given internal ID or the given layer from the group.
method setStyle
setStyle: (style: PathOptions) => this;
Sets the given path options to each layer of the group that has a setStyle method.
class GeoJSON
class GeoJSON< P = any, G extends geojson.GeometryObject = geojson.GeometryObject> extends FeatureGroup<P> {}
Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup.
constructor
constructor(geojson?: any, options?: GeoJSONOptions<P, G>);
property options
options: GeoJSONOptions<P, G>;
method addData
addData: (data: geojson.GeoJsonObject) => this;
Adds a GeoJSON object to the layer.
method asFeature
static asFeature: < P = any, G extends geojson.GeometryObject = geojson.GeometryObject>( geojson: geojson.Feature<G, P> | G) => geojson.Feature<G, P>;
Normalize GeoJSON geometries/features into GeoJSON features.
method coordsToLatLng
static coordsToLatLng: ( coords: [number, number] | [number, number, number]) => LatLng;
Creates a LatLng object from an array of 2 numbers (longitude, latitude) or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
method coordsToLatLngs
static coordsToLatLngs: ( coords: any[], levelsDeep?: number, coordsToLatLng?: ( coords: [number, number] | [number, number, number] ) => LatLng) => any[];
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.
method geometryToLayer
static geometryToLayer: < P = any, G extends geojson.GeometryObject = geojson.GeometryObject>( featureData: geojson.Feature<G, P>, options?: GeoJSONOptions<P, G>) => Layer;
Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer and/or coordsToLatLng functions if provided as options.
method getFeature
static getFeature: < P = any, G extends geojson.GeometryObject = geojson.GeometryObject>( layer: Layer, newGeometry: geojson.Feature<G, P> | G) => geojson.Feature<G, P>;
Convert layer into GeoJSON feature
method latLngsToCoords
static latLngsToCoords: ( latlngs: any[], levelsDeep?: number, closed?: boolean) => any[];
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.
method latLngToCoords
static latLngToCoords: ( latlng: LatLng) => [number, number] | [number, number, number];
Reverse of coordsToLatLng
method resetStyle
resetStyle: (layer?: Layer) => this;
Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
method setStyle
setStyle: (style: PathOptions | StyleFunction<P>) => this;
Same as FeatureGroup's setStyle method, but style-functions are also allowed here to set the style according to the feature.
class GridLayer
class GridLayer extends Layer {}
constructor
constructor(options?: GridLayerOptions);
method bringToBack
bringToBack: () => this;
method bringToFront
bringToFront: () => this;
method createTile
protected createTile: (coords: Coords, done: DoneCallback) => HTMLElement;
method getContainer
getContainer: () => HTMLElement | null;
method getTileSize
getTileSize: () => Point;
method isLoading
isLoading: () => boolean;
method redraw
redraw: () => this;
method setOpacity
setOpacity: (opacity: number) => this;
method setZIndex
setZIndex: (zIndex: number) => this;
class Handler
class Handler extends Class {}
constructor
constructor(map: Map);
method addHooks
addHooks: () => void;
method disable
disable: () => this;
method enable
enable: () => this;
method enabled
enabled: () => boolean;
method removeHooks
removeHooks: () => void;
class Icon
class Icon<T extends BaseIconOptions = IconOptions> extends Layer {}
constructor
constructor(options: BaseIconOptions);
property options
options: BaseIconOptions;
method createIcon
createIcon: (oldIcon?: HTMLElement) => HTMLElement;
method createShadow
createShadow: (oldIcon?: HTMLElement) => HTMLElement;
class ImageOverlay
class ImageOverlay extends Layer {}
constructor
constructor( imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions);
property options
options: ImageOverlayOptions;
method bringToBack
bringToBack: () => this;
method bringToFront
bringToFront: () => this;
method getBounds
getBounds: () => LatLngBounds;
Get the bounds that this ImageOverlay covers
method getCenter
getCenter: () => Point;
Get the center of the bounds this ImageOverlay covers
method getElement
getElement: () => HTMLImageElement | undefined;
Get the img element that represents the ImageOverlay on the map
method setBounds
setBounds: (bounds: LatLngBounds) => this;
Update the bounds that this ImageOverlay covers
method setOpacity
setOpacity: (opacity: number) => this;
Changes the opacity of the image element
method setStyle
setStyle: (styleOpts: ImageOverlayStyleOptions) => this;
Changes the style of the image element. As of 1.8, only the opacity is changed
method setUrl
setUrl: (url: string) => this;
method setZIndex
setZIndex: (value: number) => this;
Changes the zIndex of the image overlay
class LatLng
class LatLng {}
constructor
constructor(latitude: number, longitude: number, altitude?: number);
property alt
alt?: number;
property lat
lat: number;
property lng
lng: number;
method clone
clone: () => LatLng;
method distanceTo
distanceTo: (otherLatLng: LatLngExpression) => number;
method equals
equals: (otherLatLng: LatLngExpression, maxMargin?: number) => boolean;
method toBounds
toBounds: (sizeInMeters: number) => LatLngBounds;
method toString
toString: () => string;
method wrap
wrap: () => LatLng;
class LatLngBounds
class LatLngBounds {}
constructor
constructor(southWest: LatLngExpression, northEast: LatLngExpression);
constructor
constructor(latlngs: LatLngExpression[]);
method contains
contains: ( otherBoundsOrLatLng: LatLngBoundsExpression | LatLngExpression) => boolean;
method equals
equals: (otherBounds: LatLngBoundsExpression, maxMargin?: number) => boolean;
method extend
extend: (latlngOrBounds: LatLngExpression | LatLngBoundsExpression) => this;
method getCenter
getCenter: () => LatLng;
method getEast
getEast: () => number;
method getNorth
getNorth: () => number;
method getNorthEast
getNorthEast: () => LatLng;
method getNorthWest
getNorthWest: () => LatLng;
method getSouth
getSouth: () => number;
method getSouthEast
getSouthEast: () => LatLng;
method getSouthWest
getSouthWest: () => LatLng;
method getWest
getWest: () => number;
method intersects
intersects: (otherBounds: LatLngBoundsExpression) => boolean;
method isValid
isValid: () => boolean;
method overlaps
overlaps: (otherBounds: LatLngBoundsExpression) => boolean;
method pad
pad: (bufferRatio: number) => LatLngBounds;
method toBBoxString
toBBoxString: () => string;
class Layer
class Layer extends Evented {}
constructor
constructor(options?: LayerOptions);
property options
options: LayerOptions;
method addInteractiveTarget
addInteractiveTarget: (targetEl: HTMLElement) => this;
method addTo
addTo: (map: Map | LayerGroup) => this;
method beforeAdd
beforeAdd: (map: Map) => this;
method bindPopup
bindPopup: ( content: Popup | ((layer: Layer) => Content) | Content, options?: PopupOptions) => this;
method bindTooltip
bindTooltip: ( content: Tooltip | Content | ((layer: Layer) => Content), options?: TooltipOptions) => this;
method closePopup
closePopup: () => this;
method closeTooltip
closeTooltip: () => this;
method getAttribution
getAttribution: () => string | null;
method getEvents
getEvents: () => { [name: string]: LeafletEventHandlerFn };
method getPane
getPane: (name?: string) => HTMLElement | undefined;
method getPopup
getPopup: () => Popup | undefined;
method getTooltip
getTooltip: () => Tooltip | undefined;
method isPopupOpen
isPopupOpen: () => boolean;
method isTooltipOpen
isTooltipOpen: () => boolean;
method onAdd
onAdd: (map: Map) => this;
method onRemove
onRemove: (map: Map) => this;
method openPopup
openPopup: (latlng?: LatLngExpression) => this;
method openTooltip
openTooltip: (latlng?: LatLngExpression) => this;
method remove
remove: () => this;
method removeFrom
removeFrom: (map: Map) => this;
method removeInteractiveTarget
removeInteractiveTarget: (targetEl: HTMLElement) => this;
method setPopupContent
setPopupContent: (content: Content | Popup) => this;
method setTooltipContent
setTooltipContent: (content: Content | Tooltip) => this;
method togglePopup
togglePopup: () => this;
method toggleTooltip
toggleTooltip: () => this;
method unbindPopup
unbindPopup: () => this;
method unbindTooltip
unbindTooltip: () => this;
class LayerGroup
class LayerGroup<P = any> extends Layer {}
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.
constructor
constructor(layers?: Layer[], options?: LayerOptions);
property feature
feature?: any;
method addLayer
addLayer: (layer: Layer) => this;
Adds the given layer to the group.
method clearLayers
clearLayers: () => this;
Removes all the layers from the group.
method eachLayer
eachLayer: (fn: (layer: Layer) => void, context?: any) => this;
Iterates over the layers of the group, optionally specifying context of the iterator function.
method getLayer
getLayer: (id: number) => Layer | undefined;
Returns the layer with the given internal ID.
method getLayerId
getLayerId: (layer: Layer) => number;
Returns the internal ID for a layer
method getLayers
getLayers: () => Layer[];
Returns an array of all the layers added to the group.
method hasLayer
hasLayer: (layer: Layer) => boolean;
Returns true if the given layer is currently added to the group.
method invoke
invoke: (methodName: string, ...params: any[]) => 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.
method removeLayer
removeLayer: (layer: number | Layer) => this;
Removes the layer with the given internal ID or the given layer from the group.
method setZIndex
setZIndex: (zIndex: number) => this;
Calls setZIndex on every layer contained in this group, passing the z-index.
method toGeoJSON
toGeoJSON: ( precision?: number | false) => | geojson.FeatureCollection<geojson.GeometryObject, P> | geojson.Feature<geojson.MultiPoint, P> | geojson.GeometryCollection;
Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint).
method toMultiPoint
toMultiPoint: (precision?: number) => geojson.Feature<geojson.MultiPoint, P>;
class Map
class Map extends Evented {}
constructor
constructor(element: string | HTMLElement, options?: MapOptions);
property attributionControl
attributionControl: Control.Attribution;
property boxZoom
boxZoom: Handler;
property doubleClickZoom
doubleClickZoom: Handler;
property dragging
dragging: Handler;
property keyboard
keyboard: Handler;
property options
options: MapOptions;
property scrollWheelZoom
scrollWheelZoom: Handler;
property tapHold
tapHold?: Handler;
property touchZoom
touchZoom: Handler;
property zoomControl
zoomControl: Control.Zoom;
method addControl
addControl: (control: Control) => this;
method addHandler
addHandler: (name: string, HandlerClass: typeof Handler) => this;
method addLayer
addLayer: (layer: Layer)<