Class XLatLonShape


  • public class XLatLonShape
    extends java.lang.Object
    An indexed shape utility class.

    Polygon's are decomposed into a triangular mesh using the XTessellator utility class Each XTessellator.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:

    WARNING: Like 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:
    PointValues, LatLonDocValuesField
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  XLatLonShape.QueryRelation
      Query Relation Types
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BYTES  
      protected static org.apache.lucene.document.FieldType TYPE  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.apache.lucene.document.Field[] createIndexableFields​(java.lang.String fieldName, double lat, double lon)
      create indexable fields for point geometry
      static org.apache.lucene.document.Field[] createIndexableFields​(java.lang.String fieldName, org.apache.lucene.geo.Line line)
      create indexable fields for line geometry
      static org.apache.lucene.document.Field[] createIndexableFields​(java.lang.String fieldName, org.apache.lucene.geo.Polygon polygon)
      create indexable fields for polygon geometry
      static void decodeTriangle​(byte[] t, int[] triangle)
      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 org.apache.lucene.search.Query newBoxQuery​(java.lang.String field, XLatLonShape.QueryRelation queryRelation, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
      create a query to find all polygons that intersect a defined bounding box
      static org.apache.lucene.search.Query newLineQuery​(java.lang.String field, XLatLonShape.QueryRelation queryRelation, org.apache.lucene.geo.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 org.apache.lucene.search.Query newPolygonQuery​(java.lang.String field, XLatLonShape.QueryRelation queryRelation, org.apache.lucene.geo.Polygon... polygons)
      create a query to find all polygons that intersect a provided polygon (or array of polygons) note: does not support dateline crossing
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TYPE

        protected static final org.apache.lucene.document.FieldType TYPE
    • Method Detail

      • createIndexableFields

        public static org.apache.lucene.document.Field[] createIndexableFields​(java.lang.String fieldName,
                                                                               org.apache.lucene.geo.Polygon polygon)
        create indexable fields for polygon geometry
      • createIndexableFields

        public static org.apache.lucene.document.Field[] createIndexableFields​(java.lang.String fieldName,
                                                                               org.apache.lucene.geo.Line line)
        create indexable fields for line geometry
      • createIndexableFields

        public static org.apache.lucene.document.Field[] createIndexableFields​(java.lang.String fieldName,
                                                                               double lat,
                                                                               double lon)
        create indexable fields for point geometry
      • newBoxQuery

        public static org.apache.lucene.search.Query newBoxQuery​(java.lang.String field,
                                                                 XLatLonShape.QueryRelation queryRelation,
                                                                 double minLatitude,
                                                                 double maxLatitude,
                                                                 double minLongitude,
                                                                 double maxLongitude)
        create a query to find all polygons that intersect a defined bounding box
      • newLineQuery

        public static org.apache.lucene.search.Query newLineQuery​(java.lang.String field,
                                                                  XLatLonShape.QueryRelation queryRelation,
                                                                  org.apache.lucene.geo.Line... lines)
        create a query to find all polygons that intersect a provided linestring (or array of linestrings) note: does not support dateline crossing
      • newPolygonQuery

        public static org.apache.lucene.search.Query newPolygonQuery​(java.lang.String field,
                                                                     XLatLonShape.QueryRelation queryRelation,
                                                                     org.apache.lucene.geo.Polygon... polygons)
        create a query to find all polygons that intersect a provided polygon (or array of polygons) note: does not support dateline crossing
      • encodeTriangle

        public 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. Triangles are encoded with CCW orientation and might be rotated to limit the number of possible reconstructions to 2^3. Reconstruction always happens from west to east.