Package mil.nga.geopackage
Class BoundingBox
- java.lang.Object
- 
- mil.nga.geopackage.BoundingBox
 
- 
 public class BoundingBox extends Object Bounding Box with longitude and latitude ranges in degrees- Author:
- osbornb
 
- 
- 
Constructor SummaryConstructors Constructor Description BoundingBox()ConstructorBoundingBox(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)ConstructorBoundingBox(BoundingBox boundingBox)ConstructorBoundingBox(Geometry geometry)ConstructorBoundingBox(GeometryEnvelope envelope)Constructor
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BoundingBoxboundCoordinates(double maxProjectionLongitude)Bound the bounding box longitudes within the min and max possible projection values.BoundingBoxboundWebMercatorCoordinates()Bound the bounding box coordinates within Web Mercator range valuesBoundingBoxboundWgs84Coordinates()Bound the bounding box coordinates within WGS84 range valuesGeometryEnvelopebuildEnvelope()Build a Geometry Envelope from the bounding boxstatic GeometryEnvelopebuildEnvelope(BoundingBox boundingBox)Build a Geometry Envelope from the bounding boxGeometrybuildGeometry()Build a geometry representation of the bounding boxstatic GeometrybuildGeometry(BoundingBox boundingBox)Build a geometry representation of the bounding boxBoundingBoxcomplementary(double maxProjectionLongitude)If the bounding box spans the Anti-Meridian, attempt to get a complementary bounding box using the max longitude of the unit projectionBoundingBoxcomplementaryWebMercator()If the bounding box spans the Anti-Meridian, attempt to get a complementary Web Mercator bounding boxBoundingBoxcomplementaryWgs84()If the bounding box spans the Anti-Meridian, attempt to get a complementary WGS84 bounding boxbooleancontains(BoundingBox boundingBox)Determine if inclusively contains the provided bounding boxBoundingBoxcopy()Copy the bounding boxbooleanequals(Object obj)BoundingBoxexpandCoordinates(double maxProjectionLongitude)Expand the bounding box max longitude above the max possible projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.BoundingBoxexpandWebMercatorCoordinates()Expand the bounding box max longitude above the max Web Mercator projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.BoundingBoxexpandWgs84Coordinates()Expand the bounding box max longitude above the max WGS84 projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.PointgetCentroid()Get the bounding box centroid pointstatic PointgetCentroid(BoundingBox boundingBox)Get the bounding box centroid pointstatic PointgetCentroid(BoundingBox boundingBox, Projection projection)Get the centroid for the bounding box and projectionPointgetCentroid(Projection projection)Get the centroid for the bounding box and projectionPointgetDegreesCentroid()Get the centroid for the bounding box in degreesstatic PointgetDegreesCentroid(BoundingBox boundingBox)Get the centroid for a bounding box in degreesdoublegetLatitudeRange()Get the latitude rangedoublegetLongitudeRange()Get the longitude rangedoublegetMaxLatitude()Get the max latitudedoublegetMaxLongitude()Get the max longitudedoublegetMinLatitude()Get the min latitudedoublegetMinLongitude()Get the min longitudeinthashCode()booleanintersects(BoundingBox boundingBox)Determine if intersects with the provided bounding boxbooleanintersects(BoundingBox boundingBox, boolean allowEmpty)Determine if intersects with the provided bounding boxbooleanisPoint()Determine if the bounding box is of a single pointBoundingBoxoverlap(BoundingBox boundingBox)Get the overlapping bounding box with the provided bounding boxBoundingBoxoverlap(BoundingBox boundingBox, boolean allowEmpty)Get the overlapping bounding box with the provided bounding boxvoidsetMaxLatitude(double maxLatitude)Set the max latitudevoidsetMaxLongitude(double maxLongitude)Set the max longitudevoidsetMinLatitude(double minLatitude)Set the min latitudevoidsetMinLongitude(double minLongitude)Set the min longitudeBoundingBoxsquareExpand()Expand the bounding box to an equally sized width and height bounding boxBoundingBoxsquareExpand(double bufferPercentage)Expand the bounding box to an equally sized width and height bounding box with optional empty edge bufferStringtoString()BoundingBoxtransform(ProjectionTransform transform)Transform the bounding box using the provided projection transformBoundingBoxtransform(GeometryTransform transform)Transform the bounding box using the provided projection transformBoundingBoxunion(BoundingBox boundingBox)Get the union bounding box with the provided bounding boxstatic BoundingBoxworldWebMercator()Create a new Web Mercator bounding box with world bounds (meters)static BoundingBoxworldWGS84()Create a new WGS84 bounding box with world bounds (degrees)static BoundingBoxworldWGS84WithWebMercatorLimits()Create a new WGS84 bounding box bounded by Web Mercator limits
 
- 
- 
- 
Constructor Detail- 
BoundingBoxpublic BoundingBox() Constructor
 - 
BoundingBoxpublic BoundingBox(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)Constructor- Parameters:
- minLongitude- min longitude
- minLatitude- min latitude
- maxLongitude- max longitude
- maxLatitude- max latitude
- Since:
- 2.0.0
 
 - 
