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.haversinMeters(double, double, double, double)
.
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 lat, lon center location
|
protected double |
sortKey
partial haversin computation
|
field, maxLat, maxLon, minLat, minLon, termEncoding
Constructor and Description |
---|
GeoPointDistanceQuery(String field,
double centerLat,
double centerLon,
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 centerLat,
double centerLon,
double radiusMeters)
Constructs a Query for all
GeoPointField types within a
distance (in meters) from a given point. |
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
classHash, createWeight, sameClassAs, toString
protected final double centerLat
protected final double centerLon
protected final double radiusMeters
protected final double sortKey
public GeoPointDistanceQuery(String field, double centerLat, double centerLon, double radiusMeters)
GeoPointField
types within a
distance (in meters) from a given pointpublic GeoPointDistanceQuery(String field, GeoPointField.TermEncoding termEncoding, double centerLat, double centerLon, double radiusMeters)
GeoPointField
types within a
distance (in meters) from a given point. Accepts optional
GeoPointField.TermEncoding
parameterpublic Query rewrite(IndexReader reader)
rewrite
in class GeoPointInBBoxQuery
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-2017 Apache Software Foundation. All Rights Reserved.