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.
...
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.
- The
RadialRange
method was inspired by the algorithm in the "Search" section of this page.