Wrld.native.polyline(latLng, options)
Extends: L.Polyline
Note: For most use cases, Wrld.Polyline
should be used instead of this type.
Wrld.native.Polyline creates natively rendered Polylines, which should improve performance. However, it cannot be styled as easily as Wrld.Polyline
.
// Create a polyline in downtown San Francisco.
var polylinePoints = [
[37.781814, -122.40474],
[37.781719, -122.404637],
[37.781489, -122.404949],
[37.780704, -122.403945],
[37.780012, -122.404827],
];
var polyline = Wrld.native.polyline(polylinePoints).addTo(map);
Argument | Type | Description |
---|---|---|
latlngs | Wrld.LatLng[] | Array of geographical points. |
options | object | Accepts all of the options to L.Polyline , plus additional wrld.js entries. |
Options
Options | Type | Default | Description |
---|---|---|---|
elevation | number | 0.0 | Altitude above ground or sea level in meters. |
elevationMode | string | ‘heightAboveGround’ | Whether altitude is measured above ground level (“heightAboveGround”) or sea level (“heightAboveSeaLevel”). |
indoorMapId | string | ’’ | The id of the indoor map with which the Polyline will be associated. |
indoorMapFloorId | number | 0 | The identifier of the indoor map floor on which the Polyline should be displayed. In the WRLD Indoor Map Format, this corresponds to the ‘z_order’ field of the Level object. |
displayOption | string | ‘currentFloor’ | Controls when the Polyline should be displayed in an indoor map. Option ‘currentIndoorMap’ will draw the Polyline in the appropriate indoor map when any floor is selected; ‘currentFloor’ will draw the Polyline only on the specified floor. |
weight | number | 3.0 | Stroke width in pixels. |
miterLimit | number | 10 | Limit on the ratio of the miter length to the polyline weight used to draw a miter join. |
Methods
getElevation()
Returns the elevation in meters.
setElevation(elevation)
Set the elevation in meters.
Argument | Type | Description |
---|---|---|
elevation | number | The elevation in meters. |
getElevationMode()
Returns the elevation mode.
setElevationMode(elevationMode)
Set the elevation mode.
Argument | Type | Description |
---|---|---|
elevationMode | string | Whether altitude is measured above ground level (“heightAboveGround”) or sea level (“heightAboveSeaLevel”). |
getPoints()
Returns Wrld.LatLng[]
with the polyline’s points.
getWidth()
Returns a number
representing the weight of the line.
getColor()
Returns a [number, number, number, number?]
representing the color of the polyline.
getMiterLimit()
Returns a number representing the miter limit.