public class GeoPointDistanceQuery extends GeoPointInBBoxQuery
GeoPointInBBoxQuery
and is implemented using a two phase approach. First,
like GeoPointInBBoxQueryImpl
candidate terms are queried using the numeric ranges based on
the morton codes of the min and max lat/lon pairs that intersect the boundary of the point-radius
circle. Terms
passing this initial filter are then passed to a secondary postFilter
method that verifies whether the
decoded lat/lon point fall within the specified query distance (see SloppyMath.haversin(double, double, double, double)
.
All morton value comparisons are subject to the same precision tolerance defined in
1.0E-6 and distance comparisons are subject to the accuracy of the
haversine formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159)
Note: This query currently uses haversine which is a sloppy distance calculation (see above reference). For large queries one can expect upwards of 400m error. Vincenty shrinks this to ~40m error but pays a penalty for computing using the spheroid
Modifier and Type | Field and Description |
---|---|
protected double |
centerLat
latitude value (in degrees) for query location
|
protected double |
centerLon
longitude value (in degrees) for query location
|
protected double |
radiusMeters
distance (in meters) from lon, lat center location
|
field, maxLat, maxLon, minLat, minLon, termEncoding
Constructor and Description |
---|
GeoPointDistanceQuery(String field,
double centerLon,
double centerLat,
double radiusMeters)
Constructs a Query for all
GeoPointField types within a
distance (in meters) from a given point |
GeoPointDistanceQuery(String field,
GeoPointField.TermEncoding termEncoding,
double centerLon,
double centerLat,
double radiusMeters) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
double |
getCenterLat()
getter method for center latitude value
|
double |
getCenterLon()
getter method for center longitude value
|
double |
getRadiusMeters()
getter method for distance value (in meters)
|
int |
hashCode() |
Query |
rewrite(IndexReader reader) |
String |
toString(String field) |
getField, getMaxLat, getMaxLon, getMinLat, getMinLon
protected final double centerLon
protected final double centerLat
protected final double radiusMeters
public GeoPointDistanceQuery(String field, double centerLon, double centerLat, double radiusMeters)
GeoPointField
types within a
distance (in meters) from a given pointpublic GeoPointDistanceQuery(String field, GeoPointField.TermEncoding termEncoding, double centerLon, double centerLat, double radiusMeters)
public Query rewrite(IndexReader reader) throws IOException
rewrite
in class GeoPointInBBoxQuery
IOException
public boolean equals(Object o)
equals
in class GeoPointInBBoxQuery
public int hashCode()
hashCode
in class GeoPointInBBoxQuery
public String toString(String field)
toString
in class GeoPointInBBoxQuery
public double getCenterLon()
public double getCenterLat()
public double getRadiusMeters()
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.