Module: GoogleMapsService::Apis::Elevation
- Included in:
- Client
- Defined in:
- lib/google_maps_service/apis/elevation.rb
Overview
Performs requests to the Google Maps Elevation API.
Instance Method Summary collapse
-
#elevation(locations) ⇒ Array
Provides elevation data for locations provided on the surface of the earth, including depth locations on the ocean floor (which return negative values).
-
#elevation_along_path(path, samples) ⇒ Array
Provides elevation data sampled along a path on the surface of the earth.
Instance Method Details
#elevation(locations) ⇒ Array
Provides elevation data for locations provided on the surface of the earth, including depth locations on the ocean floor (which return negative values).
20 21 22 23 24 25 26 |
# File 'lib/google_maps_service/apis/elevation.rb', line 20 def elevation(locations) params = { locations: GoogleMapsService::Convert.waypoints(locations) } get("/maps/api/elevation/json", params)[:results] end |
#elevation_along_path(path, samples) ⇒ Array
Provides elevation data sampled along a path on the surface of the earth.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/google_maps_service/apis/elevation.rb', line 41 def elevation_along_path(path, samples) path = if path.is_a?(String) "enc:%s" % path else GoogleMapsService::Convert.waypoints(path) end params = { path: path, samples: samples } get("/maps/api/elevation/json", params)[:results] end |