polygon abstract method

void polygon(
  1. Iterable<Iterable<double>> rings, {
  2. required Coords type,
  3. String? name,
  4. Iterable<double>? bounds,
})

Writes a polygon geometry with one exterior and 0 to N interior rings.

Use the required type to explicitely specify the type of coordinates.

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.

The rings iterable must be non-empty. 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".

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 polygon geometry with one linear ring containing 4 points:

 content.polygon(
     // an array of linear rings
     [
       // 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,
       ],
     ],
     type: Coords.xy,
 );

Implementation

void polygon(
  Iterable<Iterable<double>> rings, {
  required Coords type,
  String? name,
  Iterable<double>? bounds,
});