HERE Android SDK Developer's Guide

GeoBoundingBox

The class GeoBoundingBox is a member of com.here.android.mpa.common .

Class Summary

public final class GeoBoundingBox

extends java.lang.Object

Represents a rectangular area in a geographic coordinate system.

[For complete information, see the section Class Details]

Constructor Summary

Table 1. Constructors in GeoBoundingBox
Constructors

GeoBoundingBox (GeoCoordinate topLeft, GeoCoordinate bottomRight)

Creates a GeoBoundingBox with specified top-left and bottom-right coordinates.

GeoBoundingBox (GeoCoordinate center, float height, float width)

Creates a GeoBoundingBox with a specified center and width and height in distance.

Method Summary

Table 2. Methods in GeoBoundingBox
Methods

public boolean contains (GeoBoundingBox bbox)

Determines whether the specified GeoBoundingBox is covered entirely by this GeoBoundingBox .

public boolean contains (GeoCoordinate coord)

Determines whether the specified GeoCoordinate is contained within this GeoBoundingBox.

public boolean equals (Object other)

For documentation, see java.lang.Object

public void expand (float latitudeMeters, float longitudeMeters)

Expands the GeoBoundingBox by a fixed distance.

public GeoCoordinate getBottomRight ()

Gets the current bottom-right coordinate of the GeoBoundingBox.

public static GeoBoundingBox getBoundingBoxContainingGeoCoordinates (java.util.List <GeoCoordinate> coordinates)

Constructs a GeoBoundingBox which contains all coordinates in an array.

public GeoCoordinate getCenter ()

Gets the center GeoCoordinate of the GeoBoundingBox.

public double getHeight ()

Gets the current GeoBoundingBox height, in degrees.

public GeoCoordinate getTopLeft ()

Gets the current top-left coordinate of the GeoBoundingBox.

public double getWidth ()

Gets the current GeoBoundingBox width, in degrees.

public int hashCode ()

For documentation, see java.lang.Object

public boolean intersects (GeoBoundingBox bbox)

Determines whether the intersection of this GeoBoundingBox instance and the specified GeoBoundingBox is non-empty.

public boolean isEmpty ()

Determines whether the size of the enclosed GeoBoundingBox area is 0.

public GeoBoundingBox merge (GeoBoundingBox bbox)

Merges two GeoBoundingBox objects by returning the smallest GeoBoundingBox covering both this GeoBoundingBox and the specified GeoBoundingBox .

public static GeoBoundingBox mergeBoxes (java.util.List <GeoBoundingBox> bboxes)

Merges multiple GeoBoundingBox objects by returning the smallest GeoBoundingBox covering all specified GeoBoundingBox objects.

public void resizeToCenter (GeoCoordinate coord)

Increases the size of the GeoBoundingBox until the specified GeoCoordinate is located at the center.

public boolean setBottomRight (GeoCoordinate bottomRight)

Sets a bottom-right coordinate for the GeoBoundingBox.

public boolean setCoordinates (GeoCoordinate topLeft, GeoCoordinate bottomRight)

Sets coordinates for the GeoBoundingBox.

public boolean setTopLeft (GeoCoordinate topLeft)

Sets a top-left coordinate for the GeoBoundingBox.

public String toString ()

For documentation, see java.lang.Object

Class Details

Represents a rectangular area in a geographic coordinate system.

Although a bounding box is specified by its top-left and bottom-right corner, the box is not necessarily the smallest rectangle spanned by these two points. It is possible to define geobounding boxes that are wider than 180 degrees or higher then 90 degrees (e.g. by setting the longitude of the top-left corner to a bigger value than the longitude of the bottom-right corner). Please note the top-left corner's latitude must be greater than or equal to bottom-right corner's latitude. Otherwise, the bounding box will be in invalid state.

For example, a geobounding box with longitude of -180 degrees for the top-left corner and a longitude of 180 degrees for the bottom-right corner will construct an area that encircles the globe, whereas a geobounding box with the same longitude value for both corners will construct an area with a width of 0 degrees.

Constructor Details

GeoBoundingBox (GeoCoordinate topLeft, GeoCoordinate bottomRight)

Creates a GeoBoundingBox with specified top-left and bottom-right coordinates.

Parameters:

  • topLeft

    A GeoCoordinate representing the top-left corner of the bounding box

  • bottomRight

    A GeoCoordinate representing the bottom-right corner of the bounding box

Throws:

  • IllegalArgumentException

    if the arguments will construct an invalid GeoBoundingBox.

GeoBoundingBox (GeoCoordinate center, float height, float width)

Creates a GeoBoundingBox with a specified center and width and height in distance.

Parameters:

  • center

    A GeoCoordinate representing the geographical center of the bounding box.

  • height

    The geographical height in meters

  • width

    The geographical width in meters

Method Details

public boolean contains (GeoBoundingBox bbox)

