org.apache.lucene.geo

Class Rectangle

• ```public class Rectangle
extends Object```
Represents a lat/lon rectangle.
• Field Summary

Fields
Modifier and Type Field and Description
`static double` `AXISLAT_ERROR`
`double` `maxLat`
maximum latitude value (in degrees)
`double` `maxLon`
minimum latitude value (in degrees)
`double` `minLat`
maximum longitude value (in degrees)
`double` `minLon`
minimum longitude value (in degrees)
• Constructor Summary

Constructors
Constructor and Description
```Rectangle(double minLat, double maxLat, double minLon, double maxLon)```
Constructs a bounding box by first validating the provided latitude and longitude coordinates
• Method Summary

All Methods
Modifier and Type Method and Description
`static double` ```axisLat(double centerLat, double radiusMeters)```
Calculate the latitude of a circle's intersections with its bbox meridians.
`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
`boolean` `crossesDateline()`
Returns true if this bounding box crosses the dateline
`boolean` `equals(Object o)`
`static Rectangle` ```fromPointDistance(double centerLat, double centerLon, double radiusMeters)```
Compute Bounding Box for a circle using WGS-84 parameters
`static Rectangle` `fromPolygon(Polygon[] polygons)`
Returns the bounding box over an array of polygons
`int` `hashCode()`
`String` `toString()`
• Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• Field Detail

• minLat

`public final double minLat`
maximum longitude value (in degrees)
• minLon

`public final double minLon`
minimum longitude value (in degrees)
• maxLat

`public final double maxLat`
maximum latitude value (in degrees)
• maxLon

`public final double maxLon`
minimum latitude value (in degrees)
• Constructor Detail

• 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 Detail

• toString

`public String toString()`
Overrides:
`toString` in class `Object`
• 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

```public static Rectangle fromPointDistance(double centerLat,
double centerLon,
Compute Bounding Box for a circle using WGS-84 parameters
• axisLat

```public static double axisLat(double centerLat,
Calculate the latitude of a circle's intersections with its bbox meridians.

NOTE: the returned value will be +/- `AXISLAT_ERROR` of the actual value.

Parameters:
`centerLat` - The latitude of the circle center
`radiusMeters` - The radius of the circle in meters
Returns:
A latitude
• fromPolygon

`public static Rectangle fromPolygon(Polygon[] polygons)`
Returns the bounding box over an array of polygons
• equals

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

`public int hashCode()`
Overrides:
`hashCode` in class `Object`