func cellUnionArea(cu s2.CellUnion) float64 { var area float64 for _, c := range cu { cell := s2.CellFromCellID(c) area += cell.ExactArea() } return area }
func printCells(cu s2.CellUnion) { for _, c := range cu { cell := s2.CellFromCellID(c) area := EarthArea(cell.ExactArea()) r := cell.RectBound() top := r.Vertex(0).Distance(r.Vertex(1)) side := r.Vertex(1).Distance(r.Vertex(2)) fmt.Printf("Level: %d, Cell: %s, area: %s, boundary: %s x %s\n", c.Level(), c.ToToken(), area, EarthDistance(top), EarthDistance(side)) } }