Documentation ¶
Overview ¶
Package diglet/tms is an HTTP Tile Server that also support JSON-RPC & WebSocket requests. Tile subscriptions are also available to support real-time map applications with large feature sets.
Index ¶
- Constants
- Variables
- func MBTServer(mbtPath string, port string) (app *dig.App, err error)
- type Cache
- func (c *Cache) Close()
- func (c *Cache) Destroy()
- func (c *Cache) DropBucket(bucket string) (ok bool)
- func (c *Cache) Get(bucket, key string) (value []byte, ok bool)
- func (c *Cache) Map(bucket string, fn func(value []byte) ([]byte, error)) (err error)
- func (c *Cache) Put(bucket, key string, value []byte) (err error)
- type IoHub
- type TileCache
- type TileXYZ
- type TilesetIndex
- type TilesetTopic
- type TsEvent
- type TsOp
Constants ¶
View Source
const ( GetTile string = "get_tile" GetRawTile string = "get_raw_tile" GetTileset string = "get_tileset" ListTilesets string = "list_tilesets" SubscribeTile string = "subscribe_tile" UnsubscribeTile string = "unsubscribe_tile" )
View Source
const CacheName = ".diglet.cache"
Variables ¶
View Source
var Cmd = cli.Command{ Name: "tms", Aliases: []string{"serve"}, Usage: "Starts the diglet Tile Map Service", Description: "Starts the diglet Tile Map Service. Uses Slippy maps tilenames by default.", ArgsUsage: "mbtiles_directory", Action: func(c *cli.Context) { port := c.String("port") args := c.Args() if len(args) < 1 { util.Die(c, "directory path to serve mbtiles from is required") } mbt := args[0] if mbt == "" { util.Die(c, "mbtiles_directory is required") } cert := c.String("cert") key := c.String("key") server, err := MBTServer(mbt, port) if err != nil { util.Die(c, err.Error()) } if (cert != "") && (key != "") { server.RunTLS(&cert, &key) } else if cert != "" || key != "" { util.Die(c, "Both cert & key are required to serve over TLS/SSL") } else { sigs := make(chan os.Signal, 1) done := make(chan bool, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) defer os.Remove(filepath.Join(mbt, CacheName)) go func() { err := server.Run() util.Error(err) done <- true }() go func() { <-sigs done <- true }() <-done } }, Flags: []cli.Flag{ cli.StringFlag{ Name: "port", Value: "8080", Usage: "Port to bind", }, cli.StringFlag{ Name: "cert, tls-certificate", Usage: "Path to .pem TLS Certificate. Both cert & key required to serve HTTPS", }, cli.StringFlag{ Name: "key, tls-private-key", Usage: "Path to .pem TLS Private Key. Both cert & key required to serve HTTPS", }, cli.BoolFlag{ Name: "tms-origin", Usage: "NOT IMPLEMENTED: Use TMS origin, SW origin w/ Y increasing North-wise. Default uses NW origin inscreasing South-wise (Slippy tilenames)", }, }, }
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) DropBucket ¶
type IoHub ¶
type IoHub struct {
// contains filtered or unexported fields
}
func NewHub ¶
func NewHub(tilesets *TilesetIndex) (h *IoHub)
type TileCache ¶
type TileCache struct {
*Cache
}
func InitTileCache ¶
type TileXYZ ¶
type TilesetIndex ¶
type TilesetIndex struct { Path string Tilesets map[string]*mbtiles.Tileset Events chan TsEvent // contains filtered or unexported fields }
TilesetIndex is a container for tilesets loaded from disk
func NewTilesetIndex ¶
func NewTilesetIndex(mbtilesDir string) (tsi *TilesetIndex, err error)
NewTilesetIndex creates a new tileset index, but does not read the tile tilesets from disk
func ReadTilesets ¶
func ReadTilesets(mbtilesDir string) (tsi *TilesetIndex, err error)
ReadTilesets create a new tilesetindex and read the tilesets contents from disk It spawns goroutine that will refresh Tilesets from disk on changes
type TilesetTopic ¶
type TilesetTopic struct {
// contains filtered or unexported fields
}
hub maintains the set of active connections and broadcasts messages to the connections.
Click to show internal directories.
Click to hide internal directories.