本文整理匯總了Golang中github.com/cdupuis/strava/activity-namer/Godeps/_workspace/src/googlemaps/github/io/maps.Client.Elevation方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.Elevation方法的具體用法?Golang Client.Elevation怎麽用?Golang Client.Elevation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cdupuis/strava/activity-namer/Godeps/_workspace/src/googlemaps/github/io/maps.Client
的用法示例。
在下文中一共展示了Client.Elevation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
flag.Parse()
var client *maps.Client
var err error
if *apiKey != "" {
client, err = maps.NewClient(maps.WithAPIKey(*apiKey))
} else if *clientID != "" || *signature != "" {
client, err = maps.NewClient(maps.WithClientIDAndSignature(*clientID, *signature))
} else {
usageAndExit("Please specify an API Key, or Client ID and Signature.")
}
check(err)
r := &maps.ElevationRequest{}
if *samples > 0 {
r.Samples = *samples
}
if *locations != "" {
l, err := decodeLocations(*locations)
check(err)
r.Locations = l
}
if *path != "" {
p, err := decodePath(*path)
check(err)
r.Path = p
}
resp, err := client.Elevation(context.Background(), r)
if err != nil {
log.Fatalf("Could not request elevations: %v", err)
}
pretty.Println(resp)
}