Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/leaflet

Package Overview
Dependencies
Maintainers
1
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/leaflet - npm Package Compare versions

Comparing version 1.0.69 to 1.2.0

2513

leaflet/index.d.ts

@@ -1,1556 +0,1525 @@

// Type definitions for Leaflet.js 1.0
// Type definitions for Leaflet.js 1.2
// Project: https://github.com/Leaflet/Leaflet
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="geojson" />
export as namespace L;
type NativeMouseEvent = MouseEvent;
type NativeKeyboardEvent = KeyboardEvent;
import * as geojson from 'geojson';
// Import to avoid conflicts with the GeoJSON class of leaflet
import GeoJSONFeature = GeoJSON.Feature;
import GeoJSONLineString = GeoJSON.LineString;
import GeoJSONMultiLineString = GeoJSON.MultiLineString;
import GeoJSONPolygon = GeoJSON.Polygon;
import GeoJSONMultiPolygon = GeoJSON.MultiPolygon;
import GeoJSONFeatureCollection = GeoJSON.FeatureCollection;
import GeoJSONGeometryObject = GeoJSON.GeometryObject;
import GeoJSONGeometryCollection = GeoJSON.GeometryCollection;
import GeoJSONPoint = GeoJSON.Point;
import GeoJSONMultiPoint = GeoJSON.MultiPoint;
import GeoJSONGeoJsonObject = GeoJSON.GeoJsonObject;
export class Class {
static extend(props: any): any/* how to return constructor of self extended type ? */;
static include(props: any): any /* how to return self extended type ? */;
static mergeOptions(props: any): any /* how to return self extended type ? */;
static addInitHook(initHookFn: () => void): any/* how to return self extended type ? */;
}
declare namespace L {
class Class {
static extend(props: any): any/* how to return constructor of self extended type ? */;
static include(props: any): any /* how to return self extended type ? */;
static mergeOptions(props: any): any /* how to return self extended type ? */;
static addInitHook(initHookFn: () => void): any/* how to return self extended type ? */;
}
export class Transformation {
constructor(a: number, b: number, c: number, d: number);
class Transformation {
constructor(a: number, b: number, c: number, d: number);
transform(point: Point, scale?: number): Point;
transform(point: Point, scale?: number): Point;
untransform(point: Point, scale?: number): Point;
}
untransform(point: Point, scale?: number): Point;
}
export namespace LineUtil {
function simplify(points: Point[], tolerance: number): Point[];
namespace LineUtil {
function simplify(points: Point[], tolerance: number): Point[];
function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
}
function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
}
export namespace PolyUtil {
function clipPolygon(points: Point[], bounds: BoundsExpression, round?: boolean): Point[];
}
namespace PolyUtil {
function clipPolygon(points: Point[], bounds: BoundsExpression, round?: boolean): Point[];
}
export namespace DomUtil {
/**
* Get Element by its ID or with the given HTML-Element
*/
function get(element: string | HTMLElement): HTMLElement | null;
function getStyle(el: HTMLElement, styleAttrib: string): string | null;
function create(tagName: string, className?: string, container?: HTMLElement): HTMLElement;
function remove(el: HTMLElement): void;
function empty(el: HTMLElement): void;
function toFront(el: HTMLElement): void;
function toBack(el: HTMLElement): void;
function hasClass(el: HTMLElement, name: string): boolean;
function addClass(el: HTMLElement, name: string): void;
function removeClass(el: HTMLElement, name: string): void;
function setClass(el: HTMLElement, name: string): void;
function getClass(el: HTMLElement): string;
function setOpacity(el: HTMLElement, opacity: number): void;
function testProp(props: string[]): string | false;
function setTransform(el: HTMLElement, offset: Point, scale?: number): void;
function setPosition(el: HTMLElement, position: Point): void;
function getPosition(el: HTMLElement): Point;
function disableTextSelection(): void;
function enableTextSelection(): void;
function disableImageDrag(): void;
function enableImageDrag(): void;
function preventOutline(el: HTMLElement): void;
function restoreOutline(): void;
namespace DomUtil {
/**
* Get Element by its ID or with the given HTML-Element
*/
function get(element: string | HTMLElement): HTMLElement | null;
function getStyle(el: HTMLElement, styleAttrib: string): string | null;
function create(tagName: string, className?: string, container?: HTMLElement): HTMLElement;
function remove(el: HTMLElement): void;
function empty(el: HTMLElement): void;
function toFront(el: HTMLElement): void;
function toBack(el: HTMLElement): void;
function hasClass(el: HTMLElement, name: string): boolean;
function addClass(el: HTMLElement, name: string): void;
function removeClass(el: HTMLElement, name: string): void;
function setClass(el: HTMLElement, name: string): void;
function getClass(el: HTMLElement): string;
function setOpacity(el: HTMLElement, opacity: number): void;
function testProp(props: string[]): string | false;
function setTransform(el: HTMLElement, offset: Point, scale?: number): void;
function setPosition(el: HTMLElement, position: Point): void;
function getPosition(el: HTMLElement): Point;
function disableTextSelection(): void;
function enableTextSelection(): void;
function disableImageDrag(): void;
function enableImageDrag(): void;
function preventOutline(el: HTMLElement): void;
function restoreOutline(): void;
let TRANSFORM: string;
let TRANSITION: string;
let TRANSITION_END: string;
}
let TRANSFORM: string;
let TRANSITION: string;
let TRANSITION_END: string;
}
export interface CRS {
latLngToPoint(latlng: LatLngExpression, zoom: number): Point;
pointToLatLng(point: PointExpression, zoom: number): LatLng;
project(latlng: LatLng | LatLngLiteral): Point;
unproject(point: PointExpression): LatLng;
scale(zoom: number): number;
zoom(scale: number): number;
getProjectedBounds(zoom: number): Bounds;
distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng;
interface CRS {
latLngToPoint(latlng: LatLngExpression, zoom: number): Point;
pointToLatLng(point: PointExpression, zoom: number): LatLng;
project(latlng: LatLng | LatLngLiteral): Point;
unproject(point: PointExpression): LatLng;
scale(zoom: number): number;
zoom(scale: number): number;
getProjectedBounds(zoom: number): Bounds;
distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng;
code?: string;
wrapLng?: [number, number];
wrapLat?: [number, number];
infinite: boolean;
}
code?: string;
wrapLng?: [number, number];
wrapLat?: [number, number];
infinite: boolean;
}
export namespace CRS {
const EPSG3395: CRS;
const EPSG3857: CRS;
const EPSG4326: CRS;
const Earth: CRS;
const Simple: CRS;
}
namespace CRS {
const EPSG3395: CRS;
const EPSG3857: CRS;
const EPSG4326: CRS;
const Earth: CRS;
const Simple: CRS;
}
export interface Projection {
project(latlng: LatLng | LatLngLiteral): Point;
unproject(point: PointExpression): LatLng;
interface Projection {
project(latlng: LatLng | LatLngLiteral): Point;
unproject(point: PointExpression): LatLng;
bounds: Bounds;
}
bounds: Bounds;
}
export namespace Projection {
const LonLat: Projection;
const Mercator: Projection;
const SphericalMercator: Projection;
}
namespace Projection {
const LonLat: Projection;
const Mercator: Projection;
const SphericalMercator: Projection;
}
export class LatLng {
constructor(latitude: number, longitude: number, altitude?: number);
equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean;
toString(): string;
distanceTo(otherLatLng: LatLngExpression): number;
wrap(): LatLng;
toBounds(sizeInMeters: number): LatLngBounds;
class LatLng {
constructor(latitude: number, longitude: number, altitude?: number);
equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean;
toString(): string;
distanceTo(otherLatLng: LatLngExpression): number;
wrap(): LatLng;
toBounds(sizeInMeters: number): LatLngBounds;
lat: number;
lng: number;
alt?: number;
}
lat: number;
lng: number;
alt?: number;
}
export interface LatLngLiteral {
lat: number;
lng: number;
}
interface LatLngLiteral {
lat: number;
lng: number;
}
export type LatLngTuple = [number, number];
type LatLngTuple = [number, number];
export type LatLngExpression = LatLng | LatLngLiteral | LatLngTuple;
type LatLngExpression = LatLng | LatLngLiteral | LatLngTuple;
export function latLng(latitude: number, longitude: number, altitude?: number): LatLng;
function latLng(latitude: number, longitude: number, altitude?: number): LatLng;
export function latLng(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number}): LatLng;
function latLng(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number}): LatLng;
export class LatLngBounds {
constructor(southWest: LatLngExpression, northEast: LatLngExpression);
constructor(latlngs: LatLngBoundsLiteral);
extend(latlngOrBounds: LatLngExpression | LatLngBoundsExpression): this;
pad(bufferRatio: number): LatLngBounds; // does this modify the current instance or does it return a new one?
getCenter(): LatLng;
getSouthWest(): LatLng;
getNorthEast(): LatLng;
getNorthWest(): LatLng;
getSouthEast(): LatLng;
getWest(): number;
getSouth(): number;
getEast(): number;
getNorth(): number;
contains(otherBoundsOrLatLng: LatLngBoundsExpression | LatLngExpression): boolean;
intersects(otherBounds: LatLngBoundsExpression): boolean;
overlaps(otherBounds: BoundsExpression): boolean; // investigate if this is really bounds and not latlngbounds
toBBoxString(): string;
equals(otherBounds: LatLngBoundsExpression): boolean;
isValid(): boolean;
}
class LatLngBounds {
constructor(southWest: LatLngExpression, northEast: LatLngExpression);
constructor(latlngs: LatLngBoundsLiteral);
extend(latlngOrBounds: LatLngExpression | LatLngBoundsExpression): this;
pad(bufferRatio: number): LatLngBounds; // does this modify the current instance or does it return a new one?
getCenter(): LatLng;
getSouthWest(): LatLng;
getNorthEast(): LatLng;
getNorthWest(): LatLng;
getSouthEast(): LatLng;
getWest(): number;
getSouth(): number;
getEast(): number;
getNorth(): number;
contains(otherBoundsOrLatLng: LatLngBoundsExpression | LatLngExpression): boolean;
intersects(otherBounds: LatLngBoundsExpression): boolean;
overlaps(otherBounds: BoundsExpression): boolean; // investigate if this is really bounds and not latlngbounds
toBBoxString(): string;
equals(otherBounds: LatLngBoundsExpression): boolean;
isValid(): boolean;
}
export type LatLngBoundsLiteral = LatLngTuple[]; // Must be [LatLngTuple, LatLngTuple], cant't change because Map.setMaxBounds
type LatLngBoundsLiteral = LatLngTuple[]; // Must be [LatLngTuple, LatLngTuple], cant't change because Map.setMaxBounds
export type LatLngBoundsExpression = LatLngBounds | LatLngBoundsLiteral;
type LatLngBoundsExpression = LatLngBounds | LatLngBoundsLiteral;
export function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
export function latLngBounds(latlngs: LatLngExpression[]): LatLngBounds;
function latLngBounds(latlngs: LatLngExpression[]): LatLngBounds;
export type PointTuple = [number, number];
type PointTuple = [number, number];
export class Point {
constructor(x: number, y: number, round?: boolean);
clone(): Point;
add(otherPoint: PointExpression): Point; // non-destructive, returns a new point
subtract(otherPoint: PointExpression): Point;
divideBy(num: number): Point;
multiplyBy(num: number): Point;
scaleBy(scale: PointExpression): Point;
unscaleBy(scale: PointExpression): Point;
round(): Point;
floor(): Point;
ceil(): Point;
distanceTo(otherPoint: PointExpression): number;
equals(otherPoint: PointExpression): boolean;
contains(otherPoint: PointExpression): boolean;
toString(): string;
x: number;
y: number;
}
class Point {
constructor(x: number, y: number, round?: boolean);
clone(): Point;
add(otherPoint: PointExpression): Point; // non-destructive, returns a new point
subtract(otherPoint: PointExpression): Point;
divideBy(num: number): Point;
multiplyBy(num: number): Point;
scaleBy(scale: PointExpression): Point;
unscaleBy(scale: PointExpression): Point;
round(): Point;
floor(): Point;
ceil(): Point;
distanceTo(otherPoint: PointExpression): number;
equals(otherPoint: PointExpression): boolean;
contains(otherPoint: PointExpression): boolean;
toString(): string;
x: number;
y: number;
}
export type PointExpression = Point | PointTuple;
type PointExpression = Point | PointTuple;
export function point(x: number, y: number, round?: boolean): Point;
function point(x: number, y: number, round?: boolean): Point;
export function point(coords: PointTuple | {x: number, y: number}): Point;
function point(coords: PointTuple | {x: number, y: number}): Point;
export type BoundsLiteral = [PointTuple, PointTuple];
type BoundsLiteral = [PointTuple, PointTuple];
export class Bounds {
constructor(topLeft: PointExpression, bottomRight: PointExpression);
constructor(points: Point[] | BoundsLiteral);
extend(point: PointExpression): this;
getCenter(round?: boolean): Point;
getBottomLeft(): Point;
getTopRight(): Point;
getSize(): Point;
contains(pointOrBounds: BoundsExpression | PointExpression): boolean;
intersects(otherBounds: BoundsExpression): boolean;
overlaps(otherBounds: BoundsExpression): boolean;
class Bounds {
constructor(topLeft: PointExpression, bottomRight: PointExpression);
constructor(points: Point[] | BoundsLiteral);
extend(point: PointExpression): this;
getCenter(round?: boolean): Point;
getBottomLeft(): Point;
getTopRight(): Point;
getSize(): Point;
contains(pointOrBounds: BoundsExpression | PointExpression): boolean;
intersects(otherBounds: BoundsExpression): boolean;
overlaps(otherBounds: BoundsExpression): boolean;
min?: Point;
max?: Point;
}
min?: Point;
max?: Point;
}
export type BoundsExpression = Bounds | BoundsLiteral;
type BoundsExpression = Bounds | BoundsLiteral;
export function bounds(topLeft: PointExpression, bottomRight: PointExpression): Bounds;
function bounds(topLeft: PointExpression, bottomRight: PointExpression): Bounds;
export function bounds(points: Point[] | BoundsLiteral): Bounds;
function bounds(points: Point[] | BoundsLiteral): Bounds;
export type LeafletEventHandlerFn = (event: LeafletEvent) => void;
type EventHandlerFn = (event: Event) => void;
export interface LeafletEventHandlerFnMap {
[type: string]: LeafletEventHandlerFn;
}
interface EventHandlerFnMap {
[type: string]: EventHandlerFn;
}
/**
* 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).
*/
export abstract class Evented extends Class {
/**
* Adds a listener function (fn) to a particular event type of the object.
* You can optionally specify the context of the listener (object the this
* keyword will point to). You can also pass several space-separated types
* (e.g. 'click dblclick').
*/
on(type: string, fn: LeafletEventHandlerFn, context?: any): this;
/**
* 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).
* Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
*/
abstract class Evented extends Class {
/**
* Adds a listener function (fn) to a particular event type of the object.
* You can optionally specify the context of the listener (object the this
* keyword will point to). You can also pass several space-separated types
* (e.g. 'click dblclick').
*/
on(type: string, fn: EventHandlerFn, context?: any): this;
on(eventMap: LeafletEventHandlerFnMap): this;
/**
* Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
*/
on(eventMap: EventHandlerFnMap): this;
/* tslint:disable:unified-signatures */ // With an eventMap there are no additional arguments allowed
/**
* Removes a previously added listener function. If no function is specified,
* it will remove all the listeners of that particular event from the object.
* Note that if you passed a custom context to on, you must pass the same context
* to off in order to remove the listener.
*/
off(type: string, fn?: LeafletEventHandlerFn, context?: any): this;
/* tslint:disable:unified-signatures */ // With an eventMap there are no additional arguments allowed
/**
* Removes a previously added listener function. If no function is specified,
* it will remove all the listeners of that particular event from the object.
* Note that if you passed a custom context to on, you must pass the same context
* to off in order to remove the listener.
*/
off(type: string, fn?: EventHandlerFn, context?: any): this;
/**
* Removes a set of type/listener pairs.
*/
off(eventMap: LeafletEventHandlerFnMap): this;
/* tslint:enable */
/**
* Removes all listeners to all events on the object.
*/
off(): this;
/**
* Removes a set of type/listener pairs.
*/
off(eventMap: EventHandlerFnMap): this;
/* tslint:enable */
/**
* Removes all listeners to all events on the object.
*/
off(): 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.
*/
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.
*/
fire(type: string, data?: any, propagate?: boolean): this;
/**
* Returns true if a particular event type has any listeners attached to it.
*/
listens(type: string): boolean;
/**
* Returns true if a particular event type has any listeners attached to it.
*/
listens(type: string): boolean;
/**
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
once(type: string, fn: LeafletEventHandlerFn, context?: any): this;
/**
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
once(type: string, fn: EventHandlerFn, context?: any): this;
/**
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
once(eventMap: LeafletEventHandlerFnMap): this;
/**
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
once(eventMap: EventHandlerFnMap): this;
/**
* Adds an event parent - an Evented that will receive propagated events
*/
addEventParent(obj: Evented): this;
/**
* Adds an event parent - an Evented that will receive propagated events
*/
addEventParent(obj: Evented): this;
/**
* Removes an event parent, so it will stop receiving propagated events
*/
removeEventParent(obj: Evented): this;
/**
* Removes an event parent, so it will stop receiving propagated events
*/
removeEventParent(obj: Evented): 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').
*/
addEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): 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').
*/
addEventListener(type: string, fn: EventHandlerFn, context?: any): this;
/**
* Alias for on(...)
*
* Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
*/
addEventListener(eventMap: LeafletEventHandlerFnMap): this;
/**
* Alias for on(...)
*
* Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
*/
addEventListener(eventMap: EventHandlerFnMap): 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.
*/
removeEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): 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.
*/
removeEventListener(type: string, fn: EventHandlerFn, context?: any): this;
/**
* Alias for off(...)
*
* Removes a set of type/listener pairs.
*/
removeEventListener(eventMap: LeafletEventHandlerFnMap): this;
/**
* Alias for off(...)
*
* Removes a set of type/listener pairs.
*/
removeEventListener(eventMap: EventHandlerFnMap): this;
/**
* Alias for off()
*
* Removes all listeners to all events on the object.
*/
clearAllEventListeners(): this;
/**
* Alias for off()
*
* Removes all listeners to all events on the object.
*/
clearAllEventListeners(): this;
/**
* Alias for once(...)
*
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
addOneTimeEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this;
/**
* Alias for once(...)
*
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
addOneTimeEventListener(type: string, fn: EventHandlerFn, context?: any): this;
/**
* Alias for once(...)
*
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
addOneTimeEventListener(eventMap: LeafletEventHandlerFnMap): this;
/**
* Alias for once(...)
*
* Behaves as on(...), except the listener will only get fired once and then removed.
*/
addOneTimeEventListener(eventMap: EventHandlerFnMap): 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.
*/
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.
*/
fireEvent(type: string, data?: any, propagate?: boolean): this;
/**
* Alias for listens(...)
*
* Returns true if a particular event type has any listeners attached to it.
*/
hasEventListeners(type: string): boolean;
}
/**
* 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).
* Alias for listens(...)
*
* Returns true if a particular event type has any listeners attached to it.
*/
class Draggable extends Evented {
constructor(element: HTMLElement, dragStartTarget?: HTMLElement, preventOutline?: boolean);
hasEventListeners(type: string): boolean;
}
enable(): void;
/**
* 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).
*/
export class Draggable extends Evented {
constructor(element: HTMLElement, dragStartTarget?: HTMLElement, preventOutline?: boolean);
disable(): void;
enable(): void;
finishDrag(): void;
}
disable(): void;
interface LayerOptions {
pane?: string;
attribution?: string;
}
finishDrag(): void;
}
interface InteractiveLayerOptions extends LayerOptions {
interactive?: boolean;
}
export interface LayerOptions {
pane?: string;
attribution?: string;
}
class Layer extends Evented {
constructor(options?: LayerOptions);
addTo(map: Map|LayerGroup): this;
remove(): this;
removeFrom(map: Map): this;
getPane(name?: string): HTMLElement | undefined;
export interface InteractiveLayerOptions extends LayerOptions {
interactive?: boolean;
}
// Popup methods
bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this;
unbindPopup(): this;
openPopup(latlng?: LatLngExpression): this;
closePopup(): this;
togglePopup(): this;
isPopupOpen(): boolean;
setPopupContent(content: Content | Popup): this;
getPopup(): Popup | undefined;
export class Layer extends Evented {
constructor(options?: LayerOptions);
addTo(map: Map|LayerGroup): this;
remove(): this;
removeFrom(map: Map): this;
getPane(name?: string): HTMLElement | undefined;
// Tooltip methods
bindTooltip(content: ((layer: Layer) => Content) | Tooltip | Content, options?: TooltipOptions): this;
unbindTooltip(): this;
openTooltip(latlng?: LatLngExpression): this;
closeTooltip(): this;
toggleTooltip(): this;
isTooltipOpen(): boolean;
setTooltipContent(content: Content | Tooltip): this;
getTooltip(): Tooltip | undefined;
// Popup methods
bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this;
unbindPopup(): this;
openPopup(latlng?: LatLngExpression): this;
closePopup(): this;
togglePopup(): this;
isPopupOpen(): boolean;
setPopupContent(content: Content | Popup): this;
getPopup(): Popup | undefined;
// Extension methods
onAdd(map: Map): this;
onRemove(map: Map): this;
getEvents?(): {[name: string]: (event: Event) => void};
getAttribution?(): string | null;
beforeAdd?(map: Map): this;
}
// Tooltip methods
bindTooltip(content: ((layer: Layer) => Content) | Tooltip | Content, options?: TooltipOptions): this;
unbindTooltip(): this;
openTooltip(latlng?: LatLngExpression): this;
closeTooltip(): this;
toggleTooltip(): this;
isTooltipOpen(): boolean;
setTooltipContent(content: Content | Tooltip): this;
getTooltip(): Tooltip | undefined;
interface GridLayerOptions {
tileSize?: number | Point;
opacity?: number;
updateWhenIdle?: boolean;
updateWhenZooming?: boolean;
updateInterval?: number;
attribution?: string;
zIndex?: number;
bounds?: LatLngBoundsExpression;
minZoom?: number;
maxZoom?: number;
noWrap?: boolean;
pane?: string;
className?: string;
keepBuffer?: number;
}
// Extension methods
onAdd(map: Map): this;
onRemove(map: Map): this;
getEvents?(): {[name: string]: (event: LeafletEvent) => void};
getAttribution?(): string | null;
beforeAdd?(map: Map): this;
}
class GridLayer extends Layer {
constructor(options?: GridLayerOptions);
bringToFront(): this;
bringToBack(): this;
getContainer(): HTMLElement | null;
setOpacity(opacity: number): this;
setZIndex(zIndex: number): this;
isLoading(): boolean;
redraw(): this;
getTileSize(): Point;
}
export interface GridLayerOptions {
tileSize?: number | Point;
opacity?: number;
updateWhenIdle?: boolean;
updateWhenZooming?: boolean;
updateInterval?: number;
attribution?: string;
zIndex?: number;
bounds?: LatLngBoundsExpression;
minZoom?: number;
maxZoom?: number;
noWrap?: boolean;
pane?: string;
className?: string;
keepBuffer?: number;
}
function gridLayer(options?: GridLayerOptions): GridLayer;
export class GridLayer extends Layer {
constructor(options?: GridLayerOptions);
bringToFront(): this;
bringToBack(): this;
getContainer(): HTMLElement | null;
setOpacity(opacity: number): this;
setZIndex(zIndex: number): this;
isLoading(): boolean;
redraw(): this;
getTileSize(): Point;
}
interface TileLayerOptions extends GridLayerOptions {
minZoom?: number;
maxZoom?: number;
maxNativeZoom?: number;
minNativeZoom?: number;
subdomains?: string | string[];
errorTileUrl?: string;
zoomOffset?: number;
tms?: boolean;
zoomReverse?: boolean;
detectRetina?: boolean;
crossOrigin?: boolean;
[name: string]: any;
}
export function gridLayer(options?: GridLayerOptions): GridLayer;
class TileLayer extends GridLayer {
constructor(urlTemplate: string, options?: TileLayerOptions);
setUrl(url: string, noRedraw?: boolean): this;
export interface TileLayerOptions extends GridLayerOptions {
minZoom?: number;
maxZoom?: number;
maxNativeZoom?: number;
minNativeZoom?: number;
subdomains?: string | string[];
errorTileUrl?: string;
zoomOffset?: number;
tms?: boolean;
zoomReverse?: boolean;
detectRetina?: boolean;
crossOrigin?: boolean;
[name: string]: any;
}
options: TileLayerOptions;
}
export class TileLayer extends GridLayer {
constructor(urlTemplate: string, options?: TileLayerOptions);
setUrl(url: string, noRedraw?: boolean): this;
function tileLayer(urlTemplate: string, options?: TileLayerOptions): TileLayer;
options: TileLayerOptions;
}
namespace TileLayer {
class WMS extends TileLayer {
constructor(baseUrl: string, options: WMSOptions);
setParams(params: WMSParams, noRedraw?: boolean): this;
export function tileLayer(urlTemplate: string, options?: TileLayerOptions): TileLayer;
wmsParams: WMSParams;
options: WMSOptions;
}
}
export namespace TileLayer {
class WMS extends TileLayer {
constructor(baseUrl: string, options: WMSOptions);
setParams(params: WMSParams, noRedraw?: boolean): this;
interface WMSOptions extends TileLayerOptions {
layers?: string;
styles?: string;
format?: string;
transparent?: boolean;
version?: string;
crs?: CRS;
uppercase?: boolean;
wmsParams: WMSParams;
options: WMSOptions;
}
}
interface WMSParams {
format?: string;
layers: string;
request?: string;
service?: string;
styles?: string;
version?: string;
transparent?: boolean;
width?: number;
height?: number;
}
export interface WMSOptions extends TileLayerOptions {
layers?: string;
styles?: string;
format?: string;
transparent?: boolean;
version?: string;
crs?: CRS;
uppercase?: boolean;
}
namespace tileLayer {
function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS;
}
export interface WMSParams {
format?: string;
layers: string;
request?: string;
service?: string;
styles?: string;
version?: string;
transparent?: boolean;
width?: number;
height?: number;
}
interface ImageOverlayOptions extends LayerOptions {
opacity?: number;
alt?: string;
interactive?: boolean;
attribution?: string;
crossOrigin?: boolean;
}
export namespace tileLayer {
function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS;
}
class ImageOverlay extends Layer {
constructor(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions);
setOpacity(opacity: number): this;
bringToFront(): this;
bringToBack(): this;
setUrl(url: string): this;
export interface ImageOverlayOptions extends LayerOptions {
opacity?: number;
alt?: string;
interactive?: boolean;
attribution?: string;
crossOrigin?: boolean;
}
/** Update the bounds that this ImageOverlay covers */
setBounds(bounds: LatLngBounds): this;
export class ImageOverlay extends Layer {
constructor(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions);
setOpacity(opacity: number): this;
bringToFront(): this;
bringToBack(): this;
setUrl(url: string): this;
/** Get the bounds that this ImageOverlay covers */
getBounds(): LatLngBounds;
/** Update the bounds that this ImageOverlay covers */
setBounds(bounds: LatLngBounds): this;
/** Get the img element that represents the ImageOverlay on the map */
getElement(): HTMLImageElement | undefined;
/** Get the bounds that this ImageOverlay covers */
getBounds(): LatLngBounds;
options: ImageOverlayOptions;
}
/** Get the img element that represents the ImageOverlay on the map */
getElement(): HTMLImageElement | undefined;
function imageOverlay(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions): ImageOverlay;
options: ImageOverlayOptions;
}
type LineCapShape = 'butt' | 'round' | 'square' | 'inherit';
export function imageOverlay(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions): ImageOverlay;
type LineJoinShape = 'miter' | 'round' | 'bevel' | 'inherit';
export type LineCapShape = 'butt' | 'round' | 'square' | 'inherit';
type FillRule = 'nonzero' | 'evenodd' | 'inherit';
export type LineJoinShape = 'miter' | 'round' | 'bevel' | 'inherit';
interface PathOptions extends InteractiveLayerOptions {
stroke?: boolean;
color?: string;
weight?: number;
opacity?: number;
lineCap?: LineCapShape;
lineJoin?: LineJoinShape;
dashArray?: string;
dashOffset?: string;
fill?: boolean;
fillColor?: string;
fillOpacity?: number;
fillRule?: FillRule;
renderer?: Renderer;
className?: string;
}
export type FillRule = 'nonzero' | 'evenodd' | 'inherit';
abstract class Path extends Layer {
redraw(): this;
setStyle(style: PathOptions): this;
bringToFront(): this;
bringToBack(): this;
getElement(): Element | undefined;
export interface PathOptions extends InteractiveLayerOptions {
stroke?: boolean;
color?: string;
weight?: number;
opacity?: number;
lineCap?: LineCapShape;
lineJoin?: LineJoinShape;
dashArray?: string;
dashOffset?: string;
fill?: boolean;
fillColor?: string;
fillOpacity?: number;
fillRule?: FillRule;
renderer?: Renderer;
className?: string;
}
options: PathOptions;
}
export abstract class Path extends Layer {
redraw(): this;
setStyle(style: PathOptions): this;
bringToFront(): this;
bringToBack(): this;
getElement(): Element | undefined;
interface PolylineOptions extends PathOptions {
smoothFactor?: number;
noClip?: boolean;
}
options: PathOptions;
}
class InternalPolyline extends Path {
getLatLngs(): LatLng[];
setLatLngs(latlngs: LatLngExpression[]): this;
isEmpty(): boolean;
getCenter(): LatLng;
getBounds(): LatLngBounds;
addLatLng(latlng: LatLngExpression | LatLngExpression[]): this;
export interface PolylineOptions extends PathOptions {
smoothFactor?: number;
noClip?: boolean;
}
options: PolylineOptions;
}
export class Polyline<T extends geojson.GeometryObject = geojson.LineString | geojson.MultiLineString> extends Path {
constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
toGeoJSON(): geojson.Feature<T>;
getLatLngs(): LatLng[];
setLatLngs(latlngs: LatLngExpression[]): this;
isEmpty(): boolean;
getCenter(): LatLng;
getBounds(): LatLngBounds;
addLatLng(latlng: LatLngExpression | LatLngExpression[]): this;
class Polyline extends InternalPolyline {
constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
toGeoJSON(): GeoJSONFeature<GeoJSONLineString | GeoJSONMultiLineString>;
feature?: geojson.Feature<T>;
options: PolylineOptions;
}
feature?: GeoJSONFeature<GeoJSONLineString | GeoJSONMultiLineString>;
}
export function polyline(latlngs: LatLngExpression[], options?: PolylineOptions): Polyline;
function polyline(latlngs: LatLngExpression[], options?: PolylineOptions): Polyline;
export class Polygon extends Polyline<geojson.Polygon | geojson.MultiPolygon> {
constructor(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions);
}
class Polygon extends InternalPolyline {
constructor(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions);
toGeoJSON(): GeoJSONFeature<GeoJSONPolygon | GeoJSONMultiPolygon>;
export function polygon(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions): Polygon;
feature?: GeoJSONFeature<GeoJSONPolygon | GeoJSONMultiPolygon>;
}
export class Rectangle extends Polygon {
constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions);
setBounds(latLngBounds: LatLngBoundsExpression): this;
}
function polygon(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions): Polygon;
export function rectangle(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions): Rectangle;
class Rectangle extends Polygon {
constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions);
setBounds(latLngBounds: LatLngBoundsExpression): this;
}
export interface CircleMarkerOptions extends PathOptions {
radius?: number;
}
function rectangle(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions): Rectangle;
export class CircleMarker extends Path {
constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
toGeoJSON(): geojson.Feature<geojson.Point>;
setLatLng(latLng: LatLngExpression): this;
getLatLng(): LatLng;
setRadius(radius: number): this;
getRadius(): number;
interface CircleMarkerOptions extends PathOptions {
radius?: number;
}
options: CircleMarkerOptions;
feature?: geojson.Feature<geojson.Point>;
}
class CircleMarker extends Path {
constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
toGeoJSON(): GeoJSONFeature<GeoJSONPoint>;
setLatLng(latLng: LatLngExpression): this;
getLatLng(): LatLng;
setRadius(radius: number): this;
getRadius(): number;
export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker;
options: CircleMarkerOptions;
feature?: GeoJSONFeature<GeoJSONPoint>;
}
export class Circle extends CircleMarker {
constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
constructor(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions); // deprecated!
getBounds(): LatLngBounds;
}
function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker;
export function circle(latlng: LatLngExpression, options?: CircleMarkerOptions): Circle;
export function circle(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions): Circle; // deprecated!
class Circle extends CircleMarker {
constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
constructor(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions); // deprecated!
getBounds(): LatLngBounds;
}
export interface RendererOptions extends LayerOptions {
padding?: number;
}
function circle(latlng: LatLngExpression, options?: CircleMarkerOptions): Circle;
function circle(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions): Circle; // deprecated!
export class Renderer extends Layer {
constructor(options?: RendererOptions);
interface RendererOptions extends LayerOptions {
padding?: number;
}
options: RendererOptions;
}
class Renderer extends Layer {
constructor(options?: RendererOptions);
export class SVG extends Renderer {}
options: RendererOptions;
}
export namespace SVG {
function create(name: string): SVGElement;
class SVG extends Renderer {}
function pointsToPath(rings: PointExpression[], close: boolean): string;
}
namespace SVG {
function create(name: string): SVGElement;
export function svg(options?: RendererOptions): SVG;
function pointsToPath(rings: PointExpression[], close: boolean): string;
}
export class Canvas extends Renderer {}
function svg(options?: RendererOptions): SVG;
export function canvas(options?: RendererOptions): Canvas;
class Canvas extends Renderer {}
/**
* 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.
*/
export class LayerGroup extends Layer {
constructor(layers?: Layer[]);
/**
* Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint).
*/
toGeoJSON(): geojson.FeatureCollection<geojson.GeometryObject> | geojson.Feature<geojson.MultiPoint> | geojson.GeometryCollection;
function canvas(options?: RendererOptions): Canvas;
/**
* Adds the given layer to the group.
*/
addLayer(layer: Layer): this;
/**
* 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.
* Removes the layer with the given internal ID or the given layer from the group.
*/
class LayerGroup extends Layer {
constructor(layers?: Layer[]);
/**
* Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint).
*/
toGeoJSON(): GeoJSONFeatureCollection<GeoJSONGeometryObject> | GeoJSONFeature<GeoJSONMultiPoint> | GeoJSONGeometryCollection;
removeLayer(layer: number | Layer): this;
/**
* Adds the given layer to the group.
*/
addLayer(layer: Layer): this;
/**
* Returns true if the given layer is currently added to the group.
*/
hasLayer(layer: Layer): boolean;
/**
* Removes the layer with the given internal ID or the given layer from the group.
*/
removeLayer(layer: number | Layer): this;
/**
* Removes all the layers from the group.
*/
clearLayers(): this;
/**
* Returns true if the given layer is currently added to the group.
*/
hasLayer(layer: Layer): boolean;
/**
* Calls methodName on every layer contained in this group, passing any additional parameters.
* Has no effect if the layers contained do not implement methodName.
*/
invoke(methodName: string, ...params: any[]): this;
/**
* Removes all the layers from the group.
*/
clearLayers(): this;
/**
* Iterates over the layers of the group,
* optionally specifying context of the iterator function.
*/
eachLayer(fn: (layer: Layer) => void, context?: 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.
*/
invoke(methodName: string, ...params: any[]): this;
/**
* Returns the layer with the given internal ID.
*/
getLayer(id: number): Layer | undefined;
/**
* Iterates over the layers of the group,
* optionally specifying context of the iterator function.
*/
eachLayer(fn: (layer: Layer) => void, context?: any): this;
/**
* Returns an array of all the layers added to the group.
*/
getLayers(): Layer[];
/**
* Returns the layer with the given internal ID.
*/
getLayer(id: number): Layer | undefined;
/**
* Calls setZIndex on every layer contained in this group, passing the z-index.
*/
setZIndex(zIndex: number): this;
/**
* Returns an array of all the layers added to the group.
*/
getLayers(): Layer[];
/**
* Returns the internal ID for a layer
*/
getLayerId(layer: Layer): number;
/**
* Calls setZIndex on every layer contained in this group, passing the z-index.
*/
setZIndex(zIndex: number): this;
feature?: geojson.FeatureCollection<geojson.GeometryObject> | geojson.Feature<geojson.MultiPoint> | geojson.GeometryCollection;
}
/**
* Returns the internal ID for a layer
*/
getLayerId(layer: Layer): number;
/**
* Create a layer group, optionally given an initial set of layers.
*/
export function layerGroup(layers: Layer[]): LayerGroup;
feature?: GeoJSONFeatureCollection<GeoJSONGeometryObject> | GeoJSONFeature<GeoJSONMultiPoint> | GeoJSONGeometryCollection;
}
/**
* Extended LayerGroup that also has mouse events (propagated from
* members of the group) and a shared bindPopup method.
*/
export class FeatureGroup extends LayerGroup {
/**
* Sets the given path options to each layer of the group that has a setStyle method.
*/
setStyle(style: StyleFunction): this;
/**
* Create a layer group, optionally given an initial set of layers.
* Brings the layer group to the top of all other layers
*/
function layerGroup(layers: Layer[]): LayerGroup;
bringToFront(): this;
/**
* Extended LayerGroup that also has mouse events (propagated from
* members of the group) and a shared bindPopup method.
* Brings the layer group to the top [sic] of all other layers
*/
class FeatureGroup extends LayerGroup {
/**
* Sets the given path options to each layer of the group that has a setStyle method.
*/
setStyle(style: StyleFunction): this;
bringToBack(): this;
/**
* Brings the layer group to the top of all other layers
*/
bringToFront(): this;
/**
* Returns the LatLngBounds of the Feature Group (created from
* bounds and coordinates of its children).
*/
getBounds(): LatLngBounds;
}
/**
* Brings the layer group to the top [sic] of all other layers
*/
bringToBack(): this;
/**
* Create a feature group, optionally given an initial set of layers.
*/
export function featureGroup(layers?: Layer[]): FeatureGroup;
/**
* Returns the LatLngBounds of the Feature Group (created from
* bounds and coordinates of its children).
*/
getBounds(): LatLngBounds;
}
export type StyleFunction = (feature?: geojson.Feature<geojson.GeometryObject>) => PathOptions;
export interface GeoJSONOptions extends LayerOptions {
/**
* Create a feature group, optionally given an initial set of layers.
* A Function defining how GeoJSON points spawn Leaflet layers.
* It is internally called when data is added, passing the GeoJSON point
* feature and its LatLng.
*
* The default is to spawn a default Marker:
*
* ```
* function(geoJsonPoint, latlng) {
* return L.marker(latlng);
* }
* ```
*/
function featureGroup(layers?: Layer[]): FeatureGroup;
pointToLayer?(geoJsonPoint: geojson.Feature<geojson.Point>, latlng: LatLng): Layer; // should import GeoJSON typings
type StyleFunction = (feature?: GeoJSONFeature<GeoJSONGeometryObject>) => PathOptions;
/**
* A Function defining the Path options for styling GeoJSON lines and polygons,
* called internally when data is added.
*
* The default value is to not override any defaults:
*
* ```
* function (geoJsonFeature) {
* return {}
* }
* ```
*/
style?: StyleFunction;
interface GeoJSONOptions extends LayerOptions {
/**
* A Function defining how GeoJSON points spawn Leaflet layers.
* It is internally called when data is added, passing the GeoJSON point
* feature and its LatLng.
*
* The default is to spawn a default Marker:
*
* ```
* function(geoJsonPoint, latlng) {
* return L.marker(latlng);
* }
* ```
*/
pointToLayer?(geoJsonPoint: GeoJSONFeature<GeoJSONPoint>, latlng: LatLng): Layer; // should import GeoJSON typings
/**
* A Function that will be called once for each created Feature, after it
* has been created and styled. Useful for attaching events and popups to features.
*
* The default is to do nothing with the newly created layers:
*
* ```
* function (feature, layer) {}
* ```
*/
onEachFeature?(feature: geojson.Feature<geojson.GeometryObject>, layer: Layer): void;
/**
* A Function defining the Path options for styling GeoJSON lines and polygons,
* called internally when data is added.
*
* The default value is to not override any defaults:
*
* ```
* function (geoJsonFeature) {
* return {}
* }
* ```
*/
style?: StyleFunction;
/**
* A Function that will be used to decide whether to show a feature or not.
*
* The default is to show all features:
*
* ```
* function (geoJsonFeature) {
* return true;
* }
* ```
*/
filter?(geoJsonFeature: geojson.Feature<geojson.GeometryObject>): boolean;
/**
* A Function that will be called once for each created Feature, after it
* has been created and styled. Useful for attaching events and popups to features.
*
* The default is to do nothing with the newly created layers:
*
* ```
* function (feature, layer) {}
* ```
*/
onEachFeature?(feature: GeoJSONFeature<GeoJSONGeometryObject>, layer: Layer): void;
/**
* A Function that will be used for converting GeoJSON coordinates to LatLngs.
* The default is the coordsToLatLng static method.
*/
coordsToLatLng?(coords: [number, number] | [number, number, number]): LatLng; // check if LatLng has an altitude property
}
/**
* A Function that will be used to decide whether to show a feature or not.
*
* The default is to show all features:
*
* ```
* function (geoJsonFeature) {
* return true;
* }
* ```
*/
filter?(geoJsonFeature: GeoJSONFeature<GeoJSONGeometryObject>): boolean;
/**
* Represents a GeoJSON object or an array of GeoJSON objects.
* Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup.
*/
export class GeoJSON extends FeatureGroup {
/**
* Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer
* and/or coordsToLatLng functions if provided as options.
*/
static geometryToLayer(featureData: geojson.Feature<geojson.GeometryObject>, options?: GeoJSONOptions): Layer;
/**
* A Function that will be used for converting GeoJSON coordinates to LatLngs.
* The default is the coordsToLatLng static method.
*/
coordsToLatLng?(coords: [number, number] | [number, number, number]): LatLng; // check if LatLng has an altitude property
}
/**
* Creates a LatLng object from an array of 2 numbers (longitude, latitude) or
* 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
*/
static coordsToLatLng(coords: [number, number] | [number, number, number]): LatLng;
/**
* Represents a GeoJSON object or an array of GeoJSON objects.
* Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup.
* 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.
*/
class GeoJSON extends FeatureGroup {
/**
* Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer
* and/or coordsToLatLng functions if provided as options.
*/
static geometryToLayer(featureData: GeoJSONFeature<GeoJSONGeometryObject>, options?: GeoJSONOptions): Layer;
static coordsToLatLngs(
coords: any[],
levelsDeep?: number,
coordsToLatLng?: (coords: [number, number] | [number, number, number]) => LatLng): any[]; // Using any[] to avoid artificially limiting valid calls
/**
* Creates a LatLng object from an array of 2 numbers (longitude, latitude) or
* 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
*/
static coordsToLatLng(coords: [number, number] | [number, number, number]): LatLng;
/**
* Reverse of coordsToLatLng
*/
static latLngToCoords(latlng: LatLng): [number, number] | [number, number, number];
/**
* 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.
*/
static coordsToLatLngs(
coords: any[],
levelsDeep?: number,
coordsToLatLng?: (coords: [number, number] | [number, number, number]) => LatLng): any[]; // Using any[] to avoid artificially limiting valid calls
/**
* 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.
*/
static latLngsToCoords(latlngs: any[], levelsDeep?: number, closed?: boolean): any[]; // Using any[] to avoid artificially limiting valid calls
/**
* Reverse of coordsToLatLng
*/
static latLngToCoords(latlng: LatLng): [number, number] | [number, number, number];
/**
* Normalize GeoJSON geometries/features into GeoJSON features.
*/
static asFeature(geojson: geojson.Feature<geojson.GeometryObject> | geojson.GeometryObject): geojson.Feature<geojson.GeometryObject>;
/**
* 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.
*/
static latLngsToCoords(latlngs: any[], levelsDeep?: number, closed?: boolean): any[]; // Using any[] to avoid artificially limiting valid calls
constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions)
/**
* Adds a GeoJSON object to the layer.
*/
addData(data: geojson.GeoJsonObject): Layer;
/**
* Normalize GeoJSON geometries/features into GeoJSON features.
*/
static asFeature(geojson: GeoJSONFeature<GeoJSONGeometryObject> | GeoJSONGeometryObject): GeoJSONFeature<GeoJSONGeometryObject>;
/**
* Resets the given vector layer's style to the original GeoJSON style,
* useful for resetting style after hover events.
*/
resetStyle(layer: Layer): Layer;
constructor(geojson?: GeoJSONGeoJsonObject, options?: GeoJSONOptions)
/**
* Adds a GeoJSON object to the layer.
*/
addData(data: GeoJSONGeoJsonObject): Layer;
/**
* Resets the given vector layer's style to the original GeoJSON style,
* useful for resetting style after hover events.
*/
resetStyle(layer: Layer): Layer;
/**
* Changes styles of GeoJSON vector layers with the given style function.
*/
setStyle(style: StyleFunction): this;
options: GeoJSONOptions;
}
/**
* 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.
* Changes styles of GeoJSON vector layers with the given style function.
*/
function geoJSON(geojson?: GeoJSONGeoJsonObject, options?: GeoJSONOptions): GeoJSON;
setStyle(style: StyleFunction): this;
type Zoom = boolean | 'center';
options: GeoJSONOptions;
}
interface MapOptions {
preferCanvas?: boolean;
/**
* 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.
*/
export function geoJSON(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions): GeoJSON;
// Control options
attributionControl?: boolean;
zoomControl?: boolean;
export type Zoom = boolean | 'center';
// Interaction options
closePopupOnClick?: boolean;
zoomSnap?: number;
zoomDelta?: number;
trackResize?: boolean;
boxZoom?: boolean;
doubleClickZoom?: Zoom;
dragging?: boolean;
export interface MapOptions {
preferCanvas?: boolean;
// Map state options
crs?: CRS;
center?: LatLngExpression;
zoom?: number;
minZoom?: number;
maxZoom?: number;
layers?: Layer[];
maxBounds?: LatLngBoundsExpression;
renderer?: Renderer;
// Control options
attributionControl?: boolean;
zoomControl?: boolean;
// Animation options
fadeAnimation?: boolean;
markerZoomAnimation?: boolean;
transform3DLimit?: number;
zoomAnimation?: boolean;
zoomAnimationThreshold?: number;
// Interaction options
closePopupOnClick?: boolean;
zoomSnap?: number;
zoomDelta?: number;
trackResize?: boolean;
boxZoom?: boolean;
doubleClickZoom?: Zoom;
dragging?: boolean;
// Panning inertia options
inertia?: boolean;
inertiaDeceleration?: number;
inertiaMaxSpeed?: number;
easeLinearity?: number;
worldCopyJump?: boolean;
maxBoundsViscosity?: number;
// Map state options
crs?: CRS;
center?: LatLngExpression;
zoom?: number;
minZoom?: number;
maxZoom?: number;
layers?: Layer[];
maxBounds?: LatLngBoundsExpression;
renderer?: Renderer;
// Keyboard navigation options
keyboard?: boolean;
keyboardPanDelta?: number;
// Animation options
fadeAnimation?: boolean;
markerZoomAnimation?: boolean;
transform3DLimit?: number;
zoomAnimation?: boolean;
zoomAnimationThreshold?: number;
// Mousewheel options
scrollWheelZoom?: Zoom;
wheelDebounceTime?: number;
wheelPxPerZoomLevel?: number;
// Panning inertia options
inertia?: boolean;
inertiaDeceleration?: number;
inertiaMaxSpeed?: number;
easeLinearity?: number;
worldCopyJump?: boolean;
maxBoundsViscosity?: number;
// Touch interaction options
tap?: boolean;
tapTolerance?: number;
touchZoom?: Zoom;
bounceAtZoomLimits?: boolean;
}
// Keyboard navigation options
keyboard?: boolean;
keyboardPanDelta?: number;
type ControlPosition = 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
// Mousewheel options
scrollWheelZoom?: Zoom;
wheelDebounceTime?: number;
wheelPxPerZoomLevel?: number;
interface ControlOptions {
position?: ControlPosition;
}
// Touch interaction options
tap?: boolean;
tapTolerance?: number;
touchZoom?: Zoom;
bounceAtZoomLimits?: boolean;
}
class Control extends Class {
constructor(options?: ControlOptions);
getPosition(): ControlPosition;
setPosition(position: ControlPosition): this;
getContainer(): HTMLElement | undefined;
addTo(map: Map): this;
remove(): this;
export type ControlPosition = 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
// Extension methods
onAdd?(map: Map): HTMLElement;
onRemove?(map: Map): void;
export interface ControlOptions {
position?: ControlPosition;
}
options: ControlOptions;
}
export class Control extends Class {
constructor(options?: ControlOptions);
getPosition(): ControlPosition;
setPosition(position: ControlPosition): this;
getContainer(): HTMLElement | undefined;
addTo(map: Map): this;
remove(): this;
namespace Control {
interface ZoomOptions extends ControlOptions {
zoomInText?: string;
zoomInTitle?: string;
zoomOutText?: string;
zoomOutTitle?: string;
}
// Extension methods
onAdd?(map: Map): HTMLElement;
onRemove?(map: Map): void;
class Zoom extends Control {
constructor(options?: ZoomOptions);
options: ZoomOptions;
}
options: ControlOptions;
}
interface AttributionOptions extends ControlOptions {
prefix?: string | boolean;
}
export namespace Control {
interface ZoomOptions extends ControlOptions {
zoomInText?: string;
zoomInTitle?: string;
zoomOutText?: string;
zoomOutTitle?: string;
}
class Attribution extends Control {
constructor(options?: AttributionOptions);
setPrefix(prefix: string): this;
addAttribution(text: string): this;
removeAttribution(text: string): this;
options: AttributionOptions;
}
class Zoom extends Control {
constructor(options?: ZoomOptions);
options: ZoomOptions;
}
interface LayersOptions extends ControlOptions {
collapsed?: boolean;
autoZIndex?: boolean;
hideSingleBase?: boolean;
}
interface AttributionOptions extends ControlOptions {
prefix?: string | boolean;
}
interface LayersObject {
[name: string]: Layer;
}
class Attribution extends Control {
constructor(options?: AttributionOptions);
setPrefix(prefix: string): this;
addAttribution(text: string): this;
removeAttribution(text: string): this;
options: AttributionOptions;
}
class Layers extends Control {
constructor(baseLayers?: LayersObject, overlays?: LayersObject, options?: LayersOptions);
addBaseLayer(layer: Layer, name: string): this;
addOverlay(layer: Layer, name: string): this;
removeLayer(layer: Layer): this;
expand(): this;
collapse(): this;
options: LayersOptions;
}
interface ScaleOptions extends ControlOptions {
maxWidth?: number;
metric?: boolean;
imperial?: boolean;
updateWhenIdle?: boolean;
}
class Scale extends Control {
constructor(options?: ScaleOptions);
options: ScaleOptions;
}
interface LayersOptions extends ControlOptions {
collapsed?: boolean;
autoZIndex?: boolean;
hideSingleBase?: boolean;
}
namespace control {
function zoom(options?: Control.ZoomOptions): Control.Zoom;
function attribution(options?: Control.AttributionOptions): Control.Attribution;
function layers(baseLayers?: Control.LayersObject, overlays?: Control.LayersObject, options?: Control.LayersOptions): Control.Layers;
function scale(options?: Control.ScaleOptions): Control.Scale;
interface LayersObject {
[name: string]: Layer;
}
interface DivOverlayOptions {
offset?: PointExpression;
zoomAnimation?: boolean;
className?: string;
pane?: string;
class Layers extends Control {
constructor(baseLayers?: LayersObject, overlays?: LayersObject, options?: LayersOptions);
addBaseLayer(layer: Layer, name: string): this;
addOverlay(layer: Layer, name: string): this;
removeLayer(layer: Layer): this;
expand(): this;
collapse(): this;
options: LayersOptions;
}
interface PopupOptions extends DivOverlayOptions {
interface ScaleOptions extends ControlOptions {
maxWidth?: number;
minWidth?: number;
maxHeight?: number;
autoPan?: boolean;
autoPanPaddingTopLeft?: PointExpression;
autoPanPaddingBottomRight?: PointExpression;
autoPanPadding?: PointExpression;
keepInView?: boolean;
closeButton?: boolean;
autoClose?: boolean;
closeOnClick?: boolean;
metric?: boolean;
imperial?: boolean;
updateWhenIdle?: boolean;
}
type Content = string | HTMLElement;
class Scale extends Control {
constructor(options?: ScaleOptions);
options: ScaleOptions;
}
}
class Popup extends Layer {
constructor(options?: PopupOptions, source?: Layer);
getLatLng(): LatLng | undefined;
setLatLng(latlng: LatLngExpression): this;
getContent(): Content | ((source: Layer) => Content) | undefined;
setContent(htmlContent: ((source: Layer) => Content) | Content): this;
getElement(): HTMLElement | undefined;
update(): void;
isOpen(): boolean;
bringToFront(): this;
bringToBack(): this;
openOn(map: Map): this;
export namespace control {
function zoom(options?: Control.ZoomOptions): Control.Zoom;
options: PopupOptions;
}
function attribution(options?: Control.AttributionOptions): Control.Attribution;
function popup(options?: PopupOptions, source?: Layer): Popup;
function layers(baseLayers?: Control.LayersObject, overlays?: Control.LayersObject, options?: Control.LayersOptions): Control.Layers;
type Direction = 'right' | 'left' | 'top' | 'bottom' | 'center' | 'auto';
function scale(options?: Control.ScaleOptions): Control.Scale;
}
interface TooltipOptions extends DivOverlayOptions {
pane?: string;
offset?: PointExpression;
direction?: Direction;
permanent?: boolean;
sticky?: boolean;
interactive?: boolean;
opacity?: number;
}
export interface DivOverlayOptions {
offset?: PointExpression;
zoomAnimation?: boolean;
className?: string;
pane?: string;
}
class Tooltip extends Layer {
constructor(options?: TooltipOptions, source?: Layer);
setOpacity(val: number): void;
getLatLng(): LatLng | undefined;
setLatLng(latlng: LatLngExpression): this;
getContent(): Content | undefined;
setContent(htmlContent: ((source: Layer) => Content) | Content): this;
getElement(): HTMLElement | undefined;
update(): void;
isOpen(): boolean;
bringToFront(): this;
bringToBack(): this;
export interface PopupOptions extends DivOverlayOptions {
maxWidth?: number;
minWidth?: number;
maxHeight?: number;
autoPan?: boolean;
autoPanPaddingTopLeft?: PointExpression;
autoPanPaddingBottomRight?: PointExpression;
autoPanPadding?: PointExpression;
keepInView?: boolean;
closeButton?: boolean;
autoClose?: boolean;
closeOnClick?: boolean;
}
options: TooltipOptions;
}
export type Content = string | HTMLElement;
function tooltip(options?: TooltipOptions, source?: Layer): Tooltip;
export class Popup extends Layer {
constructor(options?: PopupOptions, source?: Layer);
getLatLng(): LatLng | undefined;
setLatLng(latlng: LatLngExpression): this;
getContent(): Content | ((source: Layer) => Content) | undefined;
setContent(htmlContent: ((source: Layer) => Content) | Content): this;
getElement(): HTMLElement | undefined;
update(): void;
isOpen(): boolean;
bringToFront(): this;
bringToBack(): this;
openOn(map: Map): this;
interface ZoomOptions {
animate?: boolean;
}
options: PopupOptions;
}
interface PanOptions {
animate?: boolean;
duration?: number;
easeLinearity?: number;
noMoveStart?: boolean;
}
export function popup(options?: PopupOptions, source?: Layer): Popup;
/* tslint:disable:no-empty-interface */ // This is not empty, it extends two interfaces into one...
interface ZoomPanOptions extends ZoomOptions, PanOptions {}
/* tslint:enable */
export type Direction = 'right' | 'left' | 'top' | 'bottom' | 'center' | 'auto';
interface FitBoundsOptions extends ZoomOptions, PanOptions {
paddingTopLeft?: PointExpression;
paddingBottomRight?: PointExpression;
padding?: PointExpression;
maxZoom?: number;
}
export interface TooltipOptions extends DivOverlayOptions {
pane?: string;
offset?: PointExpression;
direction?: Direction;
permanent?: boolean;
sticky?: boolean;
interactive?: boolean;
opacity?: number;
}
interface LocateOptions {
watch?: boolean;
setView?: boolean;
maxZoom?: number;
timeout?: number;
maximumAge?: number;
enableHighAccuracy?: boolean;
}
export class Tooltip extends Layer {
constructor(options?: TooltipOptions, source?: Layer);
setOpacity(val: number): void;
getLatLng(): LatLng | undefined;
setLatLng(latlng: LatLngExpression): this;
getContent(): Content | undefined;
setContent(htmlContent: ((source: Layer) => Content) | Content): this;
getElement(): HTMLElement | undefined;
update(): void;
isOpen(): boolean;
bringToFront(): this;
bringToBack(): this;
class Handler extends Class {
constructor(map: Map);
enable(): this;
disable(): this;
enabled(): boolean;
options: TooltipOptions;
}
// Extension methods
addHooks?(): void;
removeHooks?(): void;
}
export function tooltip(options?: TooltipOptions, source?: Layer): Tooltip;
interface Event {
type: string;
target: any;
}
export interface ZoomOptions {
animate?: boolean;
}
interface MouseEvent extends Event {
latlng: LatLng;
layerPoint: Point;
containerPoint: Point;
originalEvent: NativeMouseEvent;
}
export interface PanOptions {
animate?: boolean;
duration?: number;
easeLinearity?: number;
noMoveStart?: boolean;
}
interface KeyboardEvent extends Event {
originalEvent: NativeKeyboardEvent;
}
/* tslint:disable:no-empty-interface */ // This is not empty, it extends two interfaces into one...
export interface ZoomPanOptions extends ZoomOptions, PanOptions {}
/* tslint:enable */
interface LocationEvent extends Event {
latlng: LatLng;
bounds: LatLngBounds;
accuracy: number;
altitude: number;
altitudeAccuracy: number;
heading: number;
speed: number;
timestamp: number;
}
export interface FitBoundsOptions extends ZoomOptions, PanOptions {
paddingTopLeft?: PointExpression;
paddingBottomRight?: PointExpression;
padding?: PointExpression;
maxZoom?: number;
}
interface ErrorEvent extends Event {
message: string;
code: number;
}
export interface LocateOptions {
watch?: boolean;
setView?: boolean;
maxZoom?: number;
timeout?: number;
maximumAge?: number;
enableHighAccuracy?: boolean;
}
interface LayerEvent extends Event {
layer: Layer;
}
export class Handler extends Class {
constructor(map: Map);
enable(): this;
disable(): this;
enabled(): boolean;
interface LayersControlEvent extends LayerEvent {
name: string;
}
// Extension methods
addHooks?(): void;
removeHooks?(): void;
}
interface TileEvent extends Event {
tile: HTMLImageElement;
coords: Point; // apparently not a normal point, since docs say it has z (zoom)
}
export interface LeafletEvent {
type: string;
target: any;
}
interface TileErrorEvent extends TileEvent {
error: Error;
}
export interface LeafletMouseEvent extends LeafletEvent {
latlng: LatLng;
layerPoint: Point;
containerPoint: Point;
originalEvent: MouseEvent;
}
interface ResizeEvent extends Event {
oldSize: Point;
newSize: Point;
}
export interface LeafletKeyboardEvent extends LeafletEvent {
originalEvent: KeyboardEvent;
}
interface GeoJSONEvent extends Event {
layer: Layer;
properties: any;
geometryType: string;
id: string;
}
export interface LocationEvent extends LeafletEvent {
latlng: LatLng;
bounds: LatLngBounds;
accuracy: number;
altitude: number;
altitudeAccuracy: number;
heading: number;
speed: number;
timestamp: number;
}
interface PopupEvent extends Event {
popup: Popup;
}
export interface ErrorEvent extends LeafletEvent {
message: string;
code: number;
}
interface TooltipEvent extends Event {
tooltip: Tooltip;
}
export interface LayerEvent extends LeafletEvent {
layer: Layer;
}
interface DragEndEvent extends Event {
distance: number;
}
export interface LayersControlEvent extends LayerEvent {
name: string;
}
interface ZoomAnimEvent extends Event {
center: LatLng;
zoom: number;
noUpdate: boolean;
}
export interface TileEvent extends LeafletEvent {
tile: HTMLImageElement;
coords: Point; // apparently not a normal point, since docs say it has z (zoom)
}
namespace DomEvent {
function on(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
export interface TileErrorEvent extends TileEvent {
error: Error;
}
function on(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
export interface ResizeEvent extends LeafletEvent {
oldSize: Point;
newSize: Point;
}
function off(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
export interface GeoJSONEvent extends LeafletEvent {
layer: Layer;
properties: any;
geometryType: string;
id: string;
}
function off(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
export interface PopupEvent extends LeafletEvent {
popup: Popup;
}
function stopPropagation(ev: Event): typeof DomEvent;
export interface TooltipEvent extends LeafletEvent {
tooltip: Tooltip;
}
function disableScrollPropagation(el: HTMLElement): typeof DomEvent;
export interface DragEndEvent extends LeafletEvent {
distance: number;
}
function disableClickPropagation(el: HTMLElement): typeof DomEvent;
export interface ZoomAnimEvent extends LeafletEvent {
center: LatLng;
zoom: number;
noUpdate: boolean;
}
function preventDefault(ev: Event): typeof DomEvent;
export namespace DomEvent {
type EventHandlerFn = (event: Event) => void;
function stop(ev: Event): typeof DomEvent;
function on(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
function getMousePosition(ev: {clientX: number, clientY: number} /*MouseEvent from lib.d.ts*/, container?: HTMLElement): Point;
function on(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
function getWheelDelta(ev: Event): number;
function off(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
function addListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
function off(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
function addListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
function stopPropagation(ev: Event): typeof DomEvent;
function removeListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
function disableScrollPropagation(el: HTMLElement): typeof DomEvent;
function removeListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
}
function disableClickPropagation(el: HTMLElement): typeof DomEvent;
interface DefaultMapPanes {
mapPane: HTMLElement;
tilePane: HTMLElement;
overlayPane: HTMLElement;
shadowPane: HTMLElement;
markerPane: HTMLElement;
tooltipPane: HTMLElement;
popupPane: HTMLElement;
}
function preventDefault(ev: Event): typeof DomEvent;
class Map extends Evented {
constructor(element: string | HTMLElement, options?: MapOptions);
getRenderer(layer: Path): Renderer;
function stop(ev: Event): typeof DomEvent;
// Methods for layers and controls
addControl(control: Control): this;
removeControl(control: Control): this;
addLayer(layer: Layer): this;
removeLayer(layer: Layer): this;
hasLayer(layer: Layer): boolean;
eachLayer(fn: (layer: Layer) => void, context?: any): this;
openPopup(popup: Popup): this;
openPopup(content: Content, latlng: LatLngExpression, options?: PopupOptions): this;
closePopup(popup?: Popup): this;
openTooltip(tooltip: Tooltip): this;
openTooltip(content: Content, latlng: LatLngExpression, options?: TooltipOptions): this;
closeTooltip(tooltip?: Tooltip): this;
function getMousePosition(ev: MouseEvent, container?: HTMLElement): Point;
// Methods for modifying map state
setView(center: LatLngExpression, zoom: number, options?: ZoomPanOptions): this;
setZoom(zoom: number, options?: ZoomPanOptions): this;
zoomIn(delta?: number, options?: ZoomOptions): this;
zoomOut(delta?: number, options?: ZoomOptions): this;
setZoomAround(position: Point | LatLngExpression, zoom: number, options?: ZoomOptions): this;
fitBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
fitWorld(options?: FitBoundsOptions): this;
panTo(latlng: LatLngExpression, options?: PanOptions): this;
panBy(offset: PointExpression): this;
setMaxBounds(bounds: LatLngBoundsExpression): this;
setMinZoom(zoom: number): this;
setMaxZoom(zoom: number): this;
panInsideBounds(bounds: LatLngBoundsExpression, options?: PanOptions): this;
/**
* Boolean for animate or advanced ZoomPanOptions
*/
invalidateSize(options?: boolean | ZoomPanOptions): this;
stop(): this;
flyTo(latlng: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this;
flyToBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
function getWheelDelta(ev: Event): number;
// Other methods
addHandler(name: string, HandlerClass: () => Handler): this; // HandlerClass is actually a constructor function, is this the right way?
remove(): this;
createPane(name: string, container?: HTMLElement): HTMLElement;
/**
* Name of the pane or the pane as HTML-Element
*/
getPane(pane: string | HTMLElement): HTMLElement | undefined;
getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes;
getContainer(): HTMLElement;
whenReady(fn: () => void, context?: any): this;
function addListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
// Methods for getting map state
getCenter(): LatLng;
getZoom(): number;
getBounds(): LatLngBounds;
getMinZoom(): number;
getMaxZoom(): number;
getBoundsZoom(bounds: LatLngBoundsExpression, inside?: boolean): number;
getSize(): Point;
getPixelBounds(): Bounds;
getPixelOrigin(): Point;
getPixelWorldBounds(zoom?: number): Bounds;
function addListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
// Conversion methods
getZoomScale(toZoom: number, fromZoom: number): number;
getScaleZoom(scale: number, fromZoom: number): number;
project(latlng: LatLngExpression, zoom: number): Point;
unproject(point: PointExpression, zoom: number): LatLng;
layerPointToLatLng(point: PointExpression): LatLng;
latLngToLayerPoint(latlng: LatLngExpression): Point;
wrapLatLng(latlng: LatLngExpression): LatLng;
wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds;
distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
containerPointToLayerPoint(point: PointExpression): Point;
containerPointToLatLng(point: PointExpression): LatLng;
layerPointToContainerPoint(point: PointExpression): Point;
latLngToContainerPoint(latlng: LatLngExpression): Point;
mouseEventToContainerPoint(ev: MouseEvent): Point;
mouseEventToLayerPoint(ev: MouseEvent): Point;
mouseEventToLatLng(ev: MouseEvent): LatLng;
function removeListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
// Geolocation methods
locate(options?: LocateOptions): this;
stopLocate(): this;
function removeListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
}
// Properties
boxZoom: Handler;
doubleClickZoom: Handler;
dragging: Handler;
keyboard: Handler;
scrollWheelZoom: Handler;
tap?: Handler;
touchZoom: Handler;
export interface DefaultMapPanes {
mapPane: HTMLElement;
tilePane: HTMLElement;
overlayPane: HTMLElement;
shadowPane: HTMLElement;
markerPane: HTMLElement;
tooltipPane: HTMLElement;
popupPane: HTMLElement;
}
options: MapOptions;
}
export class Map extends Evented {
constructor(element: string | HTMLElement, options?: MapOptions);
getRenderer(layer: Path): Renderer;
// Methods for layers and controls
addControl(control: Control): this;
removeControl(control: Control): this;
addLayer(layer: Layer): this;
removeLayer(layer: Layer): this;
hasLayer(layer: Layer): boolean;
eachLayer(fn: (layer: Layer) => void, context?: any): this;
openPopup(popup: Popup): this;
openPopup(content: Content, latlng: LatLngExpression, options?: PopupOptions): this;
closePopup(popup?: Popup): this;
openTooltip(tooltip: Tooltip): this;
openTooltip(content: Content, latlng: LatLngExpression, options?: TooltipOptions): this;
closeTooltip(tooltip?: Tooltip): this;
// Methods for modifying map state
setView(center: LatLngExpression, zoom: number, options?: ZoomPanOptions): this;
setZoom(zoom: number, options?: ZoomPanOptions): this;
zoomIn(delta?: number, options?: ZoomOptions): this;
zoomOut(delta?: number, options?: ZoomOptions): this;
setZoomAround(position: Point | LatLngExpression, zoom: number, options?: ZoomOptions): this;
fitBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
fitWorld(options?: FitBoundsOptions): this;
panTo(latlng: LatLngExpression, options?: PanOptions): this;
panBy(offset: PointExpression): this;
setMaxBounds(bounds: LatLngBoundsExpression): this;
setMinZoom(zoom: number): this;
setMaxZoom(zoom: number): this;
panInsideBounds(bounds: LatLngBoundsExpression, options?: PanOptions): this;
/**
* ID of a HTML-Element as string or the HTML-ELement itself
* Boolean for animate or advanced ZoomPanOptions
*/
function map(element: string | HTMLElement, options?: MapOptions): Map;
invalidateSize(options?: boolean | ZoomPanOptions): this;
stop(): this;
flyTo(latlng: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this;
flyToBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
interface BaseIconOptions extends LayerOptions {
iconUrl?: string;
iconRetinaUrl?: string;
iconSize?: PointExpression;
iconAnchor?: PointExpression;
popupAnchor?: PointExpression;
shadowUrl?: string;
shadowRetinaUrl?: string;
shadowSize?: PointExpression;
shadowAnchor?: PointExpression;
className?: string;
}
// Other methods
addHandler(name: string, HandlerClass: () => Handler): this; // HandlerClass is actually a constructor function, is this the right way?
remove(): this;
createPane(name: string, container?: HTMLElement): HTMLElement;
/**
* Name of the pane or the pane as HTML-Element
*/
getPane(pane: string | HTMLElement): HTMLElement | undefined;
getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes;
getContainer(): HTMLElement;
whenReady(fn: () => void, context?: any): this;
interface IconOptions extends BaseIconOptions {
iconUrl: string;
}
// Methods for getting map state
getCenter(): LatLng;
getZoom(): number;
getBounds(): LatLngBounds;
getMinZoom(): number;
getMaxZoom(): number;
getBoundsZoom(bounds: LatLngBoundsExpression, inside?: boolean): number;
getSize(): Point;
getPixelBounds(): Bounds;
getPixelOrigin(): Point;
getPixelWorldBounds(zoom?: number): Bounds;
// This class does not exist in reality, it's just a way to provide
// options of more specific types in the sub classes
class BaseIcon extends Layer {
createIcon(oldIcon?: HTMLElement): HTMLElement;
createShadow(oldIcon?: HTMLElement): HTMLElement;
options: BaseIconOptions;
}
// Conversion methods
getZoomScale(toZoom: number, fromZoom: number): number;
getScaleZoom(scale: number, fromZoom: number): number;
project(latlng: LatLngExpression, zoom: number): Point;
unproject(point: PointExpression, zoom: number): LatLng;
layerPointToLatLng(point: PointExpression): LatLng;
latLngToLayerPoint(latlng: LatLngExpression): Point;
wrapLatLng(latlng: LatLngExpression): LatLng;
wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds;
distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
containerPointToLayerPoint(point: PointExpression): Point;
containerPointToLatLng(point: PointExpression): LatLng;
layerPointToContainerPoint(point: PointExpression): Point;
latLngToContainerPoint(latlng: LatLngExpression): Point;
mouseEventToContainerPoint(ev: MouseEvent): Point;
mouseEventToLayerPoint(ev: MouseEvent): Point;
mouseEventToLatLng(ev: MouseEvent): LatLng;
class Icon extends BaseIcon {
constructor(options: IconOptions);
options: IconOptions;
}
// Geolocation methods
locate(options?: LocateOptions): this;
stopLocate(): this;
namespace Icon {
interface DefaultIconOptions extends BaseIconOptions {
imagePath?: string;
}
// Properties
boxZoom: Handler;
doubleClickZoom: Handler;
dragging: Handler;
keyboard: Handler;
scrollWheelZoom: Handler;
tap?: Handler;
touchZoom: Handler;
class Default extends BaseIcon {
static imagePath?: string;
constructor(options?: DefaultIconOptions);
options: DefaultIconOptions;
}
}
options: MapOptions;
}
function icon(options: IconOptions): Icon;
/**
* ID of a HTML-Element as string or the HTML-ELement itself
*/
export function map(element: string | HTMLElement, options?: MapOptions): Map;
interface DivIconOptions extends BaseIconOptions {
html?: string | false;
bgPos?: PointExpression;
iconSize?: PointExpression;
iconAnchor?: PointExpression;
popupAnchor?: PointExpression;
className?: string;
export interface BaseIconOptions extends LayerOptions {
iconUrl?: string;
iconRetinaUrl?: string;
iconSize?: PointExpression;
iconAnchor?: PointExpression;
popupAnchor?: PointExpression;
shadowUrl?: string;
shadowRetinaUrl?: string;
shadowSize?: PointExpression;
shadowAnchor?: PointExpression;
className?: string;
}
export interface IconOptions extends BaseIconOptions {
iconUrl: string;
}
export class Icon<T extends BaseIconOptions = IconOptions> extends Layer {
constructor(options: T);
createIcon(oldIcon?: HTMLElement): HTMLElement;
createShadow(oldIcon?: HTMLElement): HTMLElement;
options: T;
}
export namespace Icon {
interface DefaultIconOptions extends BaseIconOptions {
imagePath?: string;
}
class DivIcon extends BaseIcon {
constructor(options?: DivIconOptions);
options: DivIconOptions;
class Default extends Icon<DefaultIconOptions> {
static imagePath?: string;
constructor(options?: DefaultIconOptions);
}
}
function divIcon(options?: DivIconOptions): DivIcon;
export function icon(options: IconOptions): Icon;
interface MarkerOptions extends InteractiveLayerOptions {
icon?: Icon | DivIcon;
clickable?: boolean;
draggable?: boolean;
keyboard?: boolean;
title?: string;
alt?: string;
zIndexOffset?: number;
opacity?: number;
riseOnHover?: boolean;
riseOffset?: number;
}
export interface DivIconOptions extends BaseIconOptions {
html?: string | false;
bgPos?: PointExpression;
iconSize?: PointExpression;
iconAnchor?: PointExpression;
popupAnchor?: PointExpression;
className?: string;
}
class Marker extends Layer {
constructor(latlng: LatLngExpression, options?: MarkerOptions);
getLatLng(): LatLng;
setLatLng(latlng: LatLngExpression): this;
setZIndexOffset(offset: number): this;
setIcon(icon: Icon | DivIcon): this;
setOpacity(opacity: number): this;
getElement(): HTMLElement | undefined;
export class DivIcon extends Icon<DivIconOptions> {
constructor(options?: DivIconOptions);
}
// Properties
options: MarkerOptions;
dragging?: Handler;
}
export function divIcon(options?: DivIconOptions): DivIcon;
function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker;
export interface MarkerOptions extends InteractiveLayerOptions {
icon?: Icon | DivIcon;
clickable?: boolean;
draggable?: boolean;
keyboard?: boolean;
title?: string;
alt?: string;
zIndexOffset?: number;
opacity?: number;
riseOnHover?: boolean;
riseOffset?: number;
}
namespace Browser {
const ie: boolean;
const ielt9: boolean;
const edge: boolean;
const webkit: boolean;
const gecko: boolean;
const android: boolean;
const android23: boolean;
const chrome: boolean;
const safari: boolean;
const win: boolean;
const ie3d: boolean;
const webkit3d: boolean;
const gecko3d: boolean;
const opera12: boolean;
const any3d: boolean;
const mobile: boolean;
const mobileWebkit: boolean;
const mobileWebkit3d: boolean;
const mobileOpera: boolean;
const mobileGecko: boolean;
const touch: boolean;
const msPointer: boolean;
const pointer: boolean;
const retina: boolean;
const canvas: boolean;
const vml: boolean;
const svg: boolean;
}
export class Marker extends Layer {
constructor(latlng: LatLngExpression, options?: MarkerOptions);
getLatLng(): LatLng;
setLatLng(latlng: LatLngExpression): this;
setZIndexOffset(offset: number): this;
setIcon(icon: Icon | DivIcon): this;
setOpacity(opacity: number): this;
getElement(): HTMLElement | undefined;
namespace Util {
function extend(dest: any, src?: any): any;
function create(proto: any, properties?: any): any;
function bind(fn: () => void, ...obj: any[]): () => void;
function stamp(obj: any): number;
function throttle(fn: () => void, time: number, context: any): () => void;
function wrapNum(num: number, range: number[], includeMax?: boolean): number;
function falseFn(): false;
function formatNum(num: number, digits?: number): number;
function trim(str: string): string;
function splitWords(str: string): string[];
function setOptions(obj: any, options: any): any;
function getParamString(obj: any, existingUrl?: string, uppercase?: boolean): string;
function template(str: string, data: any): string;
function isArray(obj: any): boolean;
function indexOf(array: any[], el: any): number;
function requestAnimFrame(fn: () => void, context?: any, immediate?: boolean): number;
function cancelAnimFrame(id: number): void;
// Properties
options: MarkerOptions;
dragging?: Handler;
}
let lastId: number;
let emptyImageUrl: string;
}
export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker;
export namespace Browser {
const ie: boolean;
const ielt9: boolean;
const edge: boolean;
const webkit: boolean;
const gecko: boolean;
const android: boolean;
const android23: boolean;
const chrome: boolean;
const safari: boolean;
const win: boolean;
const ie3d: boolean;
const webkit3d: boolean;
const gecko3d: boolean;
const opera12: boolean;
const any3d: boolean;
const mobile: boolean;
const mobileWebkit: boolean;
const mobileWebkit3d: boolean;
const mobileOpera: boolean;
const mobileGecko: boolean;
const touch: boolean;
const msPointer: boolean;
const pointer: boolean;
const retina: boolean;
const canvas: boolean;
const vml: boolean;
const svg: boolean;
}
declare module 'leaflet' {
export = L;
export namespace Util {
function extend(dest: any, src?: any): any;
function create(proto: any, properties?: any): any;
function bind(fn: () => void, ...obj: any[]): () => void;
function stamp(obj: any): number;
function throttle(fn: () => void, time: number, context: any): () => void;
function wrapNum(num: number, range: number[], includeMax?: boolean): number;
function falseFn(): false;
function formatNum(num: number, digits?: number): number;
function trim(str: string): string;
function splitWords(str: string): string[];
function setOptions(obj: any, options: any): any;
function getParamString(obj: any, existingUrl?: string, uppercase?: boolean): string;
function template(str: string, data: any): string;
function isArray(obj: any): boolean;
function indexOf(array: any[], el: any): number;
function requestAnimFrame(fn: () => void, context?: any, immediate?: boolean): number;
function cancelAnimFrame(id: number): void;
let lastId: number;
let emptyImageUrl: string;
}
{
"name": "@types/leaflet",
"version": "1.0.69",
"version": "1.2.0",
"description": "TypeScript definitions for Leaflet.js",

@@ -9,3 +9,4 @@ "license": "MIT",

"name": "Alejandro Sánchez",
"url": "https://github.com/alejo90"
"url": "https://github.com/alejo90",
"githubUsername": "alejo90"
}

@@ -22,4 +23,4 @@ ],

},
"typesPublisherContentHash": "7f98ce4905a6ca88991b36bba14eaba06b691e275c3081a775acf75644360113",
"typeScriptVersion": "2.0"
"typesPublisherContentHash": "f2624f38c8716fc43a6c262fc52ed31449ecda952d58afbf2c3593a423d1216d",
"typeScriptVersion": "2.3"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Wed, 23 Aug 2017 17:50:59 GMT
* Last updated: Tue, 29 Aug 2017 21:31:37 GMT
* Dependencies: geojson

@@ -14,0 +14,0 @@ * Global values: L

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc