Documentation ¶
Overview ¶
Package geohash provides encoding and decoding of string and integer geohashes.
Index ¶
- Constants
- func DecodeCenter(hash string) (lat, lng float64)
- func DecodeInt(hash uint64) (lat, lng float64)
- func DecodeIntWithPrecision(hash uint64, bits uint) (lat, lng float64)
- func Encode(lat, lng float64) string
- func EncodeInt(lat, lng float64) uint64
- func EncodeIntWithPrecision(lat, lng float64, bits uint) uint64
- func EncodeWithPrecision(lat, lng float64, chars uint) string
- func Neighbor(hash string, direction Direction) string
- func NeighborInt(hash uint64, direction Direction) uint64
- func NeighborIntWithPrecision(hash uint64, bits uint, direction Direction) uint64
- func Neighbors(hash string) []string
- func NeighborsInt(hash uint64) []uint64
- func NeighborsIntWithPrecision(hash uint64, bits uint) []uint64
- type Box
- type Direction
Constants ¶
const ( ENC_LAT = 85.05112878 ENC_LONG = 180.0 )
Variables ¶
This section is empty.
Functions ¶
func DecodeCenter ¶
DecodeCenter decodes the string geohash to the central point of the bounding box.
func DecodeIntWithPrecision ¶
DecodeIntWithPrecision decodes the provided integer geohash with bits of precision to a (lat, lng) point.
func Encode ¶
Encode the point (lat, lng) as a string geohash with the standard 12 characters of precision.
func EncodeInt ¶
encodeInt provides a Go implementation of integer geohash. This is the default implementation of EncodeInt, but optimized versions are provided for certain architectures.
func EncodeIntWithPrecision ¶
EncodeIntWithPrecision encodes the point (lat, lng) to an integer with the specified number of bits.
func EncodeWithPrecision ¶
EncodeWithPrecision encodes the point (lat, lng) as a string geohash with the specified number of characters of precision (max 12).
func Neighbor ¶
Neighbor returns a geohash string that corresponds to the provided geohash's neighbor in the provided direction
func NeighborInt ¶
NeighborInt returns a uint64 that corresponds to the provided hash's neighbor in the provided direction at 64-bit precision.
func NeighborIntWithPrecision ¶
NeighborIntWithPrecision returns a uint64s that corresponds to the provided hash's neighbor in the provided direction at the given precision.
func Neighbors ¶
Neighbors returns a slice of geohash strings that correspond to the provided geohash's neighbors.
func NeighborsInt ¶
NeighborsInt returns a slice of uint64s that correspond to the provided hash's neighbors at 64-bit precision.
func NeighborsIntWithPrecision ¶
NeighborsIntWithPrecision returns a slice of uint64s that correspond to the provided hash's neighbors at the given precision.
Types ¶
type Box ¶
Box represents a rectangle in latitude/longitude space.
func BoundingBox ¶
BoundingBox returns the region encoded by the given string geohash.
func BoundingBoxInt ¶
BoundingBoxInt returns the region encoded by the given 64-bit integer geohash.
func BoundingBoxIntWithPrecision ¶
BoundingBoxIntWithPrecision returns the region encoded by the integer geohash with the specified precision.