mbtiles

package module
v0.0.0-...-fc9ef67 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2016 License: MIT Imports: 7 Imported by: 8

README

mbtiles

Go Bindings for MBTiles

Assumes all tiles are TMS with a SW origin.

There are methods to convert to NW origin that OSM/Google/Bing use

Documentation

Index

Constants

View Source
const (
	NAME = "name"
	TYPE = "type"
	VERS = "version"
	DESC = "description"
	FRMT = "format"
	BNDS = "bounds"
	ATTR = "attribution"
)

Variables

View Source
var MetadataRequiredKeys = []string{NAME, TYPE, VERS, DESC, FRMT}

Functions

This section is empty.

Types

type Bounds

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

type Coordinate

type Coordinate float64

func ParseCoordinate

func ParseCoordinate(coord string) (Coordinate, error)

type Format

type Format string
const (
	PNG     Format = "PNG"
	JPG     Format = "JPG"
	GIF     Format = "GIF"
	WEBP    Format = "WEBP"
	PBF_GZ  Format = "PBF_GZ"
	PBF_DF  Format = "PBF_DF"
	UNKNOWN Format = "UNKNOWN"
	EMPTY   Format = "EMPTY"
)

type Grid

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

type Metadata

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

func (*Metadata) Attributes

func (m *Metadata) Attributes() map[string]string

The map of the kv pairs

func (*Metadata) Attribution

func (m *Metadata) Attribution() string

func (*Metadata) Bounds

func (m *Metadata) Bounds() ([4]Coordinate, error)

func (*Metadata) Description

func (m *Metadata) Description() string

func (*Metadata) Format

func (m *Metadata) Format() string

func (*Metadata) HasRequiredKeys

func (m *Metadata) HasRequiredKeys() bool

func (*Metadata) Name

func (m *Metadata) Name() string

func (*Metadata) Type

func (m *Metadata) Type() string

func (*Metadata) Version

func (m *Metadata) Version() string

type Tile

type Tile struct {
	Z    int    `json:"z"`
	X    int    `json:"x"`
	Y    int    `json:"y"`
	Data []byte `json:"data"`
}

Tiles are meant to follow the TMS standard, but there are methods to Read/Write OSM style tiles in Tileset

func EmptyTile

func EmptyTile(z, x, y int) (tile *Tile)

func (*Tile) Equals

func (t *Tile) Equals(that *Tile) bool

func (*Tile) SniffFormat

func (t *Tile) SniffFormat() (f Format)

type Tileset

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

func InitTileset

func InitTileset(path string, metadata map[string]string) (ts *Tileset, err error)

Creates a NEW, BLANK tileset at the given path metadata is requied to have the following keys: name, type, version, description, format

func ReadTileset

func ReadTileset(path string) (ts *Tileset, err error)

func (*Tileset) Close

func (ts *Tileset) Close()

func (*Tileset) Metadata

func (ts *Tileset) Metadata() *Metadata

func (*Tileset) ReadOSMTile

func (ts *Tileset) ReadOSMTile(x, y, z int) (tile *Tile, err error)

TMS use SW origin(0,0), OSM uses Slippy names with NW origin See: http://gis.stackexchange.com/questions/116288/mbtiles-and-slippymap-tilenames

func (*Tileset) ReadTile

func (ts *Tileset) ReadTile(x, y, z int) (tile *Tile, err error)

func (*Tileset) WriteOSMTile

func (ts *Tileset) WriteOSMTile(x, y, z int, data []byte) (tile *Tile, err error)

Writes a tile that uses the NW origin like OSM

func (*Tileset) WriteTile

func (ts *Tileset) WriteTile(x, y, z int, data []byte) (tile *Tile, err error)

Jump to

Keyboard shortcuts

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