@Override public double doubleValue() throws IOException { final GeoPoint from = fromPoints[0]; final GeoPoint to = singleValues.geoPointValue(); return distance.calculate(from.lat(), from.lon(), to.lat(), to.lon(), unit); }
@Override public boolean advanceExact(int docId) throws IOException { if (geoPointValues.advanceExact(docId)) { int n = geoPointValues.docValueCount(); resize(n); for (int i = 0; i < n; i++) { GeoPoint other = geoPointValues.nextValue(); double distance = distFunction.calculate( origin.lat(), origin.lon(), other.lat(), other.lon(), DistanceUnit.METERS); values[i] = Math.max(0.0d, distance - offset); } sort(); return true; } else { return false; } } }), 0);
@Override public double calculate(double targetLatitude, double targetLongitude) { return SLOPPY_ARC.calculate(sourceLatitude, sourceLongitude, targetLatitude, targetLongitude, unit); } }
@Override public double calculate(double targetLatitude, double targetLongitude) { return ARC.calculate(sourceLatitude, sourceLongitude, targetLatitude, targetLongitude, unit); }
@Override public boolean advanceExact(int target) throws IOException { if (geoPointValues.advanceExact(target)) { resize(geoPointValues.docValueCount() * fromPoints.length); int v = 0; for (int i = 0; i < geoPointValues.docValueCount(); ++i) { final GeoPoint point = geoPointValues.nextValue(); for (GeoPoint from : fromPoints) { values[v] = distance.calculate(from.lat(), from.lon(), point.lat(), point.lon(), unit); v++; } } sort(); return true; } else { return false; } } };
public double distance(double lat, double lon) { GeoPoint point = getValue(); return GeoDistance.PLANE.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.DEFAULT); }
public double arcDistance(double lat, double lon) { GeoPoint point = getValue(); return GeoDistance.ARC.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.DEFAULT); }
public double distanceInKm(double lat, double lon) { GeoPoint point = getValue(); return GeoDistance.PLANE.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.KILOMETERS); }
@Override public double valueAt(int index) { GeoPoint other = geoPointValues.valueAt(index); return Math.max(0.0d, distFunction.calculate(origin.lat(), origin.lon(), other.lat(), other.lon(), DistanceUnit.METERS) - offset); } }, 0.0);
public double factorDistanceWithDefault(double lat, double lon, double defaultValue) { if (isEmpty()) { return defaultValue; } GeoPoint point = getValue(); return GeoDistance.FACTOR.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.DEFAULT); }
public double distanceInMilesWithDefault(double lat, double lon, double defaultValue) { if (isEmpty()) { return defaultValue; } GeoPoint point = getValue(); return GeoDistance.PLANE.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.MILES); }
public double distanceWithDefault(double lat, double lon, double defaultValue) { if (isEmpty()) { return defaultValue; } GeoPoint point = getValue(); return GeoDistance.PLANE.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.DEFAULT); }
public double arcDistanceInKmWithDefault(double lat, double lon, double defaultValue) { if (isEmpty()) { return defaultValue; } GeoPoint point = getValue(); return GeoDistance.ARC.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.KILOMETERS); }
public double arcDistanceInMilesWithDefault(double lat, double lon, double defaultValue) { if (isEmpty()) { return defaultValue; } GeoPoint point = getValue(); return GeoDistance.ARC.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.MILES); }
public double distanceInKmWithDefault(double lat, double lon, double defaultValue) { if (isEmpty()) { return defaultValue; } GeoPoint point = getValue(); return GeoDistance.PLANE.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.KILOMETERS); }
@Override public double doubleValue() throws IOException { final GeoPoint from = fromPoints[0]; final GeoPoint to = singleValues.geoPointValue(); return distance.calculate(from.lat(), from.lon(), to.lat(), to.lon(), unit); }
@Override public double get(int docID) { if (docsWithField != null && !docsWithField.get(docID)) { return 0d; } final GeoPoint to = singleValues.get(docID); final GeoPoint from = fromPoints[0]; return distance.calculate(from.lat(), from.lon(), to.lat(), to.lon(), unit); }
public double geohashDistance(String geohash) { GeoPoint point = getValue(); GeoPoint p = new GeoPoint().resetFromGeoHash(geohash); return GeoDistance.ARC.calculate(point.lat(), point.lon(), p.lat(), p.lon(), DistanceUnit.DEFAULT); }
public double geohashDistanceInKm(String geohash) { GeoPoint point = getValue(); GeoPoint p = new GeoPoint().resetFromGeoHash(geohash); return GeoDistance.ARC.calculate(point.lat(), point.lon(), p.lat(), p.lon(), DistanceUnit.KILOMETERS); }
public double geohashDistanceInMiles(String geohash) { GeoPoint point = getValue(); GeoPoint p = new GeoPoint().resetFromGeoHash(geohash); return GeoDistance.ARC.calculate(point.lat(), point.lon(), p.lat(), p.lon(), DistanceUnit.MILES); }