tile_system

package
v0.0.9-a Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2016 License: MIT Imports: 4 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 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