maptiles

package
v0.0.0-...-9c4a701 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2015 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTileRendererChan

func NewTileRendererChan(stylesheet string) chan<- FetchRequest

Types

type FetchRequest

type FetchRequest interface {
	IsMetaTile() bool
	GetCoord() TileCoord
	GetLayer() string
	GetMetaCoord() MetaTileCoord
	GetOutChan() chan<- TileFetchResult
}

type Generator

type Generator struct {
	MapFile string
	TileDir string
	Threads int
}

func (*Generator) Run

func (g *Generator) Run(lowLeft, upRight mapnik.Coord, minZ, maxZ uint64, name string)

Generates tile files as a <zoom>/<x>/<y>.png file hierarchy in the current work directory.

type LayerMultiplex

type LayerMultiplex struct {
	// contains filtered or unexported fields
}

func DefaultRenderMultiplex

func DefaultRenderMultiplex(defaultStylesheet string, numRenderers int) *LayerMultiplex

func NewLayerMultiplex

func NewLayerMultiplex(numRenderers int) *LayerMultiplex

func (*LayerMultiplex) AddRenderer

func (l *LayerMultiplex) AddRenderer(name string, stylesheet string)

func (*LayerMultiplex) AddSource

func (l *LayerMultiplex) AddSource(name string, fetchChan chan<- FetchRequest)

func (*LayerMultiplex) CreateRenderer

func (l *LayerMultiplex) CreateRenderer(stylesheet string) chan<- FetchRequest

func (LayerMultiplex) SubmitRequest

func (l LayerMultiplex) SubmitRequest(r FetchRequest) bool

type MetaTileCoord

type MetaTileCoord struct {
	MinX, MinY, MaxX, MaxY, Zoom uint64
	Tms                          bool
	Layer                        string
}

func (*MetaTileCoord) Count

func (c *MetaTileCoord) Count() uint64

func (*MetaTileCoord) TileCoords

func (c *MetaTileCoord) TileCoords() []TileCoord

func (*MetaTileCoord) XSize

func (c *MetaTileCoord) XSize() uint64

func (*MetaTileCoord) YSize

func (c *MetaTileCoord) YSize() uint64

type MetaTileFetchRequest

type MetaTileFetchRequest struct {
	Coord MetaTileCoord
	// Will output multiple results
	OutChan chan<- TileFetchResult
}

func (MetaTileFetchRequest) GetCoord

func (r MetaTileFetchRequest) GetCoord() TileCoord

func (MetaTileFetchRequest) GetLayer

func (r MetaTileFetchRequest) GetLayer() string

func (MetaTileFetchRequest) GetMetaCoord

func (r MetaTileFetchRequest) GetMetaCoord() MetaTileCoord

func (MetaTileFetchRequest) GetOutChan

func (r MetaTileFetchRequest) GetOutChan() chan<- TileFetchResult

func (MetaTileFetchRequest) IsMetaTile

func (r MetaTileFetchRequest) IsMetaTile() bool

type SubImager

type SubImager interface {
	SubImage(r image.Rectangle) image.Image
}

type TileCoord

type TileCoord struct {
	X, Y, Zoom uint64
	Tms        bool
	Layer      string
}

func (TileCoord) OSMFilename

func (c TileCoord) OSMFilename() string

type TileDb

type TileDb struct {
	// contains filtered or unexported fields
}

MBTiles 1.2-compatible Tile Db with multi-layer support. Was named Mbtiles before, hence the use of *m in methods.

func NewTileDb

func NewTileDb(path string) *TileDb

func (*TileDb) BatchCheck

func (m *TileDb) BatchCheck(coords []TileCoord) []bool

BatchCheck checks whether the provided coordinates have tiles in the database.

func (*TileDb) BatchInsert

func (m *TileDb) BatchInsert(inserts []TileFetchResult)

maximum length of inserts is 199 due to SQLITE_MAX_VARIABLE_NUMBER being 999

func (*TileDb) Close

func (m *TileDb) Close()

func (*TileDb) InsertQueue

func (m *TileDb) InsertQueue() chan<- TileFetchResult

func (*TileDb) RequestQueue

func (m *TileDb) RequestQueue() chan<- TileFetchRequest

func (*TileDb) Run

func (m *TileDb) Run()

Best executed in a dedicated go routine.

type TileFetchRequest

type TileFetchRequest struct {
	Coord   TileCoord
	OutChan chan<- TileFetchResult
}

func (TileFetchRequest) GetCoord

func (r TileFetchRequest) GetCoord() TileCoord

func (TileFetchRequest) GetLayer

func (r TileFetchRequest) GetLayer() string

func (TileFetchRequest) GetMetaCoord

func (r TileFetchRequest) GetMetaCoord() MetaTileCoord

func (TileFetchRequest) GetOutChan

func (r TileFetchRequest) GetOutChan() chan<- TileFetchResult

func (TileFetchRequest) IsMetaTile

func (r TileFetchRequest) IsMetaTile() bool

type TileFetchResult

type TileFetchResult struct {
	Coord   TileCoord
	BlobPNG []byte
	Error   error
}

type TileRenderer

type TileRenderer struct {
	// contains filtered or unexported fields
}

TileRenderer renders images as Web Mercator tiles

func NewTileRenderer

func NewTileRenderer(stylesheet string) *TileRenderer

func (*TileRenderer) Listen

func (t *TileRenderer) Listen(c <-chan FetchRequest)

Listen starts listening for TileFetchRequests on c. If the channel is closed, it stops.

func (*TileRenderer) ProcessRequest

func (t *TileRenderer) ProcessRequest(request FetchRequest)

func (*TileRenderer) RenderMetaTile

func (t *TileRenderer) RenderMetaTile(c MetaTileCoord) ([]TileFetchResult, error)

RenderMetaTile renders multiple tiles as a single tile, then slices them up.

func (*TileRenderer) RenderTile

func (t *TileRenderer) RenderTile(c TileCoord) ([]byte, error)

func (*TileRenderer) RenderTileZXY

func (t *TileRenderer) RenderTileZXY(zoom, x, y uint64) ([]byte, error)

Render a tile with coordinates in Google tile format. Most upper left tile is always 0,0. Method is not thread-safe, so wrap with a mutex when accessing the same renderer by multiple threads or setup multiple goroutinesand communicate with channels, see NewTileRendererChan.

type TileServer

type TileServer struct {
	TmsSchema bool
	// contains filtered or unexported fields
}

Handles HTTP requests for map tiles, caching any produced tiles in an MBtiles 1.2 compatible sqlite db.

func NewTileServer

func NewTileServer(cfg TileServerConfig) *TileServer

NewTileServer creates a new tile server

func (*TileServer) AddMapnikLayer

func (t *TileServer) AddMapnikLayer(layerName string, stylesheet string)

func (*TileServer) ServeHTTP

func (t *TileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*TileServer) ServeTileRequest

func (t *TileServer) ServeTileRequest(w http.ResponseWriter, r *http.Request, tc TileCoord)

type TileServerConfig

type TileServerConfig struct {
	// CacheFile is the mbtiles file to use for caching.
	// An empty string disables caching.
	CacheFile string

	// NumRenderers specified the number of renderers to start for each layer.
	// If zero, runtime.GOMAXPROCS will be used.
	NumRenderers int
}

TileServerConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL