-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgooglemaps.go
45 lines (44 loc) · 1.37 KB
/
googlemaps.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
package main
// GoogleMapsData uses the Google Maps API to return information
// about a location entered by the user. The DarkSky API can only
// accept geographical coordinates, which are provided in the
// GoogleMapsData struct as Lat and Lng.
//
// GoogleMapsData.Results[0].Geometry.Location.Lat
// GoogleMapsData.Results[0].Geometry.Location.Lng
//
// Add a Google Maps API key to your .env file.
type GoogleMapsData struct {
Results []struct {
AddressComponents []struct {
LongName string `json:"long_name"`
ShortName string `json:"short_name"`
Types []string `json:"types"`
} `json:"address_components"`
FormattedAddress string `json:"formatted_address"`
Geometry struct {
Location struct {
Lat float64 `json:"lat"`
Lng float64 `json:"lng"`
} `json:"location"`
LocationType string `json:"location_type"`
Viewport struct {
Northeast struct {
Lat float64 `json:"lat"`
Lng float64 `json:"lng"`
} `json:"northeast"`
Southwest struct {
Lat float64 `json:"lat"`
Lng float64 `json:"lng"`
} `json:"southwest"`
} `json:"viewport"`
} `json:"geometry"`
PlaceID string `json:"place_id"`
PlusCode struct {
CompoundCode string `json:"compound_code"`
GlobalCode string `json:"global_code"`
} `json:"plus_code"`
Types []string `json:"types"`
} `json:"results"`
Status string `json:"status"`
}