com.pb.lisdk.grid.geohash

## Class GeoHash

- java.lang.Object
- - com.pb.lisdk.grid.geohash.GeoHash

All Implemented Interfaces:
  IGridCell, IHierarchicalGridCell, Serializable

    public final class GeoHash
    extends Object
    implements IHierarchicalGridCell, Serializable

A geohash is a mechanism for bucketing a geographic area (-180, -90, 180, 90) with various levels of precision.

### Examples

Determine the hash for the rectangle containing the point (-73.700052, 42.678120) with a precision of 10 characters

              String hash = GeoHash.encode(-73.700052, 42.678120, 10).getHash();

Determine the bounds of the hash "dredfcm606"

              Envelope bounds = GeoHash.decode("dredfcm606").getBounds();

See Also:
  Serialized Form

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`IFeatureGeometry` `asFeatureGeometry()` Get the cell boundary as a geometry
`static GeoHash` `decode(long bits, int significantBits)` Determine the geohash for the specified set of bits.
`static GeoHash` `decode(String hash)` Determine the geohash for the specified well-known string ID.
`static List` `encode(double minX, double minY, double maxX, double maxY, int precision)` Get a list of GeoHashes that cover a rectangle at the specified precision.
`static GeoHash` `encode(double longitude, double latitude, int precision)` Determine the cell that contains the specified point at the specified precision.
`boolean` `equals(Object o)`
`long` `getBits()`
`Envelope` `getBounds()` Get the bounds of the grid cell.
`List` `getChildren()` Get the children of the current cell.
`String` `getHash()` Get the well-known string ID for the hash.
`int` `hashCode()`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getBits

    public long getBits()

#### getHash

    public String getHash()

Get the well-known string ID for the hash.

Specified by:
  `getHash` in interface `IGridCell`

#### getBounds

    public Envelope getBounds()

Get the bounds of the grid cell.

Specified by:
  `getBounds` in interface `IGridCell`

#### asFeatureGeometry

    public IFeatureGeometry asFeatureGeometry()

Description copied from interface: `IGridCell`
Get the cell boundary as a geometry

Specified by:
  `asFeatureGeometry` in interface `IGridCell`

#### getChildren

    public List getChildren()

Description copied from interface: `IHierarchicalGridCell`
Get the children of the current cell. The union of the children should coincide with the area of this cell.

Specified by:
  `getChildren` in interface `IHierarchicalGridCell`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### encode

    public static GeoHash encode(double longitude,
                                 double latitude,
                                 int precision)

Determine the cell that contains the specified point at the specified precision.

Parameters:
  `longitude` - The longitude value for the specified point.
  `latitude` - The latitude value for the specified point.
  `precision` - The length of the string key to be returned. The longer the string, the higher the precision (i.e. smaller the rectangle).

#### decode

    public static GeoHash decode(String hash)

Determine the geohash for the specified well-known string ID.

Parameters:
  `hash` - The well-known string ID.
Returns:
  A representation of the geohash.

#### decode

    public static GeoHash decode(long bits,
                                 int significantBits)

Determine the geohash for the specified set of bits.

Parameters:
  `bits` - The bits that represent the geohash.
  `significantBits` - The number of bits that represent the geohash. This must be a multiple of 5.
Returns:
  A representation of the geohash.

#### encode

    public static List encode(double minX,
                              double minY,
                              double maxX,
                              double maxY,
                              int precision)

Get a list of GeoHashes that cover a rectangle at the specified precision.

Parameters:
  `minX` - The x value of the lower-left corner to cover.
  `minY` - The y value of the lower-left corner to cover.
  `maxX` - The x value of the upper-right corner to cover.
  `maxY` - The y value of the upper-right corner to cover.
  `precision` - The length of the string key to be returned. The longer the string, the higher the precision (i.e. smaller the rectangle).