Documentation ¶
Overview ¶
ggsearch is a package for performing fast K-closest lookups of places on Earth.
The distinguishing feature of ggsearch is that it does not require a bounding box for querying. ggsearch builds a sparse grid index of the places and performs queries by iterating the grid tiles in a spiral fashion.
Example ¶
Here is an example showing how to use ggsearch: https://github.com/p/go-geo-grid-search/tree/master/examples/simple.go
Performance ¶
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.
Caveats ¶
ggsearch is built for querying populated areas and as such querying near the poles is not going to produce the right results.
License ¶
Released under the MIT license.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Locatable ¶
type Locatable interface { // Returns latitude of this object in degrees Lat() float64 // Returns longitude of this object in degrees Lng() float64 }
ggsearch stores and queries objects implementing Locatable interface.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Search result, provides access to the original Locatable object and distance from query point to this object.
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
Searcher maintains the grid index over Locatables in a data set and performs K-closest queries.
func NewSearcher ¶
Creates a new Searcher with the specified number of horizontal and vertical tiles.
func (Searcher) AddLocatable ¶
Adds an object satisfying the Locatable interface to this Searcher.