webmercator

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 4 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 (
	SRID        = 3857
	EarthRadius = RMajor
	Deg2Rad     = math.Pi / 180
	Rad2Deg     = 180 / math.Pi
	PiDiv2      = math.Pi / 2.0
	PiDiv4      = math.Pi / 4.0
	MinXExtent  = -20026376.39
	MinYExtent  = -20048966.10
	MaxXExtent  = 20026376.39
	MaxYExtent  = 20048966.10
)

Variables

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

Functions

func DegToRad added in v0.6.0

func DegToRad(deg float64) float64

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 RadToDeg added in v0.6.0

func RadToDeg(rad 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