forked from icrowley/fake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geo.go
57 lines (47 loc) · 1.13 KB
/
geo.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
package fake
// Latitute generates latitude
func Latitute() float32 {
return r.Float32() * 180 / 90
}
// LatitudeDegress generates latitude degrees (from -180 to 180)
func LatitudeDegress() int {
return r.Intn(360) - 180
}
// LatitudeMinutes generates latitude minutes (from 0 to 60)
func LatitudeMinutes() int {
return r.Intn(60)
}
// LatitudeSeconds generates latitude seconds (from 0 to 60)
func LatitudeSeconds() int {
return r.Intn(60)
}
// LatitudeDirection generates latitude direction (N(orth) o S(outh))
func LatitudeDirection() string {
if r.Intn(2) == 0 {
return "N"
}
return "S"
}
// Longitude generates longitude
func Longitude() float32 {
return r.Float32()*360 - 180
}
// LongitudeDegrees generates longitude degrees (from -180 to 180)
func LongitudeDegrees() int {
return r.Intn(360) - 180
}
// LongitudeMinutes generates (from 0 to 60)
func LongitudeMinutes() int {
return r.Intn(60)
}
// LongitudeSeconds generates (from 0 to 60)
func LongitudeSeconds() int {
return r.Intn(60)
}
// LongitudeDirection generates (W(est) or E(ast))
func LongitudeDirection() string {
if r.Intn(2) == 0 {
return "W"
}
return "E"
}