insidetree

A tree datastructure to store s2 cells and perform fast point in polygons lookup

BSD-3-CLAUSE License

Stars
6

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

It's an alternative of using an interval tree like in this other project exposed in this blogpost.

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"