getRectangleBounds method

List<LatLng> getRectangleBounds(
  1. List<LatLng> polygonCoords
)

Calculate the bounds of a rectangle that encloses a polygon defined by a list of polygonCoords points.

Given a list of polygonCoords representing the vertices of a polygon, this function calculates and returns the bounds of the smallest rectangle that encloses the polygon as a list of two LatLng points: the top-left and bottom-right corners of the rectangle.

Implementation

List<LatLng> getRectangleBounds(List<LatLng> polygonCoords) {
  return RectangleBounds.getRectangleBounds(polygonCoords);
}