Пример #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())
}
Пример #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
}
Пример #3
0
func TestCellUnionIntersection(t *testing.T) {
	cells := geo.CellUnionFromLatLong(points)
	cells.IntersectsCellID(s2.CellIDFromLatLng(center))
}
Пример #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)))
}