go-staticmaps
go-staticmaps copied to clipboard
Using NewTileProviderThunderforestOutdoors() results in 'API Key Required' watermark
Using NewTileProviderThunderforestOutdoors() results in 'API Key Required' watermark on the generated image.
How do we set an API key when using this tool?
Here's what I'm trying to do:
ctx := sm.NewContext()
ctx.SetSize(600, 360)
ctx.SetZoom(zoom)
ctx.SetTileProvider(sm.NewTileProviderThunderforestOutdoors())
ctx.AddObject(
sm.NewMarker(
s2.LatLngFromDegrees(lat, long),
color.RGBA{0xff, 0, 0, 0xff},
16.0,
),
)
img, err := ctx.Render()
- visit https://www.thunderforest.com/, then sign up and login (free for Hobby Project)
- from your dashboard(https://manage.thunderforest.com/dashboard), you will see the outdoors tile layer's URL which looks like https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=xxxx
- codes:
thunderforestOutdoors := &sm.TileProvider{
Name: "thunderforest-outdoors",
Attribution: "Maps (c) Thundeforest; Data (c) OSM and contributors, ODbL",
TileSize: 256,
URLPattern: "https://%[1]s.tile.thunderforest.com/outdoors/%[2]d/%[3]d/%[4]d.png?apikey=xxxx",
Shards: []string{"a", "b", "c"},
}
ctx := sm.NewContext()
ctx.SetSize(600, 360)
ctx.SetZoom(zoom)
ctx.SetTileProvider(thunderforestOutdoors)
ctx.AddObject(
sm.NewMarker(
s2.LatLngFromDegrees(lat, long),
color.RGBA{0xff, 0, 0, 0xff},
16.0,
),
)
img, err := ctx.Render()