https://github.com/tidwall/qtree
jeez it's just a quadtree chill out
https://github.com/tidwall/qtree
Last synced: 9 months ago
JSON representation
jeez it's just a quadtree chill out
- Host: GitHub
- URL: https://github.com/tidwall/qtree
- Owner: tidwall
- License: mit
- Created: 2020-02-26T21:34:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-07T17:50:19.000Z (almost 4 years ago)
- Last Synced: 2025-04-05T03:12:29.565Z (9 months ago)
- Language: Go
- Homepage:
- Size: 340 KB
- Stars: 25
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# QTree
[](https://godoc.org/github.com/tidwall/qtree)
This package provides an in-memory quadtree implementation for Go.

## Usage
### Installing
To start using QTree, install Go and run `go get`:
```sh
$ go get -u github.com/tidwall/qtree
```
### Basic operations
```go
// create a QTree
var tr qtree.QTree
// insert a point
tr.Insert([2]float64{-112.0078, 33.4373}, [2]float64{-112.0078, 33.4373}, "PHX")
// insert a box
tr.Insert([2]float64{10, 10}, [2]float64{20, 20}, "rect")
// search
tr.Search([2]float64{-112.1, 33.4}, [2]float64{-112.0, 33.5},
func(min, max [2]float64, value interface{}) bool {
println(value.(string)) // prints "PHX"
},
)
// delete
tr.Delete([2]float64{-112.0078, 33.4373}, [2]float64{-112.0078, 33.4373}, "PHX")
```
## Performance
Pretty, pretty, pretty good.
## License
`qtree` source code is available under the MIT License.