added OpenTopoMap tile provider

This commit is contained in:
flopp 2016-03-23 18:01:13 +01:00
parent dc36c416d1
commit 1fdedc79cc
2 changed files with 14 additions and 2 deletions

View File

@ -188,7 +188,7 @@ $ create-static-map --width 600 --height 400 -o map3.png -m "red|52.514536,13.35
## Acknowledgements
Besides the go standard library, go-staticmaps uses
- [MapQuest](https://developer.mapquest.com/), [Thunderforest](http://www.thunderforest.com/), and [Stamen](http://maps.stamen.com/) as map tile providers
- [MapQuest](https://developer.mapquest.com/), [Thunderforest](http://www.thunderforest.com/), [OpenTopoMap](http://www.opentopomap.org/), and [Stamen](http://maps.stamen.com/) as map tile providers
- [Go Graphics](https://github.com/fogleman/gg) for 2D drawing
- [S2 geometry library](https://github.com/golang/geo) for spherical geometry calculations
- [appdirs](https://github.com/Wessie/appdirs) for platform specific system directories

View File

@ -67,6 +67,17 @@ func NewTileProviderStamenToner() *TileProvider {
return t
}
// NewTileProviderOpenTopoMap creates a TileProvider struct for opentopomaps's tile service
func NewTileProviderOpenTopoMap() *TileProvider {
t := new(TileProvider)
t.Name = "opentopomap"
t.Attribution = "Maps (c) OpenTopoMap [CC-BY-SA]; Data (c) OSM and contributors [ODbL]; Data (c) SRTM"
t.TileSize = 256
t.URLPattern = "http://%[1].tile.opentopomap.org/%[2]d/%[3]d/%[4]d.png"
t.Shards = []string{"a", "b", "c"}
return t
}
// GetTileProviders returns a map of all available TileProviders
func GetTileProviders() map[string]*TileProvider {
m := make(map[string]*TileProvider)
@ -76,7 +87,8 @@ func GetTileProviders() map[string]*TileProvider {
NewTileProviderThunderforestLandscape(),
NewTileProviderThunderforestOutdoors(),
NewTileProviderThunderforestTransport(),
NewTileProviderStamenToner()}
NewTileProviderStamenToner(),
NewTileProviderOpenTopoMap()}
for _, tp := range list {
m[tp.Name] = tp