@Test public void testSimpleWithin() { GeoHash hash = GeoHash.withBitPrecision(70, -120, 8); GeoHash inside = GeoHash.withBitPrecision(74, -130, 64); assertWithin(inside, hash); }
public static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits) { if (Math.abs(latitude) > 90.0 || Math.abs(longitude) > 180.0) { throw new IllegalArgumentException("Can't have lat/lon values out of (-90,90)/(-180/180)"); } return new GeoHash(latitude, longitude, numberOfBits); }
GeoHash implements Comparable<GeoHash>, Serializable { public static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits) { if (Math.abs(latitude) > 90.0 || Math.abs(longitude) > 180.0) { throw new IllegalArgumentException("Can't have lat/lon values out of (-90,90)/(-180/180)"); } return new GeoHash(latitude, longitude, numberOfBits); } }
GeoHash implements Comparable<GeoHash>, Serializable { public static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits) { if (Math.abs(latitude) > 90.0 || Math.abs(longitude) > 180.0) { throw new IllegalArgumentException("Can't have lat/lon values out of (-90,90)/(-180/180)"); } return new GeoHash(latitude, longitude, numberOfBits); } protected  GeoHash(); private  GeoHash(double latitude, double longitude, int desiredPrecision); }
GeoHash implements Comparable<GeoHash>, Serializable { public static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits) { if (Math.abs(latitude) > 90.0 || Math.abs(longitude) > 180.0) { throw new IllegalArgumentException("Can't have lat/lon values out of (-90,90)/(-180/180)"); } return new GeoHash(latitude, longitude, numberOfBits); } protected  GeoHash(); private  GeoHash(double latitude, double longitude, int desiredPrecision); static void main(String[] args); static int getBitsToShift(int b1, int b2); static GeoHash withUnprecisionOfDistanceInMeter(double centerLat, double centerLong, double distanceInMeter); static GeoHash withCharacterPrecision(double latitude, double longitude, int numberOfCharacters); static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits); static GeoHash fromBinaryString(String binaryString); static GeoHash fromGeohashString(String geohash); static GeoHash fromIntValue(int hashVal); static GeoHash fromLongValue(long hashVal, int significantBits); GeoHash next(int step); GeoHash next(); GeoHash prev(); long ord(); static GeoHash fromOrd(long ord, int significantBits); static long stepsBetween(GeoHash one, GeoHash two); GeoHash[] getAdjacent(); int significantBits(); long longValue(); int intValue(); String toBase32(); boolean within(GeoHash boundingBox); boolean contains(WGS84Point point); WGS84Point getPoint(); WGS84Point getBoundingBoxCenterPoint(); BoundingBox getBoundingBox(); boolean enclosesCircleAroundPoint(WGS84Point point, double radius); GeoHash getNorthernNeighbour(); GeoHash getSouthernNeighbour(); GeoHash getEasternNeighbour(); GeoHash getWesternNeighbour(); @Override String toString(); String toBinaryString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(GeoHash o); static double distFromInMeter(double lat1, double lng1, double lat2, double lng2); }
GeoHash implements Comparable<GeoHash>, Serializable { public static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits) { if (Math.abs(latitude) > 90.0 || Math.abs(longitude) > 180.0) { throw new IllegalArgumentException("Can't have lat/lon values out of (-90,90)/(-180/180)"); } return new GeoHash(latitude, longitude, numberOfBits); } protected  GeoHash(); private  GeoHash(double latitude, double longitude, int desiredPrecision); static void main(String[] args); static int getBitsToShift(int b1, int b2); static GeoHash withUnprecisionOfDistanceInMeter(double centerLat, double centerLong, double distanceInMeter); static GeoHash withCharacterPrecision(double latitude, double longitude, int numberOfCharacters); static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits); static GeoHash fromBinaryString(String binaryString); static GeoHash fromGeohashString(String geohash); static GeoHash fromIntValue(int hashVal); static GeoHash fromLongValue(long hashVal, int significantBits); GeoHash next(int step); GeoHash next(); GeoHash prev(); long ord(); static GeoHash fromOrd(long ord, int significantBits); static long stepsBetween(GeoHash one, GeoHash two); GeoHash[] getAdjacent(); int significantBits(); long longValue(); int intValue(); String toBase32(); boolean within(GeoHash boundingBox); boolean contains(WGS84Point point); WGS84Point getPoint(); WGS84Point getBoundingBoxCenterPoint(); BoundingBox getBoundingBox(); boolean enclosesCircleAroundPoint(WGS84Point point, double radius); GeoHash getNorthernNeighbour(); GeoHash getSouthernNeighbour(); GeoHash getEasternNeighbour(); GeoHash getWesternNeighbour(); @Override String toString(); String toBinaryString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(GeoHash o); static double distFromInMeter(double lat1, double lng1, double lat2, double lng2); static final long FIRST_BIT_FLAGGED; }