public class LatLonShape
extends java.lang.Object
Polygon
's are decomposed into a triangular mesh using the Tessellator
utility class
Each Tessellator.Triangle
is encoded and indexed as a multi-value field.
Finding all shapes that intersect a range (e.g., bounding box) at search time is efficient.
This class defines static factory methods for common operations:
createIndexableFields(String, Polygon)
for matching polygons that intersect a bounding box.
newBoxQuery()
for matching polygons that intersect a bounding box.
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).PointValues
,
LatLonDocValuesField
Modifier and Type | Class and Description |
---|---|
private static class |
LatLonShape.LatLonTriangle
polygons are decomposed into tessellated triangles using
Tessellator
these triangles are encoded and inserted as separate indexed POINT fields |
static class |
LatLonShape.QueryRelation
Query Relation Types
|
Modifier and Type | Field and Description |
---|---|
(package private) static int |
BYTES |
private static int |
MAXY_MINX_MINY_MAXX_Y_X |
private static int |
MAXY_MINX_MINY_X_Y_MAXX |
private static int |
MAXY_MINX_Y_X_MINY_MAXX |
private static int |
MINY_MINX_MAXY_MAXX_Y_X |
private static int |
MINY_MINX_Y_MAXX_MAXY_X |
private static int |
MINY_MINX_Y_X_MAXY_MAXX |
protected static FieldType |
TYPE |
private static int |
Y_MINX_MINY_MAXX_MAXY_X |
private static int |
Y_MINX_MINY_X_MAXY_MAXX |
Modifier | Constructor and Description |
---|---|
private |
LatLonShape() |
Modifier and Type | Method and Description |
---|---|
static Field[] |
createIndexableFields(java.lang.String fieldName,
double lat,
double lon)
create indexable fields for point geometry
|
static Field[] |
createIndexableFields(java.lang.String fieldName,
Line line)
create indexable fields for line geometry
|
static Field[] |
createIndexableFields(java.lang.String fieldName,
Polygon polygon)
create indexable fields for polygon geometry
|
static void |
decodeTriangle(byte[] t,
int[] triangle)
Decode a triangle encoded by
encodeTriangle(byte[], int, int, int, int, int, int) . |
static void |
encodeTriangle(byte[] bytes,
int aLat,
int aLon,
int bLat,
int bLon,
int cLat,
int cLon)
A triangle is encoded using 6 points and an extra point with encoded information in three bits of how to reconstruct it.
|
static Query |
newBoxQuery(java.lang.String field,
LatLonShape.QueryRelation queryRelation,
double minLatitude,
double maxLatitude,
double minLongitude,
double maxLongitude)
create a query to find all polygons that intersect a defined bounding box
|
static Query |
newLineQuery(java.lang.String field,
LatLonShape.QueryRelation queryRelation,
Line... lines)
create a query to find all polygons that intersect a provided linestring (or array of linestrings)
note: does not support dateline crossing
|
static Query |
newPolygonQuery(java.lang.String field,
LatLonShape.QueryRelation queryRelation,
Polygon... polygons)
create a query to find all polygons that intersect a provided polygon (or array of polygons)
note: does not support dateline crossing
|
static final int BYTES
protected static final FieldType TYPE
private static final int MINY_MINX_MAXY_MAXX_Y_X
private static final int MINY_MINX_Y_X_MAXY_MAXX
private static final int MAXY_MINX_Y_X_MINY_MAXX
private static final int MAXY_MINX_MINY_MAXX_Y_X
private static final int Y_MINX_MINY_X_MAXY_MAXX
private static final int Y_MINX_MINY_MAXX_MAXY_X
private static final int MAXY_MINX_MINY_X_Y_MAXX
private static final int MINY_MINX_Y_MAXX_MAXY_X
public static Field[] createIndexableFields(java.lang.String fieldName, Polygon polygon)
public static Field[] createIndexableFields(java.lang.String fieldName, Line line)
public static Field[] createIndexableFields(java.lang.String fieldName, double lat, double lon)
public static Query newBoxQuery(java.lang.String field, LatLonShape.QueryRelation queryRelation, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
public static Query newLineQuery(java.lang.String field, LatLonShape.QueryRelation queryRelation, Line... lines)
public static Query newPolygonQuery(java.lang.String field, LatLonShape.QueryRelation queryRelation, Polygon... polygons)
public static void encodeTriangle(byte[] bytes, int aLat, int aLon, int bLat, int bLon, int cLat, int cLon)
public static void decodeTriangle(byte[] t, int[] triangle)
encodeTriangle(byte[], int, int, int, int, int, int)
.