feat: 新增更多地图瓦片的下载,用于优化地图显示

This commit is contained in:
yarnom 2025-10-14 18:22:32 +08:00
parent 93a94c3149
commit bc7443ca8b

View File

@ -370,13 +370,27 @@ func runTilesFromNMC(ctx context.Context, opts Options) error {
dateStr := local.Format("20060102") dateStr := local.Format("20060102")
hh := local.Format("15") hh := local.Format("15")
mm := local.Format("04") mm := local.Format("04")
// Prepare tile list: primary (opts or default Nanning) + Guangzhou (7/40/104) + Wuhan (7/42/104) // Prepare tile list: primary (opts or default Nanning) + a few defaults + optional config aliases
z, y, x := opts.Z, opts.Y, opts.X z, y, x := opts.Z, opts.Y, opts.X
if z == 0 && y == 0 && x == 0 { if z == 0 && y == 0 && x == 0 {
z, y, x = 7, 40, 102 z, y, x = 7, 40, 102
} }
type tcoord struct{ z, y, x int } type tcoord struct{ z, y, x int }
tiles := []tcoord{{z, y, x}, {7, 40, 104}, {7, 42, 104}} tiles := []tcoord{
{z, y, x}, // primary
{7, 40, 104},
{7, 42, 104},
{7, 40, 103},
{7, 39, 102},
}
// Append from config aliases, if present (dedup later)
if cfg := config.GetConfig(); cfg != nil {
for _, a := range cfg.Radar.Aliases {
if a.Z > 0 {
tiles = append(tiles, tcoord{a.Z, a.Y, a.X})
}
}
}
// de-duplicate if same // de-duplicate if same
seen := map[string]bool{} seen := map[string]bool{}
for _, tc := range tiles { for _, tc := range tiles {