func BenchmarkCellIDFromLatLong(b *testing.B) { var cell s2.CellID for i := 0; i < b.N; i++ { cell = s2.CellIDFromLatLng(center) } fmt.Printf("%v", cell.ToToken()) }
// CellUnionFromLatLong returns a normalized CellUnion. func CellUnionFromLatLong(points []s2.LatLng) s2.CellUnion { cells := s2.CellUnion{} for _, point := range points { cells = append(cells, s2.CellIDFromLatLng(point)) } cells.Normalize() return cells }
func TestCellUnionIntersection(t *testing.T) { cells := geo.CellUnionFromLatLong(points) cells.IntersectsCellID(s2.CellIDFromLatLng(center)) }
func TestCellUnionFromLatLong(t *testing.T) { cells := geo.CellUnionFromLatLong(points) assert.True(t, cells.ContainsCellID(s2.CellIDFromLatLng(topLeft))) assert.True(t, cells.ContainsCellID(s2.CellIDFromLatLng(bottomRight))) }