/** Sets the center point for this query. */ public GeoDistanceQueryBuilder geohash(String geohash) { if (Strings.isEmpty(geohash)) { throw new IllegalArgumentException("geohash must not be null or empty"); } this.center.resetFromGeoHash(geohash); return this; }
public static GeoPoint fromGeohash(long geohashLong) { return new GeoPoint().resetFromGeoHash(geohashLong); }
public static GeoPoint fromGeohash(String geohash) { return new GeoPoint().resetFromGeoHash(geohash); }
public GeoPoint resetFromString(String value, final boolean ignoreZValue) { if (value.contains(",")) { String[] vals = value.split(","); if (vals.length > 3) { throw new ElasticsearchParseException("failed to parse [{}], expected 2 or 3 coordinates " + "but found: [{}]", vals.length); } final double lat; final double lon; try { lat = Double.parseDouble(vals[0].trim()); } catch (NumberFormatException ex) { throw new ElasticsearchParseException("latitude must be a number"); } try { lon = Double.parseDouble(vals[1].trim()); } catch (NumberFormatException ex) { throw new ElasticsearchParseException("longitude must be a number"); } if (vals.length > 2) { GeoPoint.assertZValue(ignoreZValue, Double.parseDouble(vals[2].trim())); } return reset(lat, lon); } return resetFromGeoHash(value); }
throw new ElasticsearchParseException("field must be either lat/lon or geohash"); } else { return point.resetFromGeoHash(geohash);
public GeoPoint resetFromString(String value) { int comma = value.indexOf(','); if (comma != -1) { lat = Double.parseDouble(value.substring(0, comma).trim()); lon = Double.parseDouble(value.substring(comma + 1).trim()); } else { resetFromGeoHash(value); } return this; }
public GeoPoint resetFromString(String value) { int comma = value.indexOf(','); if (comma != -1) { lat = Double.parseDouble(value.substring(0, comma).trim()); lon = Double.parseDouble(value.substring(comma + 1).trim()); } else { resetFromGeoHash(value); } return this; }
point.resetLon(parser.doubleValue()); } else if (currentName.equals("geohash")) { point.resetFromGeoHash(parser.text()); } else { throw new ParsingException(parser.getTokenLocation(),
public static GeoPoint fromGeohash(long geohashLong) { return new GeoPoint().resetFromGeoHash(geohashLong); } }
/** Sets the center point for this query. */ public GeoDistanceQueryBuilder geohash(String geohash) { if (Strings.isEmpty(geohash)) { throw new IllegalArgumentException("geohash must not be null or empty"); } this.center.resetFromGeoHash(geohash); return this; }
/** parse a {@link GeoPoint} from a String */ public static GeoPoint parseGeoPoint(String data, GeoPoint point) { int comma = data.indexOf(','); if(comma > 0) { double lat = Double.parseDouble(data.substring(0, comma).trim()); double lon = Double.parseDouble(data.substring(comma + 1).trim()); return point.reset(lat, lon); } else { return point.resetFromGeoHash(data); } }
/** Sets the center point for this query. */ public GeoDistanceQueryBuilder geohash(String geohash) { if (Strings.isEmpty(geohash)) { throw new IllegalArgumentException("geohash must not be null or empty"); } this.center.resetFromGeoHash(geohash); return this; }
/** Sets the center point for this query. */ public GeoDistanceQueryBuilder geohash(String geohash) { if (Strings.isEmpty(geohash)) { throw new IllegalArgumentException("geohash must not be null or empty"); } this.center.resetFromGeoHash(geohash); return this; }
/** parse a {@link GeoPoint} from a String */ public static GeoPoint parseGeoPoint(String data, GeoPoint point) { int comma = data.indexOf(','); if(comma > 0) { double lat = Double.parseDouble(data.substring(0, comma).trim()); double lon = Double.parseDouble(data.substring(comma + 1).trim()); return point.reset(lat, lon); } else { return point.resetFromGeoHash(data); } }
public static GeoPoint fromGeohash(String geohash) { return new GeoPoint().resetFromGeoHash(geohash); }
public static GeoPoint fromGeohash(String geohash) { return new GeoPoint().resetFromGeoHash(geohash); }
/** * Set the point to calculate distances from using its geohash. */ public GeoDistanceBuilder geohash(String geohash) { if (this.point == null) { this.point = new GeoPoint(); } this.point.resetFromGeoHash(geohash); return this; }
private void parsePointFromString(ParseContext context, GeoPoint sparse, String point) throws IOException { if (point.indexOf(',') < 0) { parse(context, sparse.resetFromGeoHash(point), point); } else { parse(context, sparse.resetFromString(point), null); } }
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); }