maptile/main.go

63 lines
1.1 KiB
Go
Executable File

package main
import (
"path/filepath"
"git.zhouxhere.com/zhouxhere/maptile/bin"
"git.zhouxhere.com/zhouxhere/maptile/util/fontnik"
"git.zhouxhere.com/zhouxhere/maptile/util/mbtiles"
"git.zhouxhere.com/zhouxhere/maptile/util/sprite"
)
// Protobuf 定义需提前通过 protoc 生成 Go 代码
//go:generate protoc --go_out=. --go_opt=paths=source_relative ./protobuf/*.proto
func main() {
bin.RunCMD()
// testSprite()
// testFont()
// testMBtiles()
}
func testSprite() {
filePath, err := filepath.Abs("icons/")
if err != nil {
panic(err)
}
spriteBuilder, err := sprite.NewSpriteBuilder(filePath, "style/sprite")
if err != nil {
panic(err)
}
spriteBuilder.Build()
}
func testFont() {
filePath, err := filepath.Abs("fonts/")
if err != nil {
panic(err)
}
fonts, err := fontnik.NewFontnik(filePath, "style/font")
if err != nil {
panic(err)
}
fonts.ToPBF()
}
func testMBtiles() {
filePath, err := filepath.Abs("mbtiles/")
if err != nil {
panic(err)
}
mbtiles, err := mbtiles.New(filepath.Join(filePath, "world_cities.mbtiles"))
if err != nil {
panic(err)
}
mbtiles.GetTile(6, 38, 33)
}