Polygon
A Polygon geometry is conceptually a collection of Ring
s that form a single connected geometry.
-
The positions at which the polygon is located. Each nested array corresponds to one linear ring.
-
-
Initializes a polygon defined by the given positions.
This initializer is equivalent to the
polygon
function in the turf-helpers package of Turf.js (source code). -
Initializes a polygon defined by the given linear rings.
-
Initializes a polygon as a given center coordinate with a given number of vertices, as a means to approximate a circle.
This initializer is equivalent to the turf-circle package of Turf.js (source code).
-
-
-
Representation of
Polygon
s coordinates of inner rings -
Representation of
Polygon
s coordinates of outer ring -
The polygon’s area.
This property is equivalent to the turf-area package of Turf.js (source code).
-
Returns whether the given coordinate falls within the polygon and outside of its interior rings.
This method is equivalent to the turf-boolean-point-in-polygon package of Turf.js (source code).
-
Returns the polygon with corners smoothed out using Chaikin’s algorithm.
This method is equivalent to the turf-polygon-smooth package of Turf.js (source code).
Note
The returned polygon may be a degenerate polygon. -
Returns a copy of the polygon simplified using the Ramer–Douglas–Peucker algorithm.
This method is equivalent to the turf-simplify package of Turf.js (source code).
-
Simplifies the polygon in place using the Ramer–Douglas–Peucker algorithm.
This method is nearly equivalent to the turf-simplify package of Turf.js (source code), except that it mutates the polygon it is called on.
-
Calculates the absolute center of the bounding box.
This property is equivalent to the turf-center package of Turf.js (source code).
-
Calculates the centroid using the mean of all vertices.
Compared to
center
andcenterOfMass
, the centroid is less affected by small islands and artifacts.This property is equivalent to the turf-centroid package of Turf.js (source code).
-
Calculates the center of mass using the centroid of polygon formula.
This property is equivalent to the turf-center-of-mass package of Turf.js (source code).
-