https://github.com/umpc/go-zrange
This package implements an efficient algorithm for performing spatial range queries with geohash-encoded keys and a search radius.
https://github.com/umpc/go-zrange
Last synced: 3 months ago
JSON representation
This package implements an efficient algorithm for performing spatial range queries with geohash-encoded keys and a search radius.
- Host: GitHub
- URL: https://github.com/umpc/go-zrange
- Owner: umpc
- License: isc
- Created: 2018-05-26T12:34:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-28T23:41:26.000Z (about 8 years ago)
- Last Synced: 2024-06-20T05:10:43.153Z (almost 2 years ago)
- Language: Go
- Size: 10.7 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-zrange
[](https://godoc.org/github.com/umpc/go-zrange)
[](https://goreportcard.com/report/github.com/umpc/go-zrange)
```sh
go get -u github.com/umpc/go-zrange
```
Package `zrange` implements an efficient algorithm for performing geospatial range queries with Geohash-encoded keys and a search radius.
The `RadialRange` method appears to be sufficient for range queries of around 5,000km or less. Changes that efficiently add support for larger query ranges are welcome.
## Example usage
```go
...
rangeParams := zrange.RadialRangeParams{
Radius: 32.18688,
Latitude: 37.334722,
Longitude: -122.008889,
}
keyRanges := rangeParams.RadialRange()
...
```
**Note:** Geohash range searches are imprecise. Results should be filtered using the input radius where precision is desired.
## References
* The `RadialRange` method was inspired by the algorithm in the "Search" section of [this page](https://web.archive.org/web/20180526044934/https://github.com/yinqiwen/ardb/wiki/Spatial-Index#search).