Home

Awesome

wgs84

go.dev reference Go Report Card golangci-lint Codecov GitHub tag (latest SemVer)

A zero-dependency Go package for coordinate transformations.

go get github.com/wroge/wgs84

Usage

east, north, h := wgs84.LonLat().To(wgs84.ETRS89UTM(32)).Round(2)(9, 52, 0)
// 500000 5.76103821e+06 0

east, north, h := wgs84.To(wgs84.WebMercator())(9, 52, 0)
// 1.0018754171394621e+06 6.800125454397305e+06 -9.313225746154785e-10

epsg := wgs84.EPSG()

lon, lat, h := wgs84.ETRS89UTM(32).To(epsg.Code(4326)).Round(3)(500150, 5761200, 0)
// 9.002 52.001 0

// EPSG-Codes covering the coordinate {longitude: 9, latitude: 52}:
codes := epsg.CodesCover(9, 52)
// [25832 4314 32632 4978 4258 31467 4326 3857 900913]

Features