Documentation ¶
Overview ¶
Package server implements the http frontend
Index ¶
- Constants
- Variables
- func CORSHandler(next http.Handler) http.Handler
- func NewRouter(a *atlas.Atlas) *httptreemux.TreeMux
- func Start(a *atlas.Atlas, port string) *http.Server
- func TileCacheHandler(a *atlas.Atlas, next http.Handler) http.Handler
- type Capabilities
- type CapabilitiesLayer
- type CapabilitiesMap
- type HandleCapabilities
- type HandleMapCapabilities
- type HandleMapLayerZXY
- type HandleMapStyle
Constants ¶
const ( // MaxTileSize is 500k. Currently just throws a warning when tile // is larger than MaxTileSize MaxTileSize = 500000 )
Variables ¶
var ( // Version is the version of the software, this should be set by the main program, before starting up. // It is used by various Middleware to determine the version. Version string = "Version Not Set" // HostName is the name of the host to use for construction of URLS. // configurable via the tegola config.toml file (set in main.go) HostName string // Port is the port the server is listening on, used for construction of URLS. // configurable via the tegola config.toml file (set in main.go) Port string // CORSAllowedOrigin is the "Access-Control-Allow-Origin" CORS header. // configurable via the tegola config.toml file (set in main.go) CORSAllowedOrigin string = "*" // TileBuffer is the tile buffer to use. // configurable via tegola config.tomal file (set in main.go) TileBuffer float64 = tegola.DefaultTileBuffer )
var URLRoot = func(r *http.Request) string { return fmt.Sprintf("%v://%v", scheme(r), hostName(r)) }
URLRoot builds a string containing the scheme, host and port based on a combination of user defined values, headers and request parameters. The function is public so it can be overridden for other implementations.
Functions ¶
func NewRouter ¶ added in v0.7.0
func NewRouter(a *atlas.Atlas) *httptreemux.TreeMux
NewRouter set's up the our routes.
Types ¶
type Capabilities ¶ added in v0.3.0
type Capabilities struct { Version string `json:"version"` Maps []CapabilitiesMap `json:"maps"` }
type CapabilitiesLayer ¶ added in v0.3.0
type CapabilitiesMap ¶ added in v0.3.0
type HandleCapabilities ¶ added in v0.3.0
type HandleCapabilities struct{}
func (HandleCapabilities) ServeHTTP ¶ added in v0.3.0
func (req HandleCapabilities) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HandleMapCapabilities ¶ added in v0.3.1
type HandleMapCapabilities struct {
// contains filtered or unexported fields
}
func (HandleMapCapabilities) ServeHTTP ¶ added in v0.3.1
func (req HandleMapCapabilities) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP returns details about a map according to the tileJSON spec (https://github.com/mapbox/tilejson-spec/tree/master/2.1.0)
URI scheme: /capabilities/:map_name.json map_name - map name in the config file
type HandleMapLayerZXY ¶ added in v0.3.1
type HandleMapLayerZXY struct { // the Atlas to use, nil (default) is the default atlas Atlas *atlas.Atlas // contains filtered or unexported fields }
func (HandleMapLayerZXY) ServeHTTP ¶ added in v0.3.1
func (req HandleMapLayerZXY) ServeHTTP(w http.ResponseWriter, r *http.Request)
URI scheme: /maps/:map_name/:layer_name/:z/:x/:y map_name - map name in the config file layer_name - name of the single map layer to render z, x, y - tile coordinates as described in the Slippy Map Tilenames specification
z - zoom level x - row y - column
type HandleMapStyle ¶ added in v0.4.0
type HandleMapStyle struct {
// contains filtered or unexported fields
}
func (HandleMapStyle) ServeHTTP ¶ added in v0.4.0
func (req HandleMapStyle) ServeHTTP(w http.ResponseWriter, r *http.Request)
returns details about a map according to the tileJSON spec (https://github.com/mapbox/tilejson-spec/tree/master/2.1.0)
URI scheme: /capabilities/:map_name.json
map_name - map name in the config file