multiPolygon
Creates a MultiPolygon geometry from an array of polygon coordinates
or an array of Polygons.
Each polygon must consist of an array of linear rings coordinates. The first ring represents the exterior ring (shell), subsequent rings represent interior rings (holes). Each ring must be a closed line string with first and last positions identical and contain at least 3 positions. Empty polygons without any rings are allowed.
Type Parameters
-
P
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
data | Position[][][] | Polygon[] | MultiPolygon coordinates or an array of Polygons | |
options? | object | Optional geometry options | |
options.id? | number | string | Optional identifier to be assigned to the geometry instance. | |
options.properties? | P | Optional data to be assigned to the geometry instance. | |
options.layout? | 'XY' | 'XYZ' | 'XYZM' | 'XYM' | 'XYZM' | Coordinate layout for interpreting GeoJSON coordinates. Defines how to interpret the coordinates of input geometries. This does not force the dimension of the resulting geometries - the actual geometry dimension will be determined from the parsed data. Use this to:
|
options.consume? | boolean | false | Whether to consume the input geometries - consumed geometries become detached, are no longer valid and should not be used. When true the ownership of input geometries is passed to created collection geometry, no extra copies are made, but the input geometries can no longer be used on their own. When false the clones of input geometries are used to create a collection geometry. |
Returns
MultiPolygon<P>
A new MultiPolygon geometry
Throws
InvalidGeoJSONErrorif any ring is invalid (not closed or with 1 or 2 positions)GEOSErrorwhen any of the input geometries is not aPolygon