-
Notifications
You must be signed in to change notification settings - Fork 23
/
parse.go
69 lines (56 loc) · 1.99 KB
/
parse.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
import (
"flag"
)
// MapConfig map config struct
type MapConfig struct {
// GoroutineNum concurrency num
GoroutineNum int
// SavePath map save root path
SavePath string
// Combine put same level map together
Combine bool
// QPS query file speed per second
QPS int
// Map
// LeftLongitude left longitude
LeftLongitude float64
// RightLongitude right longitude
RightLongitude float64
// TopLatitude top latitude
TopLatitude float64
// BottomLatitude bottom latitude
BottomLatitude float64
// MinLevel map min level
MinLevel int
// MaxLevel map max level
MaxLevel int
// MapType only in GoogleSatellite / GoogleImage / GoogleTerrain / AMapSatellite / AMapCover / AMapImage
MapType string
// GoogleWithLabel only effect when the MapType is GoogleSatellite / GoogleImage / GoogleTerrain
GoogleWithLabel bool
// Retry
// MaxRetryNum max retry num
MaxRetryNum int
}
// parseMapConfig 解析配置
func parseMapConfig() MapConfig {
conf := MapConfig{}
// parse rule
flag.StringVar(&conf.SavePath, "p", "/tmp", "map save path")
flag.IntVar(&conf.GoroutineNum, "g", 50, "goroutine nums")
flag.BoolVar(&conf.Combine, "c", true, "combine same level map together")
flag.IntVar(&conf.QPS, "q", 500, "query file per second number")
flag.Float64Var(&conf.LeftLongitude, "l", 0, "left longitude")
flag.Float64Var(&conf.RightLongitude, "r", 0, "right longitude")
flag.Float64Var(&conf.TopLatitude, "t", 0, "top latitude")
flag.Float64Var(&conf.BottomLatitude, "b", 0, "bottom latitude")
flag.IntVar(&conf.MinLevel, "min", 1, "map min level")
flag.IntVar(&conf.MaxLevel, "max", 3, "map max level")
flag.StringVar(&conf.MapType, "type", "GoogleSatellite", "map type (GoogleSatellite/GoogleImage/GoogleTerrain/AMapSatellite/AMapCover/AMapImage)")
flag.BoolVar(&conf.GoogleWithLabel, "google-label", true, "only effect when the map type is GoogleSatellite / GoogleImage / GoogleTerrain")
flag.IntVar(&conf.MaxRetryNum, "retry", 3, "max retry num")
// parse
flag.Parse()
return conf
}