Class GeoBox

java.lang.Object
com.here.sdk.core.GeoBox

public final class GeoBox extends Object

Represents a bounding rectangle aligned with latitude and longitude. Geographic area represented by this would be visualised as a rectangle when using a normal cylindrical projection (such as Mercator). The box has a maximum span of 360 degrees in longitude and 180 degrees in latitude direction. The box with equal values in longitude for the corners is considered as a span of 360 degrees. The box is considered empty if the latitude of the southWestCorner is larger than the the latitude of the northEastCorner.

  • Field Details

    • southWestCorner

      @NonNull public final GeoCoordinates southWestCorner

      South west corner coordinates.

    • northEastCorner

      @NonNull public final GeoCoordinates northEastCorner

      North east corner coordinates.

  • Constructor Details

    • GeoBox

      public GeoBox(@NonNull GeoCoordinates southWestCorner, @NonNull GeoCoordinates northEastCorner)

      Creates a new instance.

      Parameters:
      southWestCorner -

      South west corner coordinates.

      northEastCorner -

      North east corner coordinates.

  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • containing

      @Nullable public static GeoBox containing(@NonNull List<GeoCoordinates> geoCoordinates)

      Creates a GeoBox which encompases all coordinates from the list. The provided list must contain at least two points. The altitude values of the input coordinates are not considered for the result.

      Parameters:
      geoCoordinates -

      List of coordinates to encompass inside bounding box.

      Returns:

      GeoBox containing all supplied coordinates, or null if less than two coordinates were provided.

    • envelope

      @NonNull public GeoBox envelope(@NonNull GeoBox geoBox)

      Envelopes two GeoBox areas by returning the smallest GeoBox covering both this GeoBox and the specified GeoBox.

      Parameters:
      geoBox -

      Another GeoBox to envelope with.

      Returns:

      GeoBox covering twoGeoBox areas

    • envelopeGeoBoxes

      @Nullable public static GeoBox envelopeGeoBoxes(@NonNull List<GeoBox> geoBoxes)

      Envelopes the list of GeoBox areas by returning the smallest GeoBox covering all specified GeoBox objects.

      Parameters:
      geoBoxes -

      List of GeoBox objects.

      Returns:

      GeoBox covering all GeoBox areas, or null if input is empty.

    • intersects

      public boolean intersects(@NonNull GeoBox geoBox)

      Determines whether this GeoBox intersects with the passed GeoBox. The altitude values are ignored.

      Parameters:
      geoBox -

      A GeoBox to check for intersection.

      Returns:

      true if intersects with the GeoBox, false otherwise.

    • intersection

      @NonNull public List<GeoBox> intersection(@NonNull GeoBox geoBox)

      Computes the intersection with the passed GeoBox. The altitude values are ignored. Limitation: Geo boxes are considered as non-intersecting if they overlap only on a single point, horizontal line or vertical line.

      Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

      Parameters:
      geoBox -

      Another geo box to check intersection with.

      Returns:

      It will be empty if there is no overlap. Otherwise, 1 or more geo boxes covering common area by this and passed GeoBox.

    • intersection

      @NonNull public static List<GeoBox> intersection(@NonNull List<GeoBox> geoBoxes)

      Computes intersection of list of GeoBox instances. The altitude values are ignored. Limitation: Geo boxes are considered as non-intersecting if they overlap only on a single point, horizontal line or vertical line.

      Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

      Parameters:
      geoBoxes -

      List of GeoBox instances.

      Returns:

      It will be empty if there is no overlap between all the passed GeoBox instances. Otherwise, 1 or more geo boxes covering common area by all the passed GeoBox instances.

    • contains

      public boolean contains(@NonNull GeoBox geoBox)

      Determines whether the specified GeoBox is covered entirely by this GeoBox. The altitude values are ignored.

      Parameters:
      geoBox -

      A GeoBox to check for containment within this GeoBox.

      Returns:

      true if covered by the GeoBox, false otherwise.

    • contains

      public boolean contains(@NonNull GeoCoordinates geoCoordinates)

      Determines whether the specified GeoCoordinates is contained within this GeoBox. The altitude values are ignored.

      Parameters:
      geoCoordinates -

      A GeoCoordinates to check for containment within this GeoBox.

      Returns:

      true if contained within the GeoBox, false otherwise.

    • expandedBy

      @NonNull public GeoBox expandedBy(double southMeters, double westMeters, double northMeters, double eastMeters) throws InstantiationErrorException

      Creates a GeoBox which is expanded by a fixed distance. Throws an InstantiationError if it is not possible to create a valid GeoBox with the given arguments.

      Parameters:
      southMeters -

      Distance in the south direction in meters to expand the GeoBox.

      westMeters -

      Distance in the west direction in meters to expand the GeoBox.

      northMeters -

      Distance in the north direction in meters to expand the GeoBox.

      eastMeters -

      Distance in the east direction in meters to expand the GeoBox.

      Returns:

      The expanded GeoBox.

      Throws:
      InstantiationErrorException -

      Instantiation error.