Determines whether the specified GeoBoundingBox is covered entirely by this GeoBoundingBox .

Parameters:

  • bbox

    A GeoBoundingBox to check for containment within this GeoBoundingBox

Returns:

True if covered by the GeoBoundingBox, false otherwise

See also:

contains(GeoCoordinate)

public boolean contains (GeoCoordinate coord)

Determines whether the specified GeoCoordinate is contained within this GeoBoundingBox.

Parameters:

  • coord

    A GeoCoordinate to check for containment within this GeoBoundingBox

Returns:

True if contained within the GeoBoundingBox, false otherwise

See also:

contains(GeoBoundingBox)

public boolean equals (Object other)

For documentation, see java.lang.Object

Parameters:

  • other

public void expand (float latitudeMeters, float longitudeMeters)

Expands the GeoBoundingBox by a fixed distance.

Parameters:

  • latitudeMeters

    The geographical height in meters to expand the GeoBoundingBox

  • longitudeMeters

    The geographical width in meters to expand the GeoBoundingBox

public GeoCoordinate getBottomRight ()

Gets the current bottom-right coordinate of the GeoBoundingBox.

Returns:

The current bottom-right GeoCoordinate

public static GeoBoundingBox getBoundingBoxContainingGeoCoordinates (java.util.List <GeoCoordinate> coordinates)

Constructs a GeoBoundingBox which contains all coordinates in an array.

The constructed GeoBoundingBox will be the smallest possible box which contains all the GeoCoordinate in the input array.

Parameters:

  • coordinates

    An array of GeoCoordinate defining the new GeoBoundingBox

Returns:

The GeoBoundingBox

public GeoCoordinate getCenter ()

Gets the center GeoCoordinate of the GeoBoundingBox.

Returns:

The center coordinate of the GeoBoundingBox

public double getHeight ()

Gets the current GeoBoundingBox height, in degrees.

Returns:

The current height

public GeoCoordinate getTopLeft ()

Gets the current top-left coordinate of the GeoBoundingBox.

Returns:

The current top-left GeoCoordinate

public double getWidth ()

Gets the current GeoBoundingBox width, in degrees.

Returns:

The current width

public int hashCode ()

For documentation, see java.lang.Object

public boolean intersects (GeoBoundingBox bbox)

Determines whether the intersection of this GeoBoundingBox instance and the specified GeoBoundingBox is non-empty.

Parameters:

  • bbox

    A GeoBoundingBox to check for intersection with this GeoBoundingBox

Returns:

True if the intersection of GeoBoundingBox objects is non-empty, false otherwise

public boolean isEmpty ()

Determines whether the size of the enclosed GeoBoundingBox area is 0.

Returns:

True if the size of the enclosed area is 0, false otherwise

public GeoBoundingBox merge (GeoBoundingBox bbox)

Merges two GeoBoundingBox objects by returning the smallest GeoBoundingBox covering both this GeoBoundingBox and the specified GeoBoundingBox .

Parameters:

  • bbox

    A GeoBoundingBox to merge with this GeoBoundingBox

Returns:

The smallest GeoBoundingBox that covers both of the merged GeoBoundingBox objects

See also:

mergeBoxes(List<GeoBoundingBox>)

public static GeoBoundingBox mergeBoxes (java.util.List <GeoBoundingBox> bboxes)

Merges multiple GeoBoundingBox objects by returning the smallest GeoBoundingBox covering all specified GeoBoundingBox objects.

Parameters:

  • bboxes

    A list of GeoBoundingBox objects to merge

Returns:

The smallest GeoBoundingBox that covers all of the merged GeoBoundingBox objects

See also:

merge(GeoBoundingBox)

public void resizeToCenter (GeoCoordinate coord)

Increases the size of the GeoBoundingBox until the specified GeoCoordinate is located at the center.

Parameters:

  • coord

    A GeoCoordinate that will become the center of the resized GeoBoundingBox

public boolean setBottomRight (GeoCoordinate bottomRight)

Sets a bottom-right coordinate for the GeoBoundingBox.

Parameters:

  • bottomRight

    A GeoCoordinate representing the desired bottom-right coordinate

Returns:

True if setBottomRight complete successfully.

public boolean setCoordinates (GeoCoordinate topLeft, GeoCoordinate bottomRight)

Sets coordinates for the GeoBoundingBox.

Parameters:

  • topLeft

    A GeoCoordinate representing the desired top-left coordinate

  • bottomRight

    A GeoCoordinate representing the desired bottom-right coordinate

Returns:

True if setCoordinates complete successfully.

public boolean setTopLeft (GeoCoordinate topLeft)

Sets a top-left coordinate for the GeoBoundingBox.

Parameters:

  • topLeft

    A GeoCoordinate representing the desired top-left coordinate

Returns:

True if setTopLeft complete successfully.

public String toString ()

For documentation, see java.lang.Object

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.