GeoBox (API Reference)
Class GeoBox
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 Summary
FieldsModifier and TypeFieldDescriptionfinal GeoCoordinatesNorth east corner coordinates.final GeoCoordinatesSouth west corner coordinates. -
Constructor Summary
ConstructorsConstructorDescriptionGeoBox(GeoCoordinates southWestCorner, GeoCoordinates northEastCorner) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic GeoBoxcontaining(List<GeoCoordinates> geoCoordinates) Creates aGeoBoxwhich encompases all coordinates from the list.booleanDetermines whether the specifiedGeoBoxis covered entirely by thisGeoBox.booleancontains(GeoCoordinates geoCoordinates) Determines whether the specified GeoCoordinates is contained within thisGeoBox.Envelopes twoGeoBoxareas by returning the smallestGeoBoxcovering both this GeoBox and the specifiedGeoBox.static GeoBoxenvelopeGeoBoxes(List<GeoBox> geoBoxes) Envelopes the list ofGeoBoxareas by returning the smallestGeoBoxcovering all specifiedGeoBoxobjects.booleanexpandedBy(double southMeters, double westMeters, double northMeters, double eastMeters) Creates aGeoBoxwhich is expanded by a fixed distance.inthashCode()intersection(GeoBox geoBox) Computes the intersection with the passedGeoBox.intersection(List<GeoBox> geoBoxes) Computes intersection of list ofGeoBoxinstances.booleanintersects(GeoBox geoBox) Determines whether thisGeoBoxintersects with the passedGeoBox.
-
Field Details
-
southWestCorner
South west corner coordinates.
-
northEastCorner
North east corner coordinates.
-
-
Constructor Details
-
GeoBox
Creates a new instance.
- Parameters:
southWestCorner-South west corner coordinates.
northEastCorner-North east corner coordinates.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
containing
Creates a
GeoBoxwhich 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:
GeoBoxcontaining all supplied coordinates, ornullif less than two coordinates were provided.
-
envelope
Envelopes two
GeoBoxareas by returning the smallestGeoBoxcovering both this GeoBox and the specifiedGeoBox.- Parameters:
geoBox-Another
GeoBoxto envelope with.- Returns:
GeoBoxcovering twoGeoBoxareas
-
envelopeGeoBoxes
Envelopes the list of
GeoBoxareas by returning the smallestGeoBoxcovering all specifiedGeoBoxobjects.- Parameters:
geoBoxes-List of
GeoBoxobjects.- Returns:
GeoBoxcovering allGeoBoxareas, ornullif input is empty.
-
intersects
Determines whether this
GeoBoxintersects with the passedGeoBox. The altitude values are ignored.- Parameters:
geoBox-A
GeoBoxto check for intersection.- Returns:
trueif intersects with theGeoBox,falseotherwise.
-
intersection
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
Computes intersection of list of
GeoBoxinstances. 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.
-
contains
Determines whether the specified
GeoBoxis covered entirely by thisGeoBox. The altitude values are ignored.- Parameters:
geoBox-A
GeoBoxto check for containment within thisGeoBox.- Returns:
trueif covered by theGeoBox,falseotherwise.
-
contains
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:
trueif contained within theGeoBox,falseotherwise.
-
expandedBy
@NonNull public GeoBox expandedBy(double southMeters, double westMeters, double northMeters, double eastMeters) throws InstantiationErrorException Creates a
GeoBoxwhich is expanded by a fixed distance. Throws an InstantiationError if it is not possible to create a validGeoBoxwith 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.
-