tile_system

package
v0.0.10-a Latest Latest
Warning

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

Go to latest
Published: May 3, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

package tile_system is a collection of conversion utilities to go between geo/pixel/tile/quadkey space This package uses WGS84 coordinates and a mercator projection

Index

Constants

View Source
const (
	MinLat       float64 = -85.05112878
	MaxLat       float64 = 85.05112878
	MinLon       float64 = -180
	MaxLon       float64 = 180
	EarthRadiusM float64 = 6378137
)

Variables

View Source
var TileSize uint = 256

Functions

func CoordinateToTile

func CoordinateToTile(lat, lon float64, zoom uint) (Tile, TilePixel)

Types

type Coords

type Coords struct {
	Lat, Lon float64
}

WGS-84 Lat Lon coordindates in degrees

func ClippedCoords

func ClippedCoords(lat, lon float64) Coords

Coords that have been clipped to Max/Min Lat/Lon

func (Coords) Equals

func (c Coords) Equals(that Coords) bool

func (Coords) String

func (c Coords) String() string

func (Coords) ToPixel

func (c Coords) ToPixel(zoom uint) Pixel

Get the Pixel of the pixel at the zoom level

type Pixel

type Pixel struct {
	X, Y, Z uint
}

Pixel in a WGS84 Mercator map projection with a NW origin (0,0) of the projection

func (Pixel) FloatX

func (p Pixel) FloatX() float64

func (Pixel) FloatY

func (p Pixel) FloatY() float64

func (Pixel) ToCoords

func (p Pixel) ToCoords() Coords

func (Pixel) ToTile

func (p Pixel) ToTile() (tile Tile, tilePixel TilePixel)

Gets the tile that contains this pixel as well as the pixel within that tile.

type Tile

type Tile struct {
	X, Y, Z uint
}

func TileFromQuadKey

func TileFromQuadKey(quadkey string) (tile Tile)

func (Tile) IntX

func (t Tile) IntX() int

func (Tile) IntY

func (t Tile) IntY() int

func (Tile) IntZ

func (t Tile) IntZ() int

func (Tile) QuadKey

func (t Tile) QuadKey() string

func (Tile) ToPixel

func (t Tile) ToPixel() Pixel

func (Tile) ToPixelWithOffset

func (t Tile) ToPixelWithOffset(offset Pixel) (pixel Pixel)

type TileIndex

type TileIndex struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TileIndex stores indexes values by tile. If a deep level of tile is added and a shallower one is requested, the values are aggregated up. TileIndex is thread safe implementation uses a sorted keyset, trie would be better

func (*TileIndex) Add

func (idx *TileIndex) Add(t Tile, val interface{})

Add adds a value, but will not be indexed

func (*TileIndex) TileRange

func (idx *TileIndex) TileRange(zmin, zmax int) <-chan Tile

TileRange returns a channel of all tiles in the index in the zoom range If zmax is greater than the deepest tile level, the deepest tile level returns Acquires a readlock for duration of returned channel being open

func (*TileIndex) Values

func (idx *TileIndex) Values(t Tile) (vals []interface{})

Values returns a list of values aggregated under the requested tile

type TilePixel

type TilePixel struct {
	X, Y uint
	Tile *Tile
}

Pixel whose origin (0,0) is NW corner of Tile

func (TilePixel) ToCoords

func (p TilePixel) ToCoords() Coords

Jump to

Keyboard shortcuts

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