Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akhenakh/insidetree
A tree datastructure to store s2 cells and perform fast point in polygons lookup
https://github.com/akhenakh/insidetree
datastructure geo go s2 spatial
Last synced: 24 days ago
JSON representation
A tree datastructure to store s2 cells and perform fast point in polygons lookup
- Host: GitHub
- URL: https://github.com/akhenakh/insidetree
- Owner: akhenakh
- License: bsd-3-clause
- Created: 2018-08-10T16:21:25.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-17T16:24:39.000Z (almost 5 years ago)
- Last Synced: 2024-06-21T20:10:23.803Z (5 months ago)
- Topics: datastructure, geo, go, s2, spatial
- Language: Go
- Size: 494 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://cloud.drone.io/api/badges/akhenakh/insidetree/status.svg)](https://cloud.drone.io/akhenakh/insidetree)
insidetree
==========This datastructure is specialized in indexing S2 cells to perform stab queries (Point in Polygons).
For explanations about s2 and the tree used in this package look at this [great blogpost](https://blog.zen.ly/geospatial-indexing-on-hilbert-curves-2379b929addc)
It's an alternative of using an interval tree like [in this other project](https://github.com/akhenakh/regionagogo) exposed [in this blogpost](https://blog.nobugware.com/post/2016/geo_db_s2_region_polygon/).
```go
tree := NewTree()// index you cells using Index()
tree.Index(cell, "Red building")// test for cell of any levels
insideCell := s2.CellIDFromLatLng(s2.LatLngFromDegrees(46.83808, -71.28046))
results := tree.Stab(insideCell)
// results[0] == "Red Building"
```