wrld.js

L.polygon(latLngs, options)

wrld.js requires that users create instances of L.polygon via the standard Leaflet factory (see creation example below).

// Create a polygon covering downtown San Francisco.
L.polygon([
    [37.786617, -122.404654],
    [37.797843, -122.407057],
    [37.798962, -122.398260],
    [37.794299, -122.395234]
]).addTo(map);
// Create a polygon with holes
var polygonPoints = [
  [[37.786617, -122.404654], //outer ring
  [37.797843, -122.407057],
  [37.798962, -122.398260],
  [37.794299, -122.395234]],

  [[37.795168, -122.402665], //hole
  [37.792300, -122.403781],
  [37.792656, -122.400420]],

  [[37.790979, -122.403028], //another hole
  [37.790404, -122.401272],
  [37.788705, -122.402579],
  [37.789706, -122.403516]]];

var poly = L.polygon(polygonPoints).addTo(map);
Argument Type Description
latLngs number[] An array of points that define the perimeter and optionally holes of the polygon.
options object Accepts all of the options to L.polygon, 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 Polygon will be associated.
indoorMapFloorId number 0 The id of the indoor map floor with which the Polygon will be associated.

Methods

getElevation()

Returns the elevation in meters.

setElevation(elevation)

Set the elevation in meters.

Argument Type Description
elevation number The elevation in meters
v0.1.1335