Skip to content

Commit

Permalink
count each tile contents only once
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Aug 29, 2023
1 parent 61648a9 commit 3d317e9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pmtiles/stats.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pmtiles

import (
"github.com/RoaringBitmap/roaring/roaring64"
"bytes"
"context"
"fmt"
Expand Down Expand Up @@ -71,7 +72,15 @@ func Stats(logger *log.Logger, bucketURL string, file string) error {
zoom_levels := make([]int, 0)
stats := make(map[uint8][]int)

offset_set := roaring64.New()

for _, entry := range total_entries {
// count each tile contents only once.

if offset_set.Contains(entry.Offset) {
continue
}
offset_set.Add(entry.Offset)
z, _, _ := IdToZxy(entry.TileId)
if _, ok := stats[z]; !ok {
stats[z] = make([]int, 0)
Expand Down

0 comments on commit 3d317e9

Please sign in to comment.