Bounding Unicorns
Fork p/go-geo-grid-search on GitHub

Go Geo Grid Search

Go Geo Grid Search, or ggsearch, is a Go package for performing fast K-closest queries of places on Earth. Given an array of objects that have latitude and longitude, a starting point and the number of desired results K, ggsearch will return K objects closest to the starting point.

Unlike some other libraries, ggsearch does not require a bounding box or any other pre-built index of the objects being queried. Instead ggsearch builds its own sparse grid of the locations and queries it in a spiral fashion starting from the query point.


Review documentation on godoc, or take a look at a simple example.


ggsearch was built for speed. On a t2.micro AWS instance a Web service running ggsearch queried a data set of 40,000 places in 5 ms/request.


ggsearch is built for querying populated areas and as such querying near the poles is not going to produce the right results.


Released under the MIT license.