`Abstract`

- Shape
- Polygon

`Abstract`

bounds`Abstract`

coordinate- get coordinateType(): CoordinateType
The coordinate type this shape. This property is read only. An Error will be thrown when trying to assign to this property.

#### Returns CoordinateType

- get focusPoint(): Point
The focus point of this shape. This property is read only. An error will be thrown when trying to assign to this property. This property contains an object but should be treated with value semantics: changes to the shape will not be reflected in the focusPoint that was retrieved from this Polygon before the modification.

#### Returns Point

- get pointCount(): number
The number of points in the polygon

#### Returns number

- get reference(): null | CoordinateReference
The spatial reference of this shape. This property is read only. An Error will be thrown when trying to assign to this property.

#### Returns null | CoordinateReference

- contains2D(x, y?): boolean
Determines whether a given point is inside this shape. This method checks containment only in two dimensions: on the (x,y)-axis or the (lon,lat)-axis (depending on the spatial reference of the shape).

#### Parameters

#### Returns boolean

`true`

when the given point is contained in this shape

`Abstract`

contains2DCoordinates- contains2DCoordinates(x, y): boolean
Determines whether the given point is inside this shape. This method checks containment only in two dimensions: on the (x,y)-axis or the (lon,lat)-axis (depending on the spatial reference of the shape).

#### Parameters

- x: number
The x coordinate of the point for which containment must be checked

- y: number
The y coordinate of the point for which containment must be checked

#### Returns boolean

`true`

when the given point is contained in this shape#### Throws

Point with another spatial reference

- x: number

- contains2DPoint(point): boolean
Determines whether the given point is inside this shape. This method checks containment only in two dimensions: on the (x,y)-axis or the (lon,lat)-axis (depending on the spatial reference of the shape).

#### Parameters

- point: Point
The point for which containment must be checked.

#### Returns boolean

`true`

when the given point is contained in this shape#### Throws

Point with another spatial reference

- point: Point

`Abstract`

copy- equals(otherPolygon): boolean
Indicates whether this shape is equal to another.

#### Parameters

- otherPolygon: Shape
the other shape this shape is compared with.

#### Returns boolean

`true`

if both shapes are equal,`false`

otherwise.- otherPolygon: Shape

- get
Point (index): Point Returns the point of the polygon at the given index. Any subsequent mutation on the point affects the polygon shape. Note: A new Point is returned on each function invocation that shares the same point representation of the polygon.

`const pA = polygon.getPoint(0)`

const pB = polygon.getPoint(0)

console.log(pA === pB) // false

pA.x = 100;

console.log(pA.x, pB.x, polygon.getPoint(0).x) // 100, 100, 100#### Parameters

- index: number
The index of the point to be returned.

#### Returns Point

the point at the given index

- index: number

- insert
Point (index, point): void Inserts a Point at a given position in this Polygon. The point must be defined in the same spatial reference as the polygon, otherwise an exception will be thrown.

#### Parameters

- index: number
The index at which the point must be inserted

- point: Point
The point to be inserted

#### Returns void

#### Throws

InvalidReferenceError When the point's spatial reference does not correspond with the polygon's spatial reference.

#### Throws

ProgrammingError When the index is invalid (i.e. smaller than zero or larger than the amount of points in the polygon.

- index: number

- move2DPoint(index, x, y): void
Moves the x and y coordinates of the point at the given index to the given coordinates. The z value remains unchanged.

#### Parameters

- index: number
The index of the point that must be removed.

- x: number
x coordinate value

- y: number
y coordinate value

#### Returns void

#### Throws

ProgrammingError When the index is invalid (i.e. smaller than zero or larger than the index of the last point in the polygon

- index: number

- move3DPoint(index, x, y, z): void
Moves the point at the given index to the given coordinates.

#### Parameters

- index: number
The index of the point that must be removed.

- x: number
x coordinate value

- y: number
y coordinate value

- z: number
z coordinate value

#### Returns void

#### Throws

ProgrammingError When the index is invalid (i.e. smaller than zero or larger than the index of the last point in the polygon

- index: number

- remove
Point (index): void Removes a point at a given position in this Polygon. This method does not guarantee that the polygon remains valid, i.e. the polygon must at least have 3 points. Validity of the polygon can be checked with Polygon.isValid.

#### Parameters

- index: number
The index of the point that must be removed.

#### Returns void

#### Throws

ProgrammingError When the index is invalid (i.e. smaller than zero or larger than the index of the last point in the polygon

- index: number

- translate
Point (index, x, y, z?): void Translates the point at the given index over the given vector in 2D or 3D space. A point is only translated in 3D space the z parameter is specified.

#### Parameters

- index: number
The index of the point that must be removed.

- x: number
x coordinate value

- y: number
y coordinate value

`Optional`

z: numberz coordinate value

#### Returns void

#### Throws

- index: number

A polygon is a shape that represents a closed polygon without holes. A polygon always is defined in a particular geographical reference (Geodetic reference or Grid Reference). A Polygon cannot be instantiated directly. It must be instantiated using createPolygon.