mirror of
https://github.com/imjasonh/staticmaps
synced 2026-07-08 19:05:09 +00:00
Add doc comments for Elevation API methods
This commit is contained in:
parent
9deaf93c7f
commit
029522f23a
1 changed files with 21 additions and 2 deletions
23
elevation.go
23
elevation.go
|
|
@ -5,6 +5,9 @@ import (
|
|||
"net/url"
|
||||
)
|
||||
|
||||
// Elevation requests elevation data for a series of locations.
|
||||
//
|
||||
// See https://developers.google.com/maps/documentation/elevation/
|
||||
func (c Client) Elevation(ll []LatLng) ([]ElevationResult, error) {
|
||||
var r elevationResponse
|
||||
if err := c.doDecode(baseURL+elevation(ll), &r); err != nil {
|
||||
|
|
@ -16,6 +19,9 @@ func (c Client) Elevation(ll []LatLng) ([]ElevationResult, error) {
|
|||
return r.Results, nil
|
||||
}
|
||||
|
||||
// ElevationPolyline requests elevation data for a series of locations as specified as an encoded polyline.
|
||||
//
|
||||
// See https://developers.google.com/maps/documentation/elevation/#Locations
|
||||
func (c Client) ElevationPolyline(p string) ([]ElevationResult, error) {
|
||||
var r elevationResponse
|
||||
if err := c.doDecode(baseURL+elevationpoly(p), &r); err != nil {
|
||||
|
|
@ -27,6 +33,7 @@ func (c Client) ElevationPolyline(p string) ([]ElevationResult, error) {
|
|||
return r.Results, nil
|
||||
}
|
||||
|
||||
// ElevationPath requests elevation data for a number of samples along a path described as a series of locations.
|
||||
func (c Client) ElevationPath(ll []LatLng, samples int) ([]ElevationResult, error) {
|
||||
var r elevationResponse
|
||||
if err := c.doDecode(baseURL+elevationpath(ll, samples), &r); err != nil {
|
||||
|
|
@ -38,6 +45,7 @@ func (c Client) ElevationPath(ll []LatLng, samples int) ([]ElevationResult, erro
|
|||
return r.Results, nil
|
||||
}
|
||||
|
||||
// ElevationPathPoly requests elevation data for a number of samples along a path described as a series of locations specified as an encoded polyline.
|
||||
func (c Client) ElevationPathPoly(p string, samples int) ([]ElevationResult, error) {
|
||||
var r elevationResponse
|
||||
if err := c.doDecode(baseURL+elevationpathpoly(p, samples), &r); err != nil {
|
||||
|
|
@ -79,8 +87,19 @@ type elevationResponse struct {
|
|||
Results []ElevationResult `json:"results"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// ElevationResult describes elevation data.
|
||||
type ElevationResult struct {
|
||||
Elevation float64 `json:"elevation"`
|
||||
Location LatLng `json:"location"`
|
||||
// Elevation is elevation of the location in meters.
|
||||
Elevation float64 `json:"elevation"`
|
||||
|
||||
// Location is the location of the location being described.
|
||||
Location LatLng `json:"location"`
|
||||
|
||||
// Resolution is the maximum distance between data points from which the elevation was interpolated, in meters.
|
||||
//
|
||||
// This property will be zero if the resolution is not known. Note that elevation data becomes
|
||||
// more coarse (larger Resolution values) when multiple points are passed. To obtain the most
|
||||
// accurate elevation value for a point, it should be queried independently.
|
||||
Resolution float64 `json:"resolution"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue