multiPolygon abstract method
Writes a multi polygon with an array of polygons
(each with an array of
rings).
Use the required type
to explicitely specify the type of coordinates.
Each polygon is represented by Iterable<Iterable<double>>
instances
containing one exterior and 0 to N interior rings. The first element is
the exterior ring, and any other rings are interior rings (or holes). All
rings must be closed linear rings. As specified by GeoJSON, they should
"follow the right-hand rule with respect to the area it bounds, i.e.,
exterior rings are counterclockwise, and holes are clockwise".
Each ring in the polygon is represented by Iterable<double>
arrays. Such
arrays contain coordinate values as a flat structure. For example for
Coords.xyz
the first three coordinate values are x, y and z of the first
position, the next three coordinate values are x, y and z of the second
position, and so on.
Use an optional name
to specify a name for a geometry (when applicable).
An optional bounds
can used set a minimum bounding box for a geometry
written. A writer implementation may use it or ignore it. Supported
coordinate value combinations by coordinate type:
Type | Expected values |
---|---|
xy | minX, minY, maxX, maxY |
xyz | minX, minY, minZ, maxX, maxY, maxZ |
xym | minX, minY, minM, maxX, maxY, maxM |
xyzm | minX, minY, minZ, minM, maxX, maxY, maxZ, maxM |
An example to write a multi polygon geometry with two polygons:
content.multiPolygon(
// an array of polygons
[
// an array of linear rings of the first polygon
[
// a linear ring as a flat structure with four (x, y) points
[
10.1, 10.1,
5.0, 9.0,
12.0, 4.0,
10.1, 10.1,
],
],
// an array of linear rings of the second polygon
[
// a linear ring as a flat structure with four (x, y) points
[
110.1, 110.1,
15.0, 19.0,
112.0, 14.0,
110.1, 110.1,
],
],
],
);
Implementation
void multiPolygon(
Iterable<Iterable<Iterable<double>>> polygons, {
required Coords type,
String? name,
Iterable<double>? bounds,
});