eegeo.js

L.eeGeo.polygon(latLngs, options)

// Create a polygon covering downtown San Francisco.
L.eeGeo.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.eeGeo.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.

Options

Options Type Default Description
color number[] [0,0,1,0.5] The color of the polygon as an array [R,G,B,A], with values between 0.0 and 1.0
altitudeOffset number 0.0 Altitude above sea level or terrain of the polygon
offsetFromSeaLevel boolean false Whether altitude is measured above sea level or about the terrain.

Methods

polygon.getColor()

Get the color of the polygon.

polygon.setColor(color)

Set the color of the polygon.

Argument Type Description
color number[] The color of the polygon as an array [R,G,B,A], with values between 0.0 and 1.0

polygon.getPoints()

Get the points that define the perimeter of the polygon.

polygon.addHole(points)

Add an interior ring to the polygon.

Argument Type Description
points number[] An array of points that define the perimeter of the hole.

polygon.getHoles()

Gets an array of the holes in this polygon. Empty array returned if no holes in polygon.

v0.1.1099