Package org.apache.lucene.geo
package org.apache.lucene.geo
Core geo-spatial types and utilities for handling geographical data and spatial operations in
Lucene.
Overview
This package provides classes for representing, indexing, and querying geographical data in Lucene. It uses the WGS84 coordinate system with latitude/longitude pairs to represent points on Earth.Core Concepts
- Coordinate System: WGS84 (World Geodetic System 1984)
- Latitude: -90° to +90° (negative for South, positive for North)
- Longitude: -180° to +180° (negative for West, positive for East)
- Distance calculations use haversine formula on a spherical Earth model
- Areas near poles and the dateline receive special handling
Key Components
Point
: Represents a point on Earth's surfaceRectangle
: Defines a bounding box for spatial queriesCircle
: Represents a circular area with a center point and radiusPolygon
: Represents an arbitrary polygon shapeLine
: Represents a path or line string
Common Operations
- Distance calculations between points
- Point-in-polygon testing
- Rectangle containment and intersection
- Creation of bounding boxes
- Polygon validation and preprocessing
Usage Examples
Rectangle bbox = Rectangle.fromPointDistance(51.5, -0.12, 5000); // 5km around London
Circle circle = new Circle(48.8566, 2.3522, 1000); // 1km around Paris
-
ClassDescriptionRepresents a circle on the Earth's surface defined by a center point and radius.2D Geometry object that supports spatial relationships with bounding boxes, triangles and points.Used by withinTriangle to check the within relationship between a triangle and the query shape (e.g.reusable geopoint encoding methodsA predicate that checks whether a given point is within a component2D geometry.A predicate that checks whether a given point is within a distance of another point.Base class for
LatLonGeometry
andXYGeometry
Utility methods for geo-spatial calculations and coordinate validation.used to define the orientation of 3 points -1 = Clockwise 0 = Colinear 1 = Counter-clockwiseLat/Lon Geometry object.Represents a line on the earth's surface.Represents a point on the earth's surface.Represents a closed polygon on the earth's surface.Represents a rectangular bounding box on Earth's surface.Parses shape geometry represented in WKT formatEnumerated type for ShapesComputes a triangular mesh tessellation for a given polygon.Implementation of this interface will receive calls with internal data at each step of the triangulation algorithm.Triangle in the tessellated meshRepresents a circle on the XY plane.reusable cartesian geometry encoding methodsCartesian Geometry object.Represents a line in cartesian space.Represents a point on the earth's surface.Represents a polygon in cartesian space.Represents a x/y cartesian rectangle.