Documentation ¶
Overview ¶
A library for efficiently storing and querying spatial data.
Index ¶
- Constants
- type DistError
- type Point
- type Rect
- type Rtree
- func (tree *Rtree) Delete(obj Spatial) bool
- func (tree *Rtree) Depth() int
- func (tree *Rtree) Insert(obj Spatial)
- func (tree *Rtree) NearestNeighbor(p Point) Spatial
- func (tree *Rtree) NearestNeighbors(k int, p Point) []Spatial
- func (tree *Rtree) SearchIntersect(bb *Rect) []Spatial
- func (tree *Rtree) Size() int
- func (tree *Rtree) String() string
- type Spatial
Constants ¶
const Dim = 2
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistError ¶
type DistError float64
DistError is an improper distance measurement. It implements the error and is generated when a distance-related assertion fails.
type Rect ¶
type Rect struct {
// contains filtered or unexported fields
}
Rect represents a subset of 3-dimensional Euclidean space of the form [a1, b1] x [a2, b2] x ... x [an, bn], where ai < bi for all 1 <= i <= n.
type Rtree ¶
Rtree represents an R-tree, a balanced search tree for storing and querying spatial objects. MinChildren/MaxChildren specify the minimum/maximum branching factors.
func (*Rtree) Delete ¶
Delete removes an object from the tree. If the object is not found, ok is false; otherwise ok is true.
Implemented per Section 3.3 of "R-trees: A Dynamic Index Structure for Spatial Searching" by A. Guttman, Proceedings of ACM SIGMOD, p. 47-57, 1984.
func (*Rtree) Insert ¶
Insert inserts a spatial object into the tree. If insertion causes a leaf node to overflow, the tree is rebalanced automatically.
Implemented per Section 3.2 of "R-trees: A Dynamic Index Structure for Spatial Searching" by A. Guttman, Proceedings of ACM SIGMOD, p. 47-57, 1984.
func (*Rtree) NearestNeighbor ¶
NearestNeighbor returns the closest object to the specified point. Implemented per "Nearest Neighbor Queries" by Roussopoulos et al
func (*Rtree) SearchIntersect ¶
SearchIntersectBB returns all objects that intersect the specified rectangle.
Implemented per Section 3.1 of "R-trees: A Dynamic Index Structure for Spatial Searching" by A. Guttman, Proceedings of ACM SIGMOD, p. 47-57, 1984.