Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Polyline

Hierarchy

Implements

Index

Constructors

constructor

  • Instantiates a polyline object given an array of geographical points and optionally an options object.

    Parameters

    Returns Polyline

Properties

editing

editing: any

options

options: any

Static CANVAS

CANVAS: boolean

True if Canvas is used for vector rendering (Android 2). You can also force this by setting global variable L_PREFER_CANVAS to true before the Leaflet include on your page — sometimes it can increase performance dramatically when rendering thousands of circle markers, but currently suffers from a bug that causes removing such layers to be extremely slow.

Static CLIP_PADDING

CLIP_PADDING: number

How much to extend the clip area around the map view (relative to its size, e.g. 0.5 is half the screen in each direction). Smaller values mean that you will see clipped ends of paths while you're dragging the map, and bigger values decrease drawing performance.

Static SVG

SVG: boolean

True if SVG is used for vector rendering (true for most modern browsers).

Static VML

VML: boolean

True if VML is used for vector rendering (IE 6-8).

Methods

addEventListener

  • addEventListener(type: string, fn: function, context?: any): Path
  • addEventListener(eventMap: any, context?: any): Path

addLatLng

  • Adds a given point to the polyline.

    Parameters

    Returns Polyline

addOneTimeEventListener

  • addOneTimeEventListener(type: string, fn: function, context?: any): Path

addTo

  • Adds the layer to the map.

    Parameters

    Returns Path

bindPopup

  • Binds a popup with a particular HTML content to a click on this path.

    Parameters

    Returns Path

  • Binds a popup with a particular HTML content to a click on this path.

    Parameters

    Returns Path

  • Binds a popup with a particular HTML content to a click on this path.

    Parameters

    Returns Path

bringToBack

  • bringToBack(): Path
  • Brings the layer to the bottom of all path layers.

    Returns Path

bringToFront

  • bringToFront(): Path
  • Brings the layer to the top of all path layers.

    Returns Path

clearAllEventListeners

  • clearAllEventListeners(): Path

closePopup

  • closePopup(): Path
  • Closes the path's bound popup if it is opened.

    Returns Path

fire

  • fire(type: string, data?: any): Path
  • Parameters

    • type: string
    • Optional data: any

    Returns Path

fireEvent

  • fireEvent(type: string, data?: any): Path

getBounds

  • Returns the LatLngBounds of the polyline.

    Returns LatLngBounds

getLatLngs

  • Returns an array of the points in the path.

    Returns LatLng[]

hasEventListeners

  • hasEventListeners(type: string): boolean

off

  • off(type: string, fn?: function, context?: any): Path
  • off(eventMap?: any, context?: any): Path
  • Parameters

    • type: string
    • Optional fn: function
    • Optional context: any

    Returns Path

  • Parameters

    • Optional eventMap: any
    • Optional context: any

    Returns Path

on

  • on(type: string, fn: function, context?: any): Path
  • on(eventMap: any, context?: any): Path
  • Parameters

    Returns Path

  • Parameters

    • eventMap: any
    • Optional context: any

    Returns Path

onAdd

  • onAdd(map: Map): void
  • Should contain code that creates DOM elements for the overlay, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).

    Parameters

    Returns void

onRemove

  • onRemove(map: Map): void
  • Should contain all clean up code that removes the overlay's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).

    Parameters

    Returns void

once

  • once(type: string, fn: function, context?: any): Path
  • Parameters

    Returns Path

openPopup

  • Opens the popup previously bound by the bindPopup method in the given point, or in one of the path's points if not specified.

    Parameters

    Returns Path

redraw

  • Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.

    Returns Path

removeEventListener

  • removeEventListener(type: string, fn?: function, context?: any): Path
  • removeEventListener(eventMap?: any, context?: any): Path

setLatLngs

  • Replaces all the points in the polyline with the given array of geographical points.

    Parameters

    Returns Polyline

setStyle

  • Changes the appearance of a Path based on the options in the Path options object.

    Parameters

    Returns Path

spliceLatLngs

  • spliceLatLngs(index: number, pointsToRemove: number, ...latlngs: LatLng[]): LatLng[]
  • Allows adding, removing or replacing points in the polyline. Syntax is the same as in Array#splice. Returns the array of removed points (if any).

    Parameters

    • index: number
    • pointsToRemove: number
    • Rest ...latlngs: LatLng[]

    Returns LatLng[]

toGeoJSON

  • toGeoJSON(): any
  • Returns a GeoJSON representation of the polyline (GeoJSON LineString Feature).

    Returns any

unbindPopup

  • unbindPopup(): Path
  • Unbinds the popup previously bound to the path with bindPopup.

    Returns Path

Static addInitHook

  • addInitHook(methodName: string, ...args: any[]): void
  • You can also use the following shortcut when you just need to make one additional method call.

    Parameters

    • methodName: string
    • Rest ...args: any[]

    Returns void

Static extend

  • You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it.

    Parameters

    Returns any