org.apache.lucene.geo

Class Polygon



  • public final class Polygon
    extends Object
    Represents a closed polygon on the earth's surface. You can either construct the Polygon directly yourself with double[] coordinates, or use fromGeoJSON(java.lang.String) if you have a polygon already encoded as a GeoJSON string.

    NOTES:

    1. Coordinates must be in clockwise order, except for holes. Holes must be in counter-clockwise order.
    2. The polygon must be closed: the first and last coordinates need to have the same values.
    3. The polygon must not be self-crossing, otherwise may result in unexpected behavior.
    4. All latitude/longitude values must be in decimal degrees.
    5. Polygons cannot cross the 180th meridian. Instead, use two polygons: one on each side.
    6. For more advanced GeoSpatial indexing and query operations see the spatial-extras module
    • Field Detail

      • minLat

        public final double minLat
        minimum latitude of this polygon's bounding box area
      • maxLat

        public final double maxLat
        maximum latitude of this polygon's bounding box area
      • minLon

        public final double minLon
        minimum longitude of this polygon's bounding box area
      • maxLon

        public final double maxLon
        maximum longitude of this polygon's bounding box area
    • Constructor Detail

      • Polygon

        public Polygon(double[] polyLats,
                       double[] polyLons,
                       Polygon... holes)
        Creates a new Polygon from the supplied latitude/longitude array, and optionally any holes.