Documentation ¶
Overview ¶
Package mbtiles contains some code parts borrowed from github.com/consbio/mbtileserver which is released under ISC.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidTileFormat = errors.New("invalid or unknown tile format") ErrUnknownTileFormatPattern = errors.New("unknown tile format pattern") ErrInvalidLayerType = errors.New("invalid or unknown layer type") ErrTilesetNotFound = errors.New("tileset not found") ErrTileNotFound = errors.New("tile not found") ErrNoUTFGrid = errors.New("tileset does not contain UTF grids") ErrInvalidTileCoord = errors.New("tile coordinates are not valid") )
Functions ¶
func LoadTilesets ¶
LoadTilesets creates a Tileset of all MBTiles in the specified directory and adds them to the internal map
Types ¶
type LayerData ¶
type LayerData struct { VectorLayers *[]VectorLayer `json:"vector_layers,omitempty"` TileStats *TileStats `json:"tilestats,omitempty"` }
type LayerType ¶
type LayerType int
LayerType represents the MBTiles layer type
func (*LayerType) MarshalJSON ¶
func (*LayerType) UnmarshalJSON ¶
type Metadata ¶
type Metadata struct { Name string `json:"name"` Format TileFormat `json:"format"` Bounds [4]float64 `json:"bounds,omitempty"` Center [3]float64 `json:"center,omitempty"` MinZoom int `json:"minzoom,omitempty"` MaxZoom int `json:"maxzoom,omitempty"` Description string `json:"description,omitempty"` Version string `json:"version,omitempty"` Type LayerType `json:"type,omitempty"` Attribution string `json:"attribution,omitempty"` LayerData *LayerData `json:"layerData,omitempty"` }
type TileCoord ¶
func ParseTileCoord ¶
ParseTileCoord parses and returns TileCoord coordinates and an optional extension from the three parameters. The parameter z is interpreted as the web mercator zoom level, it is supposed to be an unsigned integer that will fit into 8 bit. The parameters x and y are interpreted as longitude and latitude tile indices for that zoom level, both are supposed be integers in the integer interval [0,2^z). Additionally, y may also have an optional filename extension (e.g. "42.png") which is removed before parsing the number, and returned, too. In case an error occured during parsing or if the values are not in the expected interval, the returned error is non-nil.
type TileFormat ¶
type TileFormat int
TileFormat represents the format of a tile
const ( UNKNOWN TileFormat = iota PBF PNG JPG WEBP GZIP ZLIB )
func (TileFormat) ContentType ¶
func (f TileFormat) ContentType() string
ContentType returns the MIME content type of the TileFormat
func (*TileFormat) MarshalJSON ¶
func (f *TileFormat) MarshalJSON() ([]byte, error)
func (TileFormat) String ¶
func (f TileFormat) String() string
String returns a string representing the TileFormat
func (*TileFormat) UnmarshalJSON ¶
func (f *TileFormat) UnmarshalJSON(b []byte) error
type Tileset ¶
type Tileset struct { Filename string Format TileFormat Timestamp time.Time UTFGrid bool UTFGridCompression TileFormat // contains filtered or unexported fields }
Tileset represents an MBTiles instance
func GetTileset ¶
GetTileset returns a Tileset by the given ID
func NewTileset ¶
NewTileset creates a new Tileset by the given MBTiles file
func (*Tileset) ContentType ¶
ContentType returns the content-type string of the TileFormat of the Tileset.
func (*Tileset) GetGrid ¶
GetGrid reads a UTFGrid with identifiers z, x, y into []byte. This merges in grid key data. The data is returned in the original compression encoding (zlib or gzip)
func (*Tileset) GetMetadata ¶
GetMetadata reads the metadata table into Metadata, casting their values into the appropriate type