slippy

package
v0.0.0-...-3cd2f5a Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 4 Imported by: 25

Documentation

Index

Constants

View Source
const LatMax = 90
View Source
const LonMax = 180
View Source
const MaxZoom = 22

MaxZoom is the lowest zoom (furthest in)

View Source
const MvtTileDim = 4096.0

MvtTileDim is the number of pixels in a tile

View Source
const WebMercatorMax = 20037508.34

WebMercatorMax is the max size in meters of a tile

Variables

This section is empty.

Functions

func Extent

func Extent(g Grid, t *Tile) (ext *geom.Extent, ok bool)

func PixelsToNative

func PixelsToNative(g Grid, zoom uint, pixels uint) float64

PixelsToProjectedUnits scalar conversion of pixels into projected units TODO (@ear7h): this only considers the tile's native width

func RangeFamilyAt

func RangeFamilyAt(g Grid, t *Tile, zoom uint, f Iterator) error

RangeFamilyAt calls f on every tile vertically related to t at the specified zoom TODO (ear7h): sibling support

Types

type Grid

type Grid interface {
	// SRID returns the SRID of the coordinate system of the
	// implementer. The geomtries returned by the other methods
	// will be in these coordinates.
	SRID() uint

	// Size returns a tile where the X and Y are the size of that zoom's
	// tile grid. AKA:
	//	Tile{z, MaxX + 1, MaxY + 1
	Size(z uint) (*Tile, bool)

	// FromNative converts from a point (in the Grid's coordinates system) and zoom
	// to a tile. ok will be false if the point is not valid for this coordinate
	// system.
	FromNative(z uint, pt geom.Point) (tile *Tile, ok bool)

	// ToNative returns the tiles upper left point. ok will be false if
	// the tile is not valid. A note on implemetation is that this method
	// should be able to take tiles with x and y values 1 higher than the max,
	// this is to fetch the bottom right corner of the grid
	ToNative(*Tile) (pt geom.Point, ok bool)
}

TileGrid contains the tile layout, including ability to get WGS84 coordinates for tile extents

func NewGrid

func NewGrid(srid uint) (Grid, error)

NewGrid returns the grid conventionally used with the given SRID. Errors if the SRID is not supported. The currently supported SRID's are:

4326
3857

type Iterator

type Iterator func(*Tile) error

type Tile

type Tile struct {
	// zoom
	Z uint
	// column
	X uint
	// row
	Y uint
}

Tile describes a slippy tile.

func FromBounds

func FromBounds(g Grid, bounds *geom.Extent, z uint) []Tile

FromBounds returns a list of tiles that make up the bound given. The bounds should be defined as the following lng/lat points [4]float64{west,south,east,north}

func NewTile

func NewTile(z, x, y uint) *Tile

NewTile returns a Tile of Z,X,Y passed in

func NewTileMinMaxer

func NewTileMinMaxer(g Grid, ext geom.MinMaxer) (*Tile, bool)

NewTileMinMaxer returns the smallest tile which fits the geom.MinMaxer. Note: it assumes the values of ext are EPSG:4326 (lng/lat)

func (Tile) ZXY

func (t Tile) ZXY() (uint, uint, uint)

ZXY returns back the z,x,y of the tile

Jump to

Keyboard shortcuts

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