package maptile

import "github.com/paulmach/orb/maptile"

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

Index

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 ChildrenInZoomRange

func ChildrenInZoomRange(tile Tile, zoomStart, zoomEnd Zoom) Tiles

ChildrenInZoomRange returns all the children tiles of tile from ranges [zoomStart, zoomEnd], both ends inclusive.

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.

Source Files

set.go tile.go

Directories

PathSynopsis
maptile/tilecoverPackage tilecover computes the covering set of tiles for an orb.Geometry.
Version
v0.11.1 (latest)
Published
Jan 29, 2024
Platform
js/wasm
Imports
5 packages
Last checked
1 day ago

Tools for package owners.