Module: GoogleMapsApis::Services::Elevation
- Included in:
- Client
- Defined in:
- lib/google_maps_apis/services/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).
22 23 24 25 26 27 28 |
# File 'lib/google_maps_apis/services/elevation.rb', line 22 def elevation(locations) params = { locations: GoogleMapsApis::Convert.waypoints(locations) } return 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.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/google_maps_apis/services/elevation.rb', line 43 def elevation_along_path(path, samples) if path.kind_of?(String) path = "enc:%s" % path else path = GoogleMapsApis::Convert.waypoints(path) end params = { path: path, samples: samples } return get('/maps/api/elevation/json', params)[:results] end |