tile

package
v0.0.0-...-072852a Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MercatorPole = 20037508.34

Variables

This section is empty.

Functions

func AssertAreEqual

func AssertAreEqual(t *testing.T, expected float64, actual float64, message string)

AssetAreEqual check if two float64 numbers are roughly equal, and fails the test if not.

func BilinearInterpolation

func BilinearInterpolation(ll *PointValue, ul *PointValue, lr *PointValue, ur *PointValue, p *Point) float64

func DrawGrid

func DrawGrid(grid *Grid) *image.RGBA

func DrawGridInto

func DrawGridInto(grid *Grid, m *image.RGBA, offsetX int, offsetY int)

func DrawGridTest

func DrawGridTest(grid Grid) *image.RGBA

func DrawLine

func DrawLine(gc *draw2dimg.GraphicContext, line *PolyLine)

func DrawX

func DrawX(img *image.RGBA)

func ResampleAndDrawConcurrent

func ResampleAndDrawConcurrent(g Grid, b Bounds, width int, height int) *image.RGBA

func SaveImage

func SaveImage(m *image.RGBA, file string)

func Scale

func Scale(from1 float64, from2 float64, to1 float64, to2 float64) func(x float64) float64

Create function for scaling float64 -> float64

func Tiler

func Tiler(g Grid, maxZoom int, targetFolder string)

func TimeTrack

func TimeTrack(start time.Time, name string)

TimeTrack is a utility function used for timing the execution of a function

Types

type Bounds

type Bounds struct {
	Min Point
	Max Point
}

func (Bounds) Width

func (b Bounds) Width() float64

type Grid

type Grid struct {
	Data   []float32
	Header GridHeader
}

func Resample

func Resample(grid Grid, b Bounds, width int, height int) Grid

Resample resamples the specified area of a regular grid.

func ToRegularProjectedGrid

func ToRegularProjectedGrid(grid Grid) Grid

ToRegularProjectedGrid converts a regular geographic grid to a regular Mercator grid.

func (*Grid) GetIdx

func (g *Grid) GetIdx(idxX int, idxY int) int

func (Grid) GetValueAt

func (g Grid) GetValueAt(p *Point) float32

Use bilinear interpolation to get the value at a point within the grid

func (*Grid) GetValueAtIdx

func (g *Grid) GetValueAtIdx(idxX int, idxY int) PointValue

Get value at a given index, assuming an y-axis pointing north-to-south

func (*Grid) Height

func (g *Grid) Height() float64

func (*Grid) Width

func (g *Grid) Width() float64

type GridHeader

type GridHeader struct {
	ScanMode int
	Nx       int
	Ny       int
	Dx       float64
	Dy       float64
	Lo1      float64
	Lo2      float64
	La1      float64
	La2      float64
}

type MercatorProjector

type MercatorProjector struct {
}

func (MercatorProjector) FromProjection

func (MercatorProjector) FromProjection(x, y float64) Point

FromProjection finds the geographic coordinates of a Mercator point.

func (MercatorProjector) ToProjection

func (MercatorProjector) ToProjection(lon, lat float64) Point

ToProjection will project a point into the Mercator projection.

type Point

type Point struct {
	X float64
	Y float64
}

type PointValue

type PointValue struct {
	Point
	Value float32
}

type PolyLine

type PolyLine struct {
	Bounds
	Points []Point
}

type Projector

type Projector interface {
	ToProjection(lon, lat float64) Point
	FromProjection(x, y float64) Point
}

Jump to

Keyboard shortcuts

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