-
Notifications
You must be signed in to change notification settings - Fork 38
/
tile.go
54 lines (43 loc) · 859 Bytes
/
tile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"math"
"sync"
"github.com/paulmach/orb"
"github.com/paulmach/orb/maptile"
)
//TileSize 默认瓦片大小
const TileSize = 256
//ZoomMin 最小级别
const ZoomMin = 0
//ZoomMax 最大级别
const ZoomMax = 20
//Tile 自定义瓦片存储
type Tile struct {
T maptile.Tile
C []byte
}
func (tile Tile) flipY() uint32 {
zpower := math.Pow(2.0, float64(tile.T.Z))
return uint32(zpower) - 1 - tile.T.Y
}
//Set a safety set
type Set struct {
sync.RWMutex
M maptile.Set
}
//Layer 级别&瓦片数
type Layer struct {
URL string
Zoom int
Count int64
Collection orb.Collection
}
// Constants representing TileFormat types
const (
GZIP string = "gzip" // encoding = gzip
ZLIB = "zlib" // encoding = deflate
PNG = "png"
JPG = "jpg"
PBF = "pbf"
WEBP = "webp"
)