-
Notifications
You must be signed in to change notification settings - Fork 9
/
utm_deprecated.go
executable file
·60 lines (55 loc) · 1.96 KB
/
utm_deprecated.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package UTM
// FromLatLonF convert a latitude and longitude to Universal Transverse Mercator coordinates.
// Don't use it. It panics and return no error.
//
// Deprecated: Use FromLatLon functions to converse instead.
func FromLatLonF(lat, lon float64) (easting, northing float64) {
var err error
// Northing always false in this implementation.
easting, northing, _, _, err = FromLatLon(lat, lon, false)
if err != nil {
panic(err)
}
return
}
// Coordinate contains coordinates in the Universal Transverse Mercator coordinate system
//
// Deprecated: Use ToLatLon functions to convert LatLon instead.
type Coordinate struct {
Easting float64
Northing float64
ZoneNumber int
ZoneLetter string
}
// FromLatLon convert a latitude and longitude to Universal Transverse Mercator coordinates
//
// Deprecated: Use FromLatLon functions to convert LatLon instead.
func (point *LatLon) FromLatLon() (coord Coordinate, err error) {
// Northing always false in this implementation.
coord.Easting, coord.Northing, coord.ZoneNumber, coord.ZoneLetter, err = FromLatLon(
point.Latitude, point.Longitude, false)
return
}
// LatLon contains a latitude and longitude
//
// Deprecated: Use FromLatLon functions to convert LatLon instead.
type LatLon struct {
Latitude float64
Longitude float64
}
// ToLatLon convert Universal Transverse Mercator coordinates to a latitude and longitude
// Since the zone letter is not strictly needed for the conversion you may also
// the "northern" parameter instead, which is a named parameter and can be set
// to either true or false. In this case you should define fields clearly
// You can't set ZoneLetter or northern both.
//
// Deprecated: Use ToLatLon functions to convert LatLon instead.
func (coordinate *Coordinate) ToLatLon(northern ...bool) (LatLon, error) {
latitude, longitude, err := ToLatLon(
coordinate.Easting,
coordinate.Northing,
coordinate.ZoneNumber,
coordinate.ZoneLetter,
northern...)
return LatLon{latitude, longitude}, err
}