Documentation ¶
Overview ¶
package tile provides methods for parsing and handling individual tile requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleTileParser ¶
type SimpleTileParser struct { TileParser // contains filtered or unexported fields }
SimpleTileParse is an implementation of the TileParser interface. It uses a simple positional regular expression to match tile requests and determine which to return from a given MBTiles database:
`\/([^\/]+)\/(\d+)\/(\d+)\/(\d+)\.(\w+)$`
Where: $1 is the name of the (MBTiles database) layer to read data from $2 is the Z value of the tile request $3 is the X value of the tile request $4 is the Y value of the tile request $5 is the mime-type extension for the tile request. Fully-qualified content-type values for file extensions are mapped using the aaronland/go-mimetypes package.
func (*SimpleTileParser) Parse ¶
func (p *SimpleTileParser) Parse(path string) (*TileRequest, error)
Parse a URI path in to a *TileRequest.
type TileParser ¶
type TileParser interface { // Parse takes a URI path as its input and returns a *TileRequest instance. Parse(string) (*TileRequest, error) }
TileParser is an interface for parsing URI paths in to *TileRequest instances.
func NewSimpleTileParser ¶
func NewSimpleTileParser() (TileParser, error)
Return a new SimpleTileParser instance.
type TileRequest ¶
type TileRequest struct { // Tile is the underlying *tilepack.Tile instance where tile data is stored Tile maptile.Tile // Layer is the name of the MBTiles to read from Layer string // ContentType is the mime-type of the data to return ContentType string }
TileRequest provides a simple struct encapsulating the specific details of a tile request.
func (*TileRequest) String ¶
func (t *TileRequest) String() string
String returns a relative URI path for the TileRequest instance.