mbtiles

package
v0.6.2-0...-118ef96 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: ISC Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB represents an mbtiles file connection.

func NewDB

func NewDB(filename string) (*DB, error)

NewDB creates a new DB instance. Connection is closed by runtime on application termination or by calling its Close() method.

func (*DB) Close

func (tileset *DB) Close() error

Close closes the database connection

func (*DB) ContentType

func (tileset *DB) ContentType() string

ContentType returns the content-type string of the TileFormat of the DB.

func (*DB) HasUTFGrid

func (tileset *DB) HasUTFGrid() bool

HasUTFGrid returns whether the DB has a UTF grid.

func (*DB) ReadGrid

func (tileset *DB) ReadGrid(z uint8, x uint64, y uint64, data *[]byte) error

ReadGrid reads a UTFGrid with identifiers z, x, y into provided *[]byte. data will be nil if the grid does not exist in the database, and an error will be raised. This merges in grid key data. The data is returned in the original compression encoding (zlib or gzip)

func (*DB) ReadMetadata

func (tileset *DB) ReadMetadata() (map[string]interface{}, error)

ReadMetadata reads the metadata table into a map, casting their values into the appropriate type

func (*DB) ReadTile

func (tileset *DB) ReadTile(z uint8, x uint64, y uint64, data *[]byte) error

ReadTile reads a tile with tile identifiers z, x, y into provided *[]byte. data will be nil if the tile does not exist in the database

func (*DB) TileFormat

func (tileset *DB) TileFormat() TileFormat

TileFormat returns the TileFormat of the DB.

func (*DB) TileFormatString

func (tileset *DB) TileFormatString() string

TileFormatString returns the string representation of the TileFormat of the DB.

func (*DB) TimeStamp

func (tileset *DB) TimeStamp() time.Time

TimeStamp returns the time stamp of the DB.

func (*DB) UTFGridCompression

func (tileset *DB) UTFGridCompression() TileFormat

UTFGridCompression returns the compression type of the UTFGrid in the DB: ZLIB or GZIP

type TileFormat

type TileFormat uint8

TileFormat is an enum that defines the tile format of a tile in the mbtiles file. Supported image formats:

  • PNG
  • JPG
  • WEBP
  • PBF (vector tile protocol buffers)

Tiles may be compressed, in which case the type is one of:

  • GZIP
  • ZLIB

Compressed tiles may be PBF or UTFGrids

const (
	UNKNOWN TileFormat = iota // UNKNOWN TileFormat cannot be determined from first few bytes of tile
	GZIP                      // encoding = gzip
	ZLIB                      // encoding = deflate
	PNG
	JPG
	PBF
	WEBP
)

Constants representing TileFormat types

func (TileFormat) ContentType

func (t TileFormat) ContentType() string

ContentType returns the MIME content type of the tile

func (TileFormat) String

func (t TileFormat) String() string

String returns a string representing the TileFormat

Jump to

Keyboard shortcuts

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