BoundingBoxpublic BoundingBox(BoundingBox boundingBox) Constructor- Parameters:
- boundingBox- bounding box
- Since:
- 1.1.6
 
 - 
BoundingBoxpublic BoundingBox(GeometryEnvelope envelope) Constructor- Parameters:
- envelope- geometry envelope
- Since:
- 2.0.0
 
 - 
BoundingBoxpublic BoundingBox(Geometry geometry) Constructor- Parameters:
- geometry- geometry
- Since:
- 6.2.0
 
 
- 
 - 
Method Detail- 
worldWGS84public static BoundingBox worldWGS84() Create a new WGS84 bounding box with world bounds (degrees)- Returns:
- new bounding box
- Since:
- 6.2.0
 
 - 
worldWebMercatorpublic static BoundingBox worldWebMercator() Create a new Web Mercator bounding box with world bounds (meters)- Returns:
- new bounding box
- Since:
- 6.2.0
 
 - 
worldWGS84WithWebMercatorLimitspublic static BoundingBox worldWGS84WithWebMercatorLimits() Create a new WGS84 bounding box bounded by Web Mercator limits- Returns:
- new bounding box
- Since:
- 6.6.0
 
 - 
getMinLongitudepublic double getMinLongitude() Get the min longitude- Returns:
- min longitude
 
 - 
setMinLongitudepublic void setMinLongitude(double minLongitude) Set the min longitude- Parameters:
- minLongitude- min longitude
 
 - 
getMaxLongitudepublic double getMaxLongitude() Get the max longitude- Returns:
- max longitude
 
 - 
setMaxLongitudepublic void setMaxLongitude(double maxLongitude) Set the max longitude- Parameters:
- maxLongitude- max longitude
 
 - 
getMinLatitudepublic double getMinLatitude() Get the min latitude- Returns:
- min latitude
 
 - 
setMinLatitudepublic void setMinLatitude(double minLatitude) Set the min latitude- Parameters:
- minLatitude- min latitude
 
 - 
getMaxLatitudepublic double getMaxLatitude() Get the max latitude- Returns:
- max latitude
 
 - 
setMaxLatitudepublic void setMaxLatitude(double maxLatitude) Set the max latitude- Parameters:
- maxLatitude- max latitude
 
 - 
getLongitudeRangepublic double getLongitudeRange() Get the longitude range- Returns:
- longitude range
- Since:
- 3.5.0
 
 - 
getLatitudeRangepublic double getLatitudeRange() Get the latitude range- Returns:
- latitude range
- Since:
- 3.5.0
 
 - 
getCentroidpublic Point getCentroid() Get the bounding box centroid point- Returns:
- centroid point
- Since:
- 6.2.0
 
 - 
getCentroidpublic static Point getCentroid(BoundingBox boundingBox) Get the bounding box centroid point- Parameters:
- boundingBox- bounding box
- Returns:
- centroid point
- Since:
- 6.2.0
 
 - 
getCentroidpublic Point getCentroid(Projection projection) Get the centroid for the bounding box and projection- Parameters:
- projection- projection of the bounding box
- Returns:
- centroid point
- Since:
- 6.2.0
 
 - 
getCentroidpublic static Point getCentroid(BoundingBox boundingBox, Projection projection) Get the centroid for the bounding box and projection- Parameters:
- boundingBox- bounding box
- projection- projection of the bounding box
- Returns:
- centroid point
- Since:
- 6.2.0
 
 - 
getDegreesCentroidpublic Point getDegreesCentroid() Get the centroid for the bounding box in degrees- Returns:
- centroid point
- Since:
- 6.2.0
 
 - 
getDegreesCentroidpublic static Point getDegreesCentroid(BoundingBox boundingBox) Get the centroid for a bounding box in degrees- Parameters:
- boundingBox- bounding box in degrees
- Returns:
- centroid point
- Since:
- 6.2.0
 
 - 
buildEnvelopepublic GeometryEnvelope buildEnvelope() Build a Geometry Envelope from the bounding box- Returns:
- geometry envelope
- Since:
- 1.1.0
 
 - 
buildEnvelopepublic static GeometryEnvelope buildEnvelope(BoundingBox boundingBox) Build a Geometry Envelope from the bounding box- Parameters:
- boundingBox- bounding box
- Returns:
- geometry envelope
- Since:
- 3.2.0
 
 - 
buildGeometrypublic Geometry buildGeometry() Build a geometry representation of the bounding box- Returns:
- geometry, polygon or point
- Since:
- 6.2.0
 
 - 
buildGeometrypublic static Geometry buildGeometry(BoundingBox boundingBox) Build a geometry representation of the bounding box- Parameters:
- boundingBox- bounding box
- Returns:
- geometry, polygon or point
- Since:
- 6.2.0
 
 - 
complementarypublic BoundingBox complementary(double maxProjectionLongitude) If the bounding box spans the Anti-Meridian, attempt to get a complementary bounding box using the max longitude of the unit projection- Parameters:
- maxProjectionLongitude- max longitude of the world for the current bounding box units
- Returns:
- complementary bounding box or nil if none
- Since:
- 2.0.0
 
 - 
complementaryWgs84public BoundingBox complementaryWgs84() If the bounding box spans the Anti-Meridian, attempt to get a complementary WGS84 bounding box- Returns:
- complementary bounding box or nil if none
- Since:
- 2.0.0
 
 - 
complementaryWebMercatorpublic BoundingBox complementaryWebMercator() If the bounding box spans the Anti-Meridian, attempt to get a complementary Web Mercator bounding box- Returns:
- complementary bounding box or nil if none
- Since:
- 2.0.0
 
 - 
boundCoordinatespublic BoundingBox boundCoordinates(double maxProjectionLongitude) Bound the bounding box longitudes within the min and max possible projection values. This may result in a max longitude numerically lower than the min longitude.- Parameters:
- maxProjectionLongitude- max longitude of the world for the current bounding box units
- Returns:
- bounded bounding box
- Since:
- 2.0.0
 
 - 
boundWgs84Coordinatespublic BoundingBox boundWgs84Coordinates() Bound the bounding box coordinates within WGS84 range values- Returns:
- bounded bounding box
- Since:
- 2.0.0
 
 - 
boundWebMercatorCoordinatespublic BoundingBox boundWebMercatorCoordinates() Bound the bounding box coordinates within Web Mercator range values- Returns:
- bounded bounding box
- Since:
- 2.0.0
 
 - 
expandCoordinatespublic BoundingBox expandCoordinates(double maxProjectionLongitude) Expand the bounding box max longitude above the max possible projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.- Parameters:
- maxProjectionLongitude- max longitude of the world for the current bounding box units
- Returns:
- expanded bounding box
- Since:
- 2.0.0
 
 - 
expandWgs84Coordinatespublic BoundingBox expandWgs84Coordinates() Expand the bounding box max longitude above the max WGS84 projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.- Returns:
- expanded bounding box
- Since:
- 2.0.0
 
 - 
expandWebMercatorCoordinatespublic BoundingBox expandWebMercatorCoordinates() Expand the bounding box max longitude above the max Web Mercator projection value if needed to create a bounding box where the max longitude is numerically larger than the min longitude.- Returns:
- expanded bounding box
- Since:
- 2.0.0
 
 - 
transformpublic BoundingBox transform(ProjectionTransform transform) Transform the bounding box using the provided projection transform- Parameters:
- transform- projection transform
- Returns:
- transformed bounding box
- Since:
- 3.0.0
 
 - 
transformpublic BoundingBox transform(GeometryTransform transform) Transform the bounding box using the provided projection transform- Parameters:
- transform- geometry transform
- Returns:
- transformed bounding box
- Since:
- 6.0.0
 
 - 
intersectspublic boolean intersects(BoundingBox boundingBox) Determine if intersects with the provided bounding box- Parameters:
- boundingBox- bounding box
- Returns:
- true if intersects
- Since:
- 3.1.0
 
 - 
intersectspublic boolean intersects(BoundingBox boundingBox, boolean allowEmpty) Determine if intersects with the provided bounding box- Parameters:
- boundingBox- bounding box
- allowEmpty- allow empty ranges when determining intersection
- Returns:
- true if intersects
- Since:
- 3.1.0
 
 - 
overlappublic BoundingBox overlap(BoundingBox boundingBox) Get the overlapping bounding box with the provided bounding box- Parameters:
- boundingBox- bounding box
- Returns:
- bounding box
- Since:
- 3.1.0
 
 - 
overlappublic BoundingBox overlap(BoundingBox boundingBox, boolean allowEmpty) Get the overlapping bounding box with the provided bounding box- Parameters:
- boundingBox- bounding box
- allowEmpty- allow empty ranges when determining overlap
- Returns:
- bounding box
- Since:
- 3.1.0
 
 - 
unionpublic BoundingBox union(BoundingBox boundingBox) Get the union bounding box with the provided bounding box- Parameters:
- boundingBox- bounding box
- Returns:
- bounding box
- Since:
- 3.1.0
 
 - 
containspublic boolean contains(BoundingBox boundingBox) Determine if inclusively contains the provided bounding box- Parameters:
- boundingBox- bounding box
- Returns:
- true if contains
- Since:
- 3.1.0
 
 - 
squareExpandpublic BoundingBox squareExpand() Expand the bounding box to an equally sized width and height bounding box- Returns:
- new square expanded bounding box
- Since:
- 3.5.0
 
 - 
squareExpandpublic BoundingBox squareExpand(double bufferPercentage) Expand the bounding box to an equally sized width and height bounding box with optional empty edge buffer- Parameters:
- bufferPercentage- bounding box edge buffer percentage. A value of 0.1 adds a 10% buffer on each side of the squared bounding box.
- Returns:
- new square expanded bounding box
- Since:
- 3.5.0
 
 - 
isPointpublic boolean isPoint() Determine if the bounding box is of a single point- Returns:
- true if a single point bounds
- Since:
- 3.5.0
 
 - 
copypublic BoundingBox copy() Copy the bounding box- Returns:
- bounding box copy
- Since:
- 6.2.0
 
 
- 
 
-