geohash

package module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 2 Imported by: 0

README

geohash

The library defines data type GeoHash and its "algebra". The actual geo-hashing is derived from geohash-golang.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance added in v0.3.1

func Distance(a, b GeoHash) float64

Approximates distance between GeoHashes

func ToBBox

func ToBBox(hash GeoHash) (n float64, e float64, s float64, w float64)

Converts GeoHash to bounding box

func ToLatLng

func ToLatLng(hash GeoHash) (lat float64, lng float64)

Converts GeoHash to (lat,lng) pair

func Weights

func Weights(hashes GeoHashes, hashNorthEast, hashSouthWest GeoHash) []float64

Calculate "weights" of GeoHashes fitted into the area

Types

type GeoHash

type GeoHash string

GeoHash representation

func EastOf

func EastOf(hash GeoHash) GeoHash

GeoHash to east of given one

func Expand added in v0.3.2

func Expand(hash GeoHash, radius float64) (hashNorthEast, hashSouthWest GeoHash)

func New

func New(lat, lng float64, precision ...Precision) GeoHash

Create new instance of GeoHash from (lat,lng) pair. Optionally, control precision

func NorthOf

func NorthOf(hash GeoHash) GeoHash

GeoHash to north of given one

func Round

func Round(hash GeoHash, precision Precision) GeoHash

Round GeoHash to precision

func SouthOf

func SouthOf(hash GeoHash) GeoHash

GeoHash to south of given one

func ToEast added in v0.3.2

func ToEast(hash GeoHash, n int) (east GeoHash)

func ToNorth added in v0.3.2

func ToNorth(hash GeoHash, n int) (north GeoHash)

func ToSouth added in v0.3.2

func ToSouth(hash GeoHash, n int) (south GeoHash)

func ToWest added in v0.3.2

func ToWest(hash GeoHash, n int) (west GeoHash)

func WestOf

func WestOf(hash GeoHash) GeoHash

GeoHash to west of given one

type GeoHashes

type GeoHashes []GeoHash

Unordered Set of GeoHashes

func GeoHashesIn

func GeoHashesIn(hashNorthEast, hashSouthWest GeoHash) GeoHashes

Calculate all GeoHashes that overlaps with area defined by two points

func Neighbor added in v0.3.2

func Neighbor(hash GeoHash, x, y int) GeoHashes

Extends existing GeoHash by col and row offsets

func Predecessors

func Predecessors(seq GeoHashes) []GeoHashes

Calculates all predecessors (higher rank) GeoHashes from the set.

func ShortestPath added in v0.2.2

func ShortestPath(hashes GeoHashes) (GeoHashes, []float64)

Build shortest path from sequence of hashes

type Precision

type Precision int

Precision of GeoHash

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL