webmercator

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package webmercator does the translation to and from WebMercator and WGS84 Gotten from: http://wiki.openstreetmap.org/wiki/Mercator#C.23

Index

Constants

View Source
const (
	RMajor = 6378137.0
	RMinor = 6356752.3142
	Ratio  = RMinor / RMajor
)
View Source
const (
	EarthRadius = RMajor
)

Variables

View Source
var Eccent float64
View Source
var ErrCoordsRequire2Values = errors.New("Coords should have at least 2 coords")

Functions

func LatToY

func LatToY(lat float64) float64

LatToY converts from Latitude to a Y coordinate in WebMercator.

func LonToX

func LonToX(lon float64) float64

LonToX converts from a Longitude to a X coordinate in WebMercator.

func PLatToY added in v0.2.0

func PLatToY(lat float64) float64

func PLonToX added in v0.2.0

func PLonToX(lon float64) float64

func PToLonLat added in v0.2.0

func PToLonLat(c ...float64) ([]float64, error)

PToLonLat given a set of coordinates (x,y) it will convert them to Lon/Lat coordinates. If more then x,y is given (i.e. z, and m) they will be returned untransformed.

func PToXY added in v0.2.0

func PToXY(c ...float64) ([]float64, error)

PToXY given a set of coordinates (lon,lat) it will convert them to X,Y coordinates. If more then lon/lat is given (i.e. z, and m) they will be returned untransformed.

func PXToLon added in v0.2.0

func PXToLon(x float64) float64

func PYToLat added in v0.2.0

func PYToLat(y float64) float64

func ToLonLat

func ToLonLat(c ...float64) ([]float64, error)

ToLonLat given a set of coordinates (x,y) it will convert them to Lon/Lat coordinates. If more then x,y is given (i.e. z, and m) they will be returned untransformed.

func ToXY

func ToXY(c ...float64) ([]float64, error)

ToXY given a set of coordinates (lon,lat) it will convert them to X,Y coordinates. If more then lon/lat is given (i.e. z, and m) they will be returned untransformed.

func XToLon

func XToLon(x float64) float64

XToLon converts from X coordinate in WebMercator to Lontitude in WGS84

func YToLat

func YToLat(y float64) float64

YToLat converts from Y coordinate in WebMercator to Latitude in WGS84

Types

This section is empty.

Jump to

Keyboard shortcuts

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