{"id":16933008,"url":"https://github.com/mmcloughlin/geohash","last_synced_at":"2025-05-15T12:02:39.663Z","repository":{"id":34884738,"uuid":"38902636","full_name":"mmcloughlin/geohash","owner":"mmcloughlin","description":"Golang geohash library","archived":false,"fork":false,"pushed_at":"2024-02-09T19:20:56.000Z","size":397,"stargazers_count":552,"open_issues_count":4,"forks_count":47,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-15T12:02:36.737Z","etag":null,"topics":["geohash","go","golang"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/mmcloughlin/geohash","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmcloughlin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-10T21:21:20.000Z","updated_at":"2025-04-26T14:39:10.000Z","dependencies_parsed_at":"2024-02-09T20:39:47.848Z","dependency_job_id":null,"html_url":"https://github.com/mmcloughlin/geohash","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcloughlin%2Fgeohash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcloughlin%2Fgeohash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcloughlin%2Fgeohash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcloughlin%2Fgeohash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmcloughlin","download_url":"https://codeload.github.com/mmcloughlin/geohash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geohash","go","golang"],"created_at":"2024-10-13T20:48:17.052Z","updated_at":"2025-05-15T12:02:39.634Z","avatar_url":"https://github.com/mmcloughlin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# geohash\n\nGo [geohash](https://en.wikipedia.org/wiki/Geohash) library offering encoding\nand decoding for string and integer geohashes.\n\n[![go.dev Reference](https://img.shields.io/badge/doc-reference-007d9b?logo=go\u0026style=flat-square)](https://pkg.go.dev/github.com/mmcloughlin/geohash)\n![Build status](https://img.shields.io/github/actions/workflow/status/mmcloughlin/geohash/ci.yml?style=flat-square)\n[![Coverage](https://img.shields.io/codecov/c/github/mmcloughlin/geohash?style=flat-square)](https://codecov.io/github/mmcloughlin/geohash)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mmcloughlin/geohash?style=flat-square)](https://goreportcard.com/report/github.com/mmcloughlin/geohash)\n\n## Install\n\nFetch the package with\n\n```\ngo get github.com/mmcloughlin/geohash\n```\n\nAnd import it into your programs with\n\n```go\nimport \"github.com/mmcloughlin/geohash\"\n```\n\n## Usage\n\n#### func  ConvertIntToString\n\n```go\nfunc ConvertIntToString(hash uint64, chars uint) string\n```\nConvertIntToString converts an integer geohash to the equivalent string geohash\nwith chars characters. The provided integer geohash is interpreted to have\n5*chars bits of precision.\n\n#### func  ConvertStringToInt\n\n```go\nfunc ConvertStringToInt(hash string) (uint64, uint)\n```\nConvertStringToInt converts a string geohash to the equivalent integer geohash.\nReturns the integer hash and its precision.\n\n#### func  Decode\n\n```go\nfunc Decode(hash string) (lat, lng float64)\n```\nDecode the string geohash to a (lat, lng) point.\n\n#### func  DecodeCenter\n\n```go\nfunc DecodeCenter(hash string) (lat, lng float64)\n```\nDecodeCenter decodes the string geohash to the central point of the bounding\nbox.\n\n#### func  DecodeInt\n\n```go\nfunc DecodeInt(hash uint64) (lat, lng float64)\n```\nDecodeInt decodes the provided 64-bit integer geohash to a (lat, lng) point.\n\n#### func  DecodeIntWithPrecision\n\n```go\nfunc DecodeIntWithPrecision(hash uint64, bits uint) (lat, lng float64)\n```\nDecodeIntWithPrecision decodes the provided integer geohash with bits of\nprecision to a (lat, lng) point.\n\n#### func  Encode\n\n```go\nfunc Encode(lat, lng float64) string\n```\nEncode the point (lat, lng) as a string geohash with the standard 12 characters\nof precision.\n\n#### func  EncodeInt\n\n```go\nfunc EncodeInt(lat, lng float64) uint64\n```\nEncodeInt encodes the point (lat, lng) to a 64-bit integer geohash.\n\n#### func  EncodeIntWithPrecision\n\n```go\nfunc EncodeIntWithPrecision(lat, lng float64, bits uint) uint64\n```\nEncodeIntWithPrecision encodes the point (lat, lng) to an integer with the\nspecified number of bits.\n\n#### func  EncodeWithPrecision\n\n```go\nfunc EncodeWithPrecision(lat, lng float64, chars uint) string\n```\nEncodeWithPrecision encodes the point (lat, lng) as a string geohash with the\nspecified number of characters of precision (max 12).\n\n#### func  Neighbor\n\n```go\nfunc Neighbor(hash string, direction Direction) string\n```\nNeighbor returns a geohash string that corresponds to the provided geohash's\nneighbor in the provided direction\n\n#### func  NeighborInt\n\n```go\nfunc NeighborInt(hash uint64, direction Direction) uint64\n```\nNeighborInt returns a uint64 that corresponds to the provided hash's neighbor in\nthe provided direction at 64-bit precision.\n\n#### func  NeighborIntWithPrecision\n\n```go\nfunc NeighborIntWithPrecision(hash uint64, bits uint, direction Direction) uint64\n```\nNeighborIntWithPrecision returns a uint64s that corresponds to the provided\nhash's neighbor in the provided direction at the given precision.\n\n#### func  Neighbors\n\n```go\nfunc Neighbors(hash string) []string\n```\nNeighbors returns a slice of geohash strings that correspond to the provided\ngeohash's neighbors.\n\n#### func  NeighborsInt\n\n```go\nfunc NeighborsInt(hash uint64) []uint64\n```\nNeighborsInt returns a slice of uint64s that correspond to the provided hash's\nneighbors at 64-bit precision.\n\n#### func  NeighborsIntWithPrecision\n\n```go\nfunc NeighborsIntWithPrecision(hash uint64, bits uint) []uint64\n```\nNeighborsIntWithPrecision returns a slice of uint64s that correspond to the\nprovided hash's neighbors at the given precision.\n\n#### func  Validate\n\n```go\nfunc Validate(hash string) error\n```\nValidate the string geohash.\n\n#### type Box\n\n```go\ntype Box struct {\n\tMinLat float64\n\tMaxLat float64\n\tMinLng float64\n\tMaxLng float64\n}\n```\n\nBox represents a rectangle in latitude/longitude space.\n\n#### func  BoundingBox\n\n```go\nfunc BoundingBox(hash string) Box\n```\nBoundingBox returns the region encoded by the given string geohash.\n\n#### func  BoundingBoxInt\n\n```go\nfunc BoundingBoxInt(hash uint64) Box\n```\nBoundingBoxInt returns the region encoded by the given 64-bit integer geohash.\n\n#### func  BoundingBoxIntWithPrecision\n\n```go\nfunc BoundingBoxIntWithPrecision(hash uint64, bits uint) Box\n```\nBoundingBoxIntWithPrecision returns the region encoded by the integer geohash\nwith the specified precision.\n\n#### func (Box) Center\n\n```go\nfunc (b Box) Center() (lat, lng float64)\n```\nCenter returns the center of the box.\n\n#### func (Box) Contains\n\n```go\nfunc (b Box) Contains(lat, lng float64) bool\n```\nContains decides whether (lat, lng) is contained in the box. The containment\ntest is inclusive of the edges and corners.\n\n#### func (Box) Round\n\n```go\nfunc (b Box) Round() (lat, lng float64)\n```\nRound returns a point inside the box, making an effort to round to minimal\nprecision.\n\n#### type Direction\n\n```go\ntype Direction int\n```\n\nDirection represents directions in the latitute/longitude space.\n\n```go\nconst (\n\tNorth Direction = iota\n\tNorthEast\n\tEast\n\tSouthEast\n\tSouth\n\tSouthWest\n\tWest\n\tNorthWest\n)\n```\nCardinal and intercardinal directions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmcloughlin%2Fgeohash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmcloughlin%2Fgeohash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmcloughlin%2Fgeohash/lists"}