Example #1
0
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())
}
Example #2
0
// 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
}
Example #3
0
func TestCellUnionIntersection(t *testing.T) {
	cells := geo.CellUnionFromLatLong(points)
	cells.IntersectsCellID(s2.CellIDFromLatLng(center))
}
Example #4
0
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)))
}