tapalcatl

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: BSD-3-Clause Imports: 3 Imported by: 0

README

Tapalcatl

Tapalcatl is a "metatile server", which takes requests for a specific single format and tile coordinate and makes a request upstream for a "metatile" or bundle of tiles which contains the tile originally requested.

For example:

  1. The client requests a tile /1/2/3.json
  2. Tapalcatl makes an upstream request for /1/0/0.zip
  3. Tapalcatl extracts the file 0/2/3.json from the package.
  4. The client reads back a tile containing only the format for the specific tile they asked for.

Why?

Having a choice of different formats can be helpful to support a range of different renderers and for ingesting tiles into different bits of software. Some formats are widely supported, such as GeoJSON, but can be less compact than other formats such as Mapbox Vector Tile. Allowing users to make the choice means they can make that trade-off for themselves.

On the other hand, keeping a large set of different formats on disk means many tiny files to write, synchronise and manage. This can quickly become onerous and expensive!

Tapalcatl is an attempt to do this at the "edge", closer to the client and taking advantage of as much "edge" caching as possible.

Why "tapalcatl"?

Tapalcatl is Nahuatl for a potsherd or broken tile, and Tapalcatl breaks up (meta)tiles. It's also sibling to Xonacatl which serves layers.

Installing

cd $GOPATH
go get -u github.com/tilezen/tapalcatl/tapalcatl_server
go install github.com/tilezen/tapalcatl/tapalcatl_server

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPowerOfTwo added in v1.2.0

func IsPowerOfTwo(i int) bool

IsPowerOfTwo return true when the given integer is a power of two. See https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2 for details.

func NewMetatileReader

func NewMetatileReader(t TileCoord, r io.ReaderAt, size int64) (io.ReadCloser, uint64, error)

Types

type TileCoord

type TileCoord struct {
	Z, X, Y int
	Format  string
}

func (TileCoord) FileName

func (t TileCoord) FileName() string

func (TileCoord) MetaAndOffset

func (t TileCoord) MetaAndOffset(metaSize, tileSize int) (meta, offset TileCoord, err error)

MetaAndOffset returns the metatile coordinate and the offset within it for this TileCoord object. The argument metaSize indicates the size of the metatile and tileSize indicates the size of the tile within the metatile that you want to extract, both in units of "standard" 256px tiles.

For example, to extract a 1x1 regular 256px tile from a 2x2 metatile, one would call MetaAndOffset(2, 1). To extract the 512px tile from the same, call MetaAndOffset(2, 2).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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