• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-spatial / tegola / 4480992c4-PR-1034

11 Mar 2025 08:24PM UTC coverage: 40.721% (-2.1%) from 42.815%
4480992c4-PR-1034

Pull #1034

github

ARolek
fix non-constant format string calls to XXXfwq
Pull Request #1034: Bump Go to 1.24.1

0 of 4 new or added lines in 2 files covered. (0.0%)

344 existing lines in 25 files now uncovered.

6690 of 16429 relevant lines covered (40.72%)

214.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/provider/debug/debug.go
1
// The debug provider returns features that are helpful for debugging a tile
2
// including a box for the tile edges and a point in the middle of the tile
3
// with z,x,y values encoded
4
package debug
5

6
import (
7
        "context"
8
        "fmt"
9
        "strings"
10

11
        "github.com/go-spatial/geom"
12
        "github.com/go-spatial/tegola"
13
        "github.com/go-spatial/tegola/dict"
14
        "github.com/go-spatial/tegola/provider"
15
)
16

17
const Name = "debug"
18

19
const (
20
        LayerDebugTileOutline = "debug-tile-outline"
21
        LayerDebugTileCenter  = "debug-tile-center"
22
)
23

UNCOV
24
func init() {
×
UNCOV
25
        provider.Register(provider.TypeStd.Prefix()+Name, NewTileProvider, nil)
×
UNCOV
26
}
×
27

28
// NewProvider Setups a debug provider. there are not currently any config params supported
UNCOV
29
func NewTileProvider(config dict.Dicter, maps []provider.Map) (provider.Tiler, error) {
×
UNCOV
30
        return &Provider{}, nil
×
UNCOV
31
}
×
32

33
// Provider provides the debug provider
34
type Provider struct{}
35

UNCOV
36
func (p *Provider) TileFeatures(ctx context.Context, layer string, tile provider.Tile, queryParams provider.Params, fn func(f *provider.Feature) error) error {
×
UNCOV
37

×
UNCOV
38
        // get tile bounding box
×
UNCOV
39
        ext, srid := tile.Extent()
×
UNCOV
40

×
UNCOV
41
        params := make([]string, 0, len(queryParams))
×
UNCOV
42
        for _, param := range queryParams {
×
43
                params = append(params, fmt.Sprintf("%s=%s", param.RawParam, param.RawValue))
×
44
        }
×
45

UNCOV
46
        paramsStr := strings.Join(params, " ")
×
UNCOV
47

×
UNCOV
48
        switch layer {
×
UNCOV
49
        case "debug-tile-outline":
×
UNCOV
50
                debugTileOutline := provider.Feature{
×
UNCOV
51
                        ID:       0,
×
UNCOV
52
                        Geometry: ext.AsPolygon(),
×
UNCOV
53
                        SRID:     srid,
×
UNCOV
54
                        Tags: map[string]interface{}{
×
UNCOV
55
                                "type":   "debug_buffer_outline",
×
UNCOV
56
                                "params": paramsStr,
×
UNCOV
57
                        },
×
UNCOV
58
                }
×
UNCOV
59

×
UNCOV
60
                if err := fn(&debugTileOutline); err != nil {
×
61
                        return err
×
62
                }
×
63

UNCOV
64
        case "debug-tile-center":
×
UNCOV
65
                xlen := ext.XSpan()
×
UNCOV
66
                ylen := ext.YSpan()
×
UNCOV
67
                z, x, y := tile.ZXY()
×
UNCOV
68

×
UNCOV
69
                debugTileCenter := provider.Feature{
×
UNCOV
70
                        ID: 1,
×
UNCOV
71
                        Geometry: geom.Point{
×
UNCOV
72
                                // Minx
×
UNCOV
73
                                ext.MinX() + (xlen / 2),
×
UNCOV
74
                                // Miny
×
UNCOV
75
                                ext.MinY() + (ylen / 2),
×
UNCOV
76
                        },
×
UNCOV
77
                        SRID: srid,
×
UNCOV
78
                        Tags: map[string]interface{}{
×
UNCOV
79
                                "type":   "debug_text",
×
UNCOV
80
                                "params": paramsStr,
×
UNCOV
81
                                "zxy":    fmt.Sprintf("Z:%v, X:%v, Y:%v", z, x, y),
×
UNCOV
82
                        },
×
UNCOV
83
                }
×
UNCOV
84

×
UNCOV
85
                if err := fn(&debugTileCenter); err != nil {
×
86
                        return err
×
87
                }
×
88
        }
89

UNCOV
90
        return nil
×
91
}
92

93
// Layers returns information about the various layers the provider supports
UNCOV
94
func (p *Provider) Layers() ([]provider.LayerInfo, error) {
×
UNCOV
95
        layers := []Layer{
×
UNCOV
96
                {
×
UNCOV
97
                        name:     "debug-tile-outline",
×
UNCOV
98
                        geomType: geom.Line{},
×
UNCOV
99
                        srid:     tegola.WebMercator,
×
UNCOV
100
                },
×
UNCOV
101
                {
×
UNCOV
102
                        name:     "debug-tile-center",
×
UNCOV
103
                        geomType: geom.Point{},
×
UNCOV
104
                        srid:     tegola.WebMercator,
×
UNCOV
105
                },
×
UNCOV
106
        }
×
UNCOV
107

×
UNCOV
108
        var ls []provider.LayerInfo
×
UNCOV
109

×
UNCOV
110
        for i := range layers {
×
UNCOV
111
                ls = append(ls, layers[i])
×
UNCOV
112
        }
×
113

UNCOV
114
        return ls, nil
×
115
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc