logo
API Documentation
Tutorials
Getting Started Initialization Layers Third party Controls Geometries Vector styles Measures InfoBox Utils
Releases

Documentation

Modules

  • Constants

Events

  • FEATURE_CLICK
  • FEATURE_HOVER
  • CENTER_DATE_IMAGE
  • CHANGE_MEASURE
  • CLICK
  • COMPLETE_COLLECTIONS
  • FEATURES_CLICK
  • FIND_IMAGES_LOADED
  • FINISH_MEASURE
  • MAP_INITIALIZE
  • MAP_STATUS_EVENT
  • MOVE_END
  • NO_3D_IMAGES
  • POINTER_MOVE
  • START_MEASURE
  • TILES_END_LOAD
  • TILES_START_LOAD
  • FEATURE_CLICK
  • FEATURE_HOVER

General

Classes / Controls

  • Bar
  • Button
  • Swipe
  • Toggle

Classes / Managers

  • CollectionManager
  • OverlayManager

Classes

  • Map

Classes / View

  • MapStatusView

Geometry

Classes

  • Extent
  • Feature
  • Line
  • Location
  • MultiPolygon
  • Point
  • Polygon

Classes / Readers

  • GeoJSON
  • WKT

InfoBox

Classes

  • InfoBox

Layers

Classes

  • ArcGISLayer
  • BingLayer
  • GroupLayer
  • ImageryLayer
  • OSMLayer
  • VectorLayer
  • VectorTileLayer
  • WFSLayer
  • WMSLayer
  • WMTSLayer
  • XYZLayer

Classes / Base Layers

  • BaseLayer
  • BaseVectorLayer

Measurements

Classes / Tools

  • CircleTool
  • HeightTool
  • LineTool
  • PointTool
  • PolygonTool
  • RectangleTool
  • RelativeHeightTool

Classes

  • Measure

Objects

Classes

  • Collection
  • CollectionStatus
  • Image
  • LayerCollections
  • LayerCollectionsStatus
  • MapStatus

Services

Classes

  • UserService

Styles

Classes

  • Circle
  • Fill
  • Icon
  • RegularShape
  • Stroke
  • Style
  • Text

Utils

Classes

  • Transform

Class

Polygon

Polygon(rings)

The polygon class contains logic relating to polygons. A polygon is an area defined by a closed ring of locations. A simple polygon consists of an array of Location objects that form a boundary. This is useful for showing an area of interest on a map.

In some applications there may be a need to for more complex polygons, such as polygons that have a hole in them.

The first array of locations in a polygon represent the main border and is often called the exterior ring. All additional arrays of locations in a polygon are used to represent holes in the main polygon and are often called interior rings.

When creating a polygon at least one array of Location objects must be passed as an argument to the constructor. An array of Location arrays can be passed in when creating complex polygons. Learn more about how to implement polygons in our Polygon tutorial.

Constructor

# new Polygon(rings)

Parameters:
Name Type Description
rings Array.<Array.<Location>>

Array of array locations (rings) Location objects Array of linear rings that define the polygon. The first linear ring of the array defines the outer-boundary or surface of the polygon. Each subsequent linear ring defines a hole in the surface of the polygon. A linear ring is an array of vertices' coordinates where the first coordinate and the last are equivalent.

Tutorials:
  • Polygon
Example

Create simple Polygon

const polygon = new Vexcel.Geometry.Polygon([
[
      new Vexcel.Geometry.Location(32.36140331527543, -84.44091796875),
      new Vexcel.Geometry.Location(32.36140331527543, -82.529296875),
      new Vexcel.Geometry.Location(33.87041555094183, -82.529296875),
      new Vexcel.Geometry.Location(33.87041555094183, -84.44091796875),
      new Vexcel.Geometry.Location(32.36140331527543, -84.44091796875),
  ]
 ]);

Classes

Polygon

Methods

# clone() → (non-null) {Polygon}

Make a complete copy of the polygon.

Clone.

Polygon

# getArea() → {number}

Return the area of the polygon on projected plane.

Area (on projected plane).

number

# getLocations() → {Array.<Array.<Location>>}

Return array of Location

array with location object with latitude and longitude

Array.<Array.<Location>>

# setLocations(rings)

Update polygon rings

Parameters:
Name Type Description
rings Array.<Array.<Location>>

Array of array locations (rings) Location objects Array of linear rings that define the polygon. The first linear ring of the array defines the outer-boundary or surface of the polygon. Each subsequent linear ring defines a hole in the surface of the polygon. A linear ring is an array of vertices' coordinates where the first coordinate and the last are equivalent.

# toGeoJSON() → {string}

Convert geometry to GeoJSON string with xy coordinates [long, lat]

string

# toWKT() → {string}

Convert geometry to WKT string with xy coordinates [long, lat]

string

Documentation generated by Vexcel Imaging