Class

mapkit.PolylineOverlay

An overlay made up of connected line segments that do not form a closed shape.

Declaration

interface mapkit.PolylineOverlay

Overview

A polyline is a shape made up of one or more connected line segments defined by a set of points. The first and last points do not connect to each other.

The longitude of all points should be within a 360º degree range. Depending on how you specify the longitude, a line between Tokyo and Los Angeles created with a mapkit.PolylineOverlay may take a different route. Specifying a longitude of -118º for Los Angeles and 140º for Tokyo will result in a very long line spanning 258º. Specifying a longitude of 242º (i.e., -118 + 360) for Los Angeles and 140º for Tokyo will result in a shorter line spanning 98º. If the range of longitudes is larger than 360º, the result of the rendering is undefined.

All style properties apply to polyline overlays except fillColorfillOpacity, and fillRule. Properties that don't apply are ignored. mapkit.PolylineOverlay doesn't implement methods of its own. For more information, see the base object, mapkit.Overlay.

The following example shows a polyline object added to the map.

var points = [ [10, 1], [5, 6], [1, 1] ];
var coords = points.map(function(point) {
    return new mapkit.Coordinate(point[0], point[1]);
});

var style = new mapkit.Style({
    lineWidth: 2,
    lineJoin: "round",
    lineDash: [8, 4],
    strokeColor: "#F0F"
});

var polyline = new mapkit.PolylineOverlay(coords, { style: style });
map.addOverlay(polyline);

Topics

Creating a Polyline Overlay

mapkit.PolylineOverlay

Creates a polyline overlay with coordinate points and style options.

StylesOverlayOptions

An observable set of style attributes for an overlay.

Defining the Polyline

points

An array of coordinate points that define the polyline overlay's shape.

Relationships

Inherits From

See Also

Overlays

mapkit.Overlay

An abstract base object that defines the methods and attributes for map overlays.

mapkit.Style

A set of observable attributes for overlays, including color and opacity of stroke and fill, and line styles.

mapkit.CircleOverlay

A circular overlay with a configurable radius, centered on a specific geographic coordinate.

mapkit.PolygonOverlay

An overlay made up of one or more points, forming a closed shape.

OverlayOptions

A dictionary of options that determine an overlay's data and if it is visible, enabled, and selected.