toPolygon method

Polygon toPolygon()

Return a Polygon representing the BoundingBox.

Example:

BoundingBox(1, 2, 3, 4).toPolygon(); // POLYGON((1 2, 3 2, 3 4, 1 4, 1 2))

Implementation

Polygon toPolygon() {
  return Polygon([
    LinearRing([
      Coordinate(minLong, minLat),
      Coordinate(maxLong, minLat),
      Coordinate(maxLong, maxLat),
      Coordinate(minLong, maxLat),
      Coordinate(minLong, minLat),
    ])
  ]);
}