Package org.elasticsearch.common.geo
Class GeoBoundingBox
java.lang.Object
org.elasticsearch.common.geo.GeoBoundingBox
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
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
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionGeoBoundingBox(GeoPoint topLeft, GeoPoint bottomRight) GeoBoundingBox(StreamInput input) -
Method Summary
Modifier and TypeMethodDescriptiondoublebottom()booleaninthashCode()booleandoubleleft()static GeoBoundingBoxparseBoundingBox(XContentParser parser) Parses the bounding box and returns bottom, top, left, right coordinatesbooleanpointInBounds(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.doubleright()doubletop()topLeft()toString()toXContent(XContentBuilder builder, ToXContent.Params params) toXContentFragment(XContentBuilder builder, boolean buildLatLonFields) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
BOUNDS_FIELD
-
LAT_FIELD
-
LON_FIELD
-
TOP_LEFT_FIELD
-
BOTTOM_RIGHT_FIELD
-
-
Constructor Details
-
GeoBoundingBox
-
GeoBoundingBox
- Throws:
IOException
-
-
Method Details
-
isUnbounded
public boolean isUnbounded() -
topLeft
-
bottomRight
-
top
public double top() -
bottom
public double bottom() -
left
public double left() -
right
public double right() -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
toXContentFragment
public XContentBuilder toXContentFragment(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 pointlat- the latitude of the point- Returns:
- whether the point (lon, lat) is in the specified bounding box
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-
parseBoundingBox
public static GeoBoundingBox parseBoundingBox(XContentParser parser) throws IOException, ElasticsearchParseException Parses the bounding box and returns bottom, top, left, right coordinates
-