Skip to content

Modules.Map.Polyline

Represents a bounded area on the map.

The Polyline object gives you low-level control over polylines that can be added to a map view. A polyline must have its points property set to appear on a map.

Use the Modules.Map.createPolyline method to create a polyline.

Example

var polyline = Map.createPolyline({
    points: [{
            latitude: -33.891614,
            longitude: 151.276417
        },
        [-33.87365, 151.20689]
    ],
    strokeWidth: 3,
    strokeColor: '#f00',
    zIndex: 1
});
mapView.addPolyline(polyline);

Extends: Titanium.Proxy · Since: 4.1.0, 4.1.0, 4.1.0, 9.2.0 · Platforms: android, iphone, ipad, macos

Properties #

jointType#

creation only

Type: Number

Defines the shape of corner points.

Defines the shape of corner points. Can be one of the following shapes: Modules.Map.POLYLINE_JOINT_DEFAULT,
Modules.Map.POLYLINE_JOINT_ROUND or Modules.Map.POLYLINE_JOINT_BEVEL

pattern#

Type: Object

Pattern used to draw the polylines.

As per default polylines are drawn with a solid line. You can specify to
draw them with a dashed line using Modules.Map.POLYLINE_PATTERN_DASHED
or with a dotted line using Modules.Map.POLYLINE_PATTERN_DOTTED.

You can also specify the dimensions to use when you create a dashed or
dotted polyline.

For a dashed polyline, you can do something like this:

polyline.setPattern({
    type: TiMap.POLYLINE_PATTERN_DASHED,
    gapLength: 25,
    dashLength: 50
});

or for a dotted polyline, you can do:

polyline.setPattern({
    type: TiMap.POLYLINE_PATTERN_DOTTED,
    gapLength: 25
});

points#

creation only

Type: Array<MapPointType>, String

Array of map points making up the polyline. Can also be an array of longitude (index 0), latitude (index 1) tuples. On Android platform you can use an encoded polyline as string.

strokeColor#

Type: String

Color to use for the the polyline, as a color name or hex triplet.

For information about color values, see the "Colors" section of Titanium.UI.

strokeWidth#

Type: Number

Line width in pixels to use when drawing the polyline.

touchEnabled#

Type: Boolean

Determines whether view should receive touch events.

zIndex#

creation only

Type: Number

The order (depth) in which to display the polylines.

For iOS, the polylines are drawn in the order in which they are added.

Titanium SDK Documentation