Class GeoBoundingBox

java.lang.Object
org.elasticsearch.common.geo.GeoBoundingBox
All Implemented Interfaces:
Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentFragment

public class GeoBoundingBox extends Object implements org.elasticsearch.xcontent.ToXContentFragment, Writeable
A class representing a Geo-Bounding-Box for use by Geo queries and aggregations that deal with extents/rectangles representing rectangular areas of interest.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent

    org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.elasticsearch.xcontent.ParseField
     
    static final org.elasticsearch.xcontent.ParseField
     
    static final org.elasticsearch.xcontent.ParseField
     
    static final org.elasticsearch.xcontent.ParseField
     
    static final org.elasticsearch.xcontent.ParseField
     

    Fields inherited from interface org.elasticsearch.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    GeoBoundingBox(GeoPoint topLeft, GeoPoint bottomRight)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
     
     
    boolean
     
    int
     
    boolean
     
    double
     
    parseBoundingBox(org.elasticsearch.xcontent.XContentParser parser)
    Parses the bounding box and returns bottom, top, left, right coordinates
    boolean
    pointInBounds(double lon, double lat)
    If the bounding box crosses the date-line (left greater-than right) then the longitude of the point need only to be higher than the left or lower than the right.
    double
     
    double
    top()
     
     
     
    org.elasticsearch.xcontent.XContentBuilder
    toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    org.elasticsearch.xcontent.XContentBuilder
    toXContentFragment(org.elasticsearch.xcontent.XContentBuilder builder, boolean buildLatLonFields)
     
    void
    Write this into the StreamOutput.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • BOUNDS_FIELD

      public static final org.elasticsearch.xcontent.ParseField BOUNDS_FIELD
    • LAT_FIELD

      public static final org.elasticsearch.xcontent.ParseField LAT_FIELD
    • LON_FIELD

      public static final org.elasticsearch.xcontent.ParseField LON_FIELD
    • TOP_LEFT_FIELD

      public static final org.elasticsearch.xcontent.ParseField TOP_LEFT_FIELD
    • BOTTOM_RIGHT_FIELD

      public static final org.elasticsearch.xcontent.ParseField BOTTOM_RIGHT_FIELD
  • Constructor Details

  • Method Details

    • isUnbounded

      public boolean isUnbounded()
    • topLeft

      public GeoPoint topLeft()
    • bottomRight

      public GeoPoint bottomRight()
    • top

      public double top()
    • bottom

      public double bottom()
    • left

      public double left()
    • right

      public double right()
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • toXContentFragment

      public org.elasticsearch.xcontent.XContentBuilder toXContentFragment(org.elasticsearch.xcontent.XContentBuilder builder, boolean buildLatLonFields) throws IOException
      Throws:
      IOException
    • pointInBounds

      public boolean pointInBounds(double lon, double lat)
      If the bounding box crosses the date-line (left greater-than right) then the longitude of the point need only to be higher than the left or lower than the right. Otherwise, it must be both.
      Parameters:
      lon - the longitude of the point
      lat - the latitude of the point
      Returns:
      whether the point (lon, lat) is in the specified bounding box
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parseBoundingBox

      public static GeoBoundingBox parseBoundingBox(org.elasticsearch.xcontent.XContentParser parser) throws IOException, ElasticsearchParseException
      Parses the bounding box and returns bottom, top, left, right coordinates
      Throws:
      IOException
      ElasticsearchParseException