maptile

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2019 License: MIT Imports: 5 Imported by: 0

README

orb/tile Godoc Reference

Package orb/maptile provides types and methods for working with web mercator map tiles. It defines a tile as:

type Tile struct {
	X, Y uint32
	Z    Zoom
}

type Zoom uint32

Functions are provided to create tiles from lon/lat points as well as quadkeys. The tile defines helper methods such as Parent(), Children(), Siblings(), etc.

tilecover sub-package

Still a work in progress but the goal is to provide geo.Geometry -> covering tiles.

Similar libraries in other languages:

Documentation

Overview

Package maptile defines a Tile type and methods to work with web map projected tile data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fraction

func Fraction(ll orb.Point, z Zoom) orb.Point

Fraction returns the precise tile fraction at the given zoom. Will return 2^zoom-1 if the point is below 85.0511 S.

Types

type Set

type Set map[Tile]bool

Set is a map/hash of tiles.

func (Set) Merge

func (s Set) Merge(set Set)

Merge will merge the given set into the existing set.

func (Set) ToFeatureCollection

func (s Set) ToFeatureCollection() *geojson.FeatureCollection

ToFeatureCollection converts a set of tiles into a feature collection. This method is mostly useful for debugging output.

type Tile

type Tile struct {
	X, Y uint32
	Z    Zoom
}

Tile is an x, y, z web mercator tile.

func At

func At(ll orb.Point, z Zoom) Tile

At creates a tile for the point at the given zoom. Will create a valid tile for the zoom. Points outside the range lat [-85.0511, 85.0511] will be snapped to the max or min tile as appropriate.

func FromQuadkey

func FromQuadkey(k uint64, z Zoom) Tile

FromQuadkey creates the tile from the quadkey.

func New

func New(x, y uint32, z Zoom) Tile

New creates a new tile with the given coordinates.

func (Tile) Bound

func (t Tile) Bound(tileBuffer ...float64) orb.Bound

Bound returns the geo bound for the tile. An optional tileBuffer parameter can be passes to create a buffer around the bound in tile dimension. e.g. a tileBuffer of 1 would create a bound 9x the size of the tile, centered around the provided tile.

func (Tile) Center

func (t Tile) Center() orb.Point

Center returns the center of the tile.

func (Tile) Children

func (t Tile) Children() Tiles

Children returns the 4 children of the tile.

func (Tile) Contains

func (t Tile) Contains(tile Tile) bool

Contains returns if the given tile is fully contained (or equal to) the give tile.

func (Tile) Parent

func (t Tile) Parent() Tile

Parent returns the parent of the tile.

func (Tile) Quadkey

func (t Tile) Quadkey() uint64

Quadkey returns the quad key for the tile.

func (Tile) Range

func (t Tile) Range(z Zoom) (min, max Tile)

Range returns the min and max tile "range" to cover the tile at the given zoom.

func (Tile) SharedParent

func (t Tile) SharedParent(tile Tile) Tile

SharedParent returns the tile that contains both the tiles.

func (Tile) Siblings

func (t Tile) Siblings() Tiles

Siblings returns the 4 tiles that share this tile's parent.

func (Tile) Valid

func (t Tile) Valid() bool

Valid returns if the tile's x/y are within the range for the tile's zoom.

type Tiles

type Tiles []Tile

Tiles is a set of tiles, later we can add methods to this.

func (Tiles) ToFeatureCollection

func (ts Tiles) ToFeatureCollection() *geojson.FeatureCollection

ToFeatureCollection converts the tiles into a feature collection. This method is mostly useful for debugging output.

type Zoom

type Zoom uint32

A Zoom is a strict type for a tile zoom level.

Directories

Path Synopsis
Package tilecover computes the covering set of tiles for an orb.Geometry.
Package tilecover computes the covering set of tiles for an orb.Geometry.

Jump to

Keyboard shortcuts

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