webmercator

package
v0.0.0-...-05a1c04 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 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 (
	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

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

func PLatToY(lat float64) float64

func PLonToX

func PLonToX(lon float64) float64

func PToLonLat

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

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

func PXToLon(x float64) float64

func PYToLat

func PYToLat(y float64) float64

func RadToDeg

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