Class: Rect
- Last UpdatedJul 9, 2025
- 7 minute read
A Rect represents a rectangular geographic area defined by the geographic coordinates of its top-left and bottom-right corners.
Extends
Methods
-
H.geo.Rect.coverLatLngAlts (latLngAltArray, opt_skipValidation)H.geo.Rect | undefined static
-
This method creates the minimum rectangular area covering all of the coordinates in the array provided by the caller.
Name Type Description latLngAltArray
Array.<number> An array of coordinates to cover
opt_skipValidation
boolean optional A Boolean indicating whether to check validity of the arguments (
true
)Returns:
Type Description H.geo.Rect | undefined The smallest rectangle covering the supplied coordinates -
H.geo.Rect.coverPoints (pointArray, opt_skipValidation)H.geo.Rect static
-
This method creates the minimum rectangular area covering all of the points in the array provided by the caller.
Name Type Description pointArray
Array.<!H.geo.IPoint> An array of points to cover
opt_skipValidation
boolean optional A Boolean indicating whether to check validity of the arguments (
true
)Returns:
Type Description H.geo.Rect The minimum rectangle covering the points provided by the caller or null
if the supplied point array was empty -
H.geo.Rect.coverRects (rectList, opt_skipValidation)H.geo.Rect | undefined static
-
This method creates the smallest rectangular area covering all of the rectangular areas in the array provided by the caller.
Name Type Description rectList
Array.<!H.geo.Rect> A list of rectangle objects to cover
opt_skipValidation
boolean optional A Boolean indicating whether to check validity of the arguments (
true
)Returns:
Type Description H.geo.Rect | undefined The smallest rectangle covering the all rectangles in the list provided by the caller -
H.geo.Rect.fromPoints (topLeft, bottomRight, opt_skipValidation)H.geo.Rect static
-
This method creates a rectangular area from a top-left and bottom-right points provided by the caller.
Returns:
Type Description H.geo.Rect An object representing the rectangular area defined by the top-left and bottom-right corners provided by the caller -
H.geo.Rect.merge (topA, leftA, bottomA, rightA, topB, leftB, bottomB, rightB, opt_out)H.geo.Rect static
-
This method merges two rectangle objects defines by their coordinates. The result of the merge is a rectangle that covers the both provided rectangles.
Returns:
Type Description H.geo.Rect Either the rectangle provide by opt_out
or a new rectangle -
clone ()H.geo.Rect
-
This method clones the given rectangle.
Returns:
Type Description H.geo.Rect An object representing a clone of the given rectangle -
This method checks if the latitude and longitude supplied by the caller lie within the area of the given rectangular area.
Returns:
Type Description boolean true
if the latitude and longitude are contained in this area, otherwisefalse
-
This method checks if the point supplied by the caller lies within the area of the given rectangular area.
Name Type Description geoPoint
H.geo.IPoint An object representing the point to check
opt_skipValidation
boolean optional A Boolean indicating whether to check validity of the arguments (
true
)Returns:
Type Description boolean true
if the point is contained in this area, otherwisefalse
-
This method checks if the rectangular area supplied by the caller is completely contained within the given rectangular area.
Name Type Description geoRect
H.geo.Rect An object representing the rectangular area to check
opt_skipValidation
boolean optional A Boolean indicating whether to check validity of the arguments (
true
)Returns:
Type Description boolean true
if the rectangular area is contained in the given area, otherwisefalse
-
Checks whether the geometry is equal to the geometry supplied by the caller. Two geometries are considered as equal if they represent the same geometry type and have equal coordinate values.
Name Type Description other
* The geometry to check against
Returns:
Type Description boolean true
if the two geometries are equal, otherwisefalse
-
getBottom ()H.geo.Latitude
-
This method retrieves the southern-most latitude of the given rectangular area.
Returns:
Type Description H.geo.Latitude A value representing the southern-most latitude of the area -
getBottomRight ()H.geo.Point
-
This method retrieves the bottom-right corner of the given rectangular area.
Returns:
Type Description H.geo.Point An object containing the geographic coordinates of the given rectangle -
getBoundingBox ()H.geo.Rect inherited overrides
-
Returns the bounding rectangle of the geometry.
Returns:
Type Description H.geo.Rect the bounding rectangle of the geometry or null
if the bounding rectangle can't be computed (e.g. for a geometry without coordinates) -
getCenter ()H.geo.Point
-
This method retrieves the center point of the given rectangular area.
Returns:
Type Description H.geo.Point An object representing the center point of the area -
This method retrieves the height of the given rectangular area in decimal degrees.
Returns:
Type Description number A value representing the height of this area -
getLeft ()H.geo.Longitude
-
This method retrieves the left-most longitude of the given rectangular area.
Returns:
Type Description H.geo.Longitude A value representing the left-most longitude of the area -
getRight ()H.geo.Longitude
-
This method retrieves the right-most longitude of the given rectangular area.
Returns:
Type Description H.geo.Longitude A value representing the right-most longitude of the area -
getTop ()H.geo.Latitude
-
This method retrieves the north-most latitude of the given rectangular area.
Returns:
Type Description H.geo.Latitude A value representing the northern-most latitude of the rectangle -
getTopLeft ()H.geo.Point
-
This method retrieves the top-left corner of the given rectangular area.
Returns:
Type Description H.geo.Point An object containing the geographic coordinates of the the top-left corner of the given rectangle -
This method retrieves the width of the given rectangular area in decimal degrees.
Returns:
Type Description number A value representing the width of this area -
This method checks if the intersection of two bounding boxes is non-empty.
Name Type Description geoRect
H.geo.Rect An object representing a rectangle object to test for intersection with the given rectangle
opt_skipValidation
boolean optional A Boolean indicating whether to check validity of the arguments (
true
)Returns:
Type Description boolean A Boolean value indicating if the two bounding boxes intersect ( true
) or not (false
) -
This method checks if the given rectangular area spans the date border.
Returns:
Type Description boolean true
if the area spans the date border, otherwisefalse
-
The method checks if the area enclosed by the given bounding box is 0.
Returns:
Type Description boolean true
if the dimensions of the area are 0, otherwisefalse
-
mergeLatLng (lat, lng, opt_skipValidation, opt_out)H.geo.Rect
-
This method retrieves the smallest bounding box that covers the given rectangular area and the latitude and longitude supplied by the caller.
Returns:
Type Description H.geo.Rect Either the rectangle object provided as the out parameter or a new rectangle object -
mergePoint (geoPoint, opt_skipValidation, opt_out)H.geo.Rect
-
This method retrieves the smallest bounding box that covers the given rectangular area and the point supplied by the caller.
Returns:
Type Description H.geo.Rect Either the rectangle received as the out parameter or a new rectangle object -
mergeRect (geoRect, opt_skipValidation, opt_out)H.geo.Rect
-
This method retrieves the smallest bounding box that covers the given rectangle area and the rectangle supplied by the caller.
Returns:
Type Description H.geo.Rect Either the rectangular area received as the out parameter or a new rectangle object -
mergeTopLeftBottomRight (top, left, bottom, right, opt_skipValidation, opt_out)H.geo.Rect
-
This method retrieves the smallest bounding box that covers the given rectangle area and the rectangle supplied by the caller as a set of coordinates.
Returns:
Type Description H.geo.Rect Either the rectangle received as the out parameter or a new rectangle object -
resizeToCenter (center, opt_out)H.geo.Rect
-
This method clones the given bounding rectangle and resizes the clone if necessary until the location supplied by the caller is at its center.
Name Type Description center
H.geo.IPoint A point object which is to be the center of the resized rectangular area
opt_out
H.geo.Rect optional An optional rectangle object to store the result
Returns:
Type Description H.geo.Rect An object representing the resulting rectangle -
toGeoJSON ()Object inherited
-
To obtain a GeoJSON representation of the given geometry.
Returns:
Type Description Object A GeoJSON Geometry object representing the given geometry. -
toString () inherited
-
To obtain a Well-Known-Text (WKT) representation of the geometry.