Package org.apache.lucene.document
Class LatLonShape
java.lang.Object
org.apache.lucene.document.LatLonShape
An geo shape utility class for indexing and searching gis geometries
whose vertices are latitude, longitude values (in decimal degrees).
This class defines seven static factory methods for common indexing and search operations:
createIndexableFields(String, Polygon)for indexing a geo polygon.createIndexableFields(String, Line)for indexing a geo linestring.createIndexableFields(String, double, double)for indexing a lat, lon geo point.newBoxQuery()for matching geo shapes that have someShapeField.QueryRelationwith a bounding box.newLineQuery()for matching geo shapes that have someShapeField.QueryRelationwith a linestring.newPolygonQuery()for matching geo shapes that have someShapeField.QueryRelationwith a polygon.newGeometryQuery()for matching geo shapes that have someShapeField.QueryRelationwith one or moreLatLonGeometry.
LatLonPoint, vertex values are indexed with some loss of precision from the
original double values (4.190951585769653E-8 for the latitude component
and 8.381903171539307E-8 for longitude).- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Field[]createIndexableFields(String fieldName, double lat, double lon) create indexable fields for point geometrystatic Field[]createIndexableFields(String fieldName, Line line) create indexable fields for line geometrystatic Field[]createIndexableFields(String fieldName, Polygon polygon) create indexable fields for polygon geometryprivate static QuerymakeContainsGeometryQuery(String field, LatLonGeometry... latLonGeometries) static QuerynewBoxQuery(String field, ShapeField.QueryRelation queryRelation, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) create a query to find all indexed geo shapes that intersect a defined bounding boxstatic QuerynewDistanceQuery(String field, ShapeField.QueryRelation queryRelation, Circle... circle) create a query to find all polygons that intersect a provided circle.static QuerynewGeometryQuery(String field, ShapeField.QueryRelation queryRelation, LatLonGeometry... latLonGeometries) create a query to find all indexed geo shapes that intersect a provided geometry (or array of geometries).static QuerynewLineQuery(String field, ShapeField.QueryRelation queryRelation, Line... lines) create a query to find all indexed geo shapes that intersect a provided linestring (or array of linestrings) note: does not support dateline crossingstatic QuerynewPointQuery(String field, ShapeField.QueryRelation queryRelation, double[]... points) create a query to find all indexed shapes that comply theShapeField.QueryRelationwith the provided pointsstatic QuerynewPolygonQuery(String field, ShapeField.QueryRelation queryRelation, Polygon... polygons) create a query to find all indexed geo shapes that intersect a provided polygon (or array of polygons) note: does not support dateline crossing
-
Constructor Details
-
LatLonShape
private LatLonShape()
-
-
Method Details
-
createIndexableFields
create indexable fields for polygon geometry -
createIndexableFields
create indexable fields for line geometry -
createIndexableFields
create indexable fields for point geometry -
newBoxQuery
public static Query newBoxQuery(String field, ShapeField.QueryRelation queryRelation, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) create a query to find all indexed geo shapes that intersect a defined bounding box -
newLineQuery
public static Query newLineQuery(String field, ShapeField.QueryRelation queryRelation, Line... lines) create a query to find all indexed geo shapes that intersect a provided linestring (or array of linestrings) note: does not support dateline crossing -
newPolygonQuery
public static Query newPolygonQuery(String field, ShapeField.QueryRelation queryRelation, Polygon... polygons) create a query to find all indexed geo shapes that intersect a provided polygon (or array of polygons) note: does not support dateline crossing -
newPointQuery
public static Query newPointQuery(String field, ShapeField.QueryRelation queryRelation, double[]... points) create a query to find all indexed shapes that comply theShapeField.QueryRelationwith the provided points -
newDistanceQuery
public static Query newDistanceQuery(String field, ShapeField.QueryRelation queryRelation, Circle... circle) create a query to find all polygons that intersect a provided circle. -
newGeometryQuery
public static Query newGeometryQuery(String field, ShapeField.QueryRelation queryRelation, LatLonGeometry... latLonGeometries) create a query to find all indexed geo shapes that intersect a provided geometry (or array of geometries). -
makeContainsGeometryQuery
-