jruby/docs BETA
Navigation
org.apache.lucene.geo 19
C Circle
I Component2D
C GeoEncodingUtils
C GeoUtils
C Geometry
C LatLonGeometry
C Line
C Point
C Polygon
C Rectangle
C SimpleWKTShapeParser
C Tessellator
C XYCircle
C XYEncodingUtils
C XYGeometry
C XYLine
C XYPoint
C XYPolygon
C XYRectangle
Rectangle — members 14
F minLat() double
F maxLat() double
F minLon() double
F maxLon() double
F AXISLAT_ERROR() double
C new(min_lat, max_lat, min_lon, max_lon)
M axis_lat(center_lat, radius_meters) double
M contains_point(lat, lon, min_lat, max_lat, min_lon, max_lon) boolean
M crosses_dateline() boolean
M equals(o) boolean
M from_point_distance(center_lat, center_lon, radius_meters) Rectangle
M from_polygon(polygons) Rectangle
M hash_code() int
M to_string() String

org.apache.lucene.geo.Rectangle

class extends LatLonGeometry 14 members

Represents a rectangular bounding box on Earth's surface.

A rectangle is defined by its minimum and maximum latitude/longitude coordinates. It can cross the dateline, in which case minLon > maxLon.

Key Features:

  • Handles dateline crossing automatically
  • Supports point-in-box testing
  • Can be used to create spatial queries
  • Useful for creating bounding boxes around other shapes

Example usage:

// Create a rectangle covering central London
Rectangle bbox = new Rectangle(51.4, 51.6, -0.2, 0.0);

// Create a rectangle crossing the dateline
Rectangle datelineBox = new Rectangle(20, 30, 170, -170);

// Create a bounding box around a point with given radius
Rectangle circle = Rectangle.fromPointDistance(lat, lon, radiusMeters);

Note: When working with areas near poles, consider that rectangles become highly distorted and may not provide accurate representation of the actual area.

Constants

constanttypenote
AXISLAT_ERROR double maximum error from #axisLat(double, double). logic must be prepared to handle this

Fields

fieldtypenote
minLat double Minimum latitude in degrees (-90 to 90)
maxLat double Maximum latitude in degrees (-90 to 90)
minLon double Minimum longitude in degrees (-180 to 180). May be greater than maxLon when crossing the dateline.
maxLon double Maximum longitude in degrees (-180 to 180)

Constructors

new

new ( double min_lat, double max_lat, double min_lon, double max_lon )
Java: <init>(double minLat, double maxLat, double minLon, double maxLon)

Constructs a bounding box by first validating the provided latitude and longitude coordinates

Class Methods

axis_lat

double axis_lat ( double center_lat, double radius_meters )
Java: axisLat(double centerLat, double radiusMeters)

Calculate the latitude of a circle's intersections with its bbox meridians.

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

nametypedescription
center_latdoubleThe latitude of the circle center
radius_metersdoubleThe radius of the circle in meters

Returns: A latitude

contains_point

boolean contains_point ( double lat, double lon, double min_lat, double max_lat, double min_lon, double max_lon )
Java: 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

from_point_distance

Rectangle from_point_distance ( double center_lat, double center_lon, double radius_meters )
Java: fromPointDistance(double centerLat, double centerLon, double radiusMeters)

Compute Bounding Box for a circle using WGS-84 parameters

from_polygon

Rectangle from_polygon ( Polygon[] polygons )
Java: fromPolygon(org.apache.lucene.geo.Polygon[] polygons)

Returns the bounding box over an array of polygons

Instance Methods

crosses_dateline

boolean crosses_dateline ( )
Java: crossesDateline()

Returns true if this bounding box crosses the dateline

equals

boolean equals ( Object o )
Java: equals(Object o)

hash_code

int hash_code ( )
Java: hashCode()

to_string

String to_string ( )
Java: toString()
this work for additional information regarding copyright ownership.