-
Notifications
You must be signed in to change notification settings - Fork 1
/
wgs84.go
30 lines (25 loc) · 868 Bytes
/
wgs84.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package coordconv
import "fmt"
// DefaultMGRSConverter is a WGS84 ellipsoid based MGRS converter.
var DefaultMGRSConverter *MGRS
// DefaultUTMConverter is a WGS84 ellipsoid based UTM converter.
var DefaultUTMConverter *UTM
// DefaultUPSConverter is a WGS84 ellipsoid based UPS converter.
var DefaultUPSConverter *UPS
func init() {
const semiMajorAxis = 6378137
const flattening = 1 / 298.257223563
var err error
DefaultMGRSConverter, err = NewMGRS(semiMajorAxis, flattening, "WE")
if err != nil {
panic(fmt.Sprintf("error constructing WGS84 MGRS converter: %s", err))
}
DefaultUTMConverter, err = NewUTM()
if err != nil {
panic(fmt.Sprintf("error constructing WGS84 UTM converter: %s", err))
}
DefaultUPSConverter, err = NewUPS(semiMajorAxis, flattening)
if err != nil {
panic(fmt.Sprintf("error constructing WGS84 UPS converter: %s", err))
}
}