Skip to content
Scott Fairgrieve edited this page Oct 13, 2015 · 5 revisions

L.ArcedPolyline

Draws an arced polyline. Rather than drawing a straight line from latlng1 to latlng2, this class draws an arced line from latlng1 to latlng2. The height of the arc is proportional to the distance between latlng1 and latlng2 and defined by a customizable L.LinearFunction instance. This is useful for illustrating spatial relationships, flight paths, etc.

Usage

L.ArcedPolyline(<LatLng[]> latlngs, <ArcedPolyline options> options?);

var arcedPolyline = new L.ArcedPolyline([...], {
	distanceToHeight: new L.LinearFunction([0, 0], [4000, 400]),
	color: '#FF00000',
	weight: 4
});

map.addLayer(arcedPolyline);

Options (in addition to L.Path style options)

distanceToHeight

Type: L.LinearFunction

Default: new L.LinearFunction([0, 5], [1000, 200])

An L.LinearFunction instance that maps the distance between two points to an arc height in pixels

mode

Type: String

Default: C

Use either 'C' or 'Q' to specify whether to use cubic or quadratic bezier curves for drawing arcs

controlPointOffsets

Type: L.Point

Default: null

Specifies an L.Point with starting and ending offset percents in the range of [0..1]. The percentage relates to percentage distance along the line between latlng1 and latlng2. x is the distance from latlng1 and y is the distance from latlng2. This can be used to adjust where the bezier curve control points are located.