Ejemplo n.º 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())
}
Ejemplo n.º 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
}
Ejemplo n.º 3
0
func TestCellUnionIntersection(t *testing.T) {
	cells := geo.CellUnionFromLatLong(points)
	cells.IntersectsCellID(s2.CellIDFromLatLng(center))
}
Ejemplo n.º 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)))
}