Provides elevation data sampled along a path on the surface of the earth. :param path: An encoded polyline string, or a list of latitude/longitude values from which you wish to calculate elevation data. :type path: string, dict, list, or tuple :param samples: The number of
(client, path, samples)
| 38 | |
| 39 | |
| 40 | def elevation_along_path(client, path, samples): |
| 41 | """ |
| 42 | Provides elevation data sampled along a path on the surface of the earth. |
| 43 | |
| 44 | :param path: An encoded polyline string, or a list of latitude/longitude |
| 45 | values from which you wish to calculate elevation data. |
| 46 | :type path: string, dict, list, or tuple |
| 47 | |
| 48 | :param samples: The number of sample points along a path for which to |
| 49 | return elevation data. |
| 50 | :type samples: int |
| 51 | |
| 52 | :rtype: list of elevation data responses |
| 53 | """ |
| 54 | |
| 55 | if type(path) is str: |
| 56 | path = "enc:%s" % path |
| 57 | else: |
| 58 | path = convert.shortest_path(path) |
| 59 | |
| 60 | params = { |
| 61 | "path": path, |
| 62 | "samples": samples |
| 63 | } |
| 64 | |
| 65 | return client._request("/maps/api/elevation/json", params).get("results", []) |