Package org.apache.lucene.geo
Class Rectangle
java.lang.Object
org.apache.lucene.geo.Geometry
org.apache.lucene.geo.LatLonGeometry
org.apache.lucene.geo.Rectangle
Represents a lat/lon rectangle.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublemaximum error fromaxisLat(double, double).final doublemaximum latitude value (in degrees)final doubleminimum latitude value (in degrees)final doublemaximum longitude value (in degrees)final doubleminimum longitude value (in degrees) -
Constructor Summary
ConstructorsConstructorDescriptionRectangle(double minLat, double maxLat, double minLon, double maxLon) Constructs a bounding box by first validating the provided latitude and longitude coordinates -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleaxisLat(double centerLat, double radiusMeters) Calculate the latitude of a circle's intersections with its bbox meridians.static booleancontainsPoint(double lat, double lon, double minLat, double maxLat, double minLon, double maxLon) returns true if rectangle (defined by minLat, maxLat, minLon, maxLon) contains the lat lon pointbooleanReturns true if this bounding box crosses the datelinebooleanstatic RectanglefromPointDistance(double centerLat, double centerLon, double radiusMeters) Compute Bounding Box for a circle using WGS-84 parametersstatic RectanglefromPolygon(Polygon[] polygons) Returns the bounding box over an array of polygonsinthashCode()protected Component2Dget a Component2D from the geometry objecttoString()Methods inherited from class org.apache.lucene.geo.LatLonGeometry
create
-
Field Details
-
minLat
public final double minLatmaximum longitude value (in degrees) -
minLon
public final double minLonminimum longitude value (in degrees) -
maxLat
public final double maxLatmaximum latitude value (in degrees) -
maxLon
public final double maxLonminimum latitude value (in degrees) -
AXISLAT_ERROR
public static final double AXISLAT_ERRORmaximum error fromaxisLat(double, double). logic must be prepared to handle this
-
-
Constructor Details
-
Rectangle
public Rectangle(double minLat, double maxLat, double minLon, double maxLon) Constructs a bounding box by first validating the provided latitude and longitude coordinates
-
-
Method Details
-
toComponent2D
Description copied from class:Geometryget a Component2D from the geometry object- Specified by:
toComponent2Din classGeometry
-
toString
-
crossesDateline
public boolean crossesDateline()Returns true if this bounding box crosses the dateline -
containsPoint
public static boolean containsPoint(double lat, double lon, double minLat, double maxLat, double minLon, double maxLon) returns true if rectangle (defined by minLat, maxLat, minLon, maxLon) contains the lat lon point -
fromPointDistance
Compute Bounding Box for a circle using WGS-84 parameters -
axisLat
public static double axisLat(double centerLat, double radiusMeters) Calculate the latitude of a circle's intersections with its bbox meridians.NOTE: the returned value will be +/-
AXISLAT_ERRORof the actual value.- Parameters:
centerLat- The latitude of the circle centerradiusMeters- The radius of the circle in meters- Returns:
- A latitude
-
fromPolygon
Returns the bounding box over an array of polygons -
equals
-
hashCode
public int hashCode()
-