コード例 #1
0
ファイル: geo_test.go プロジェクト: Taik/geo-benchmark
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
ファイル: geo.go プロジェクト: Taik/geo-benchmark
// 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
ファイル: geo_test.go プロジェクト: Taik/geo-benchmark
func TestCellUnionIntersection(t *testing.T) {
	cells := geo.CellUnionFromLatLong(points)
	cells.IntersectsCellID(s2.CellIDFromLatLng(center))
}
コード例 #4
0
ファイル: geo_test.go プロジェクト: Taik/geo-benchmark
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)))
}