Module: GoogleMapsService::Elevation
- Included in:
- Client
- Defined in:
- lib/google_maps_service/elevation.rb
Overview
Performs requests to the Google Maps Elevation API.
Instance Method Summary collapse
-
#elevation(locations: nil) ⇒ 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: nil, samples: nil) ⇒ Array
Provides elevation data sampled along a path on the surface of the earth.
Instance Method Details
#elevation(locations: nil) ⇒ Array
Provides elevation data for locations provided on the surface of the earth, including depth locations on the ocean floor (which return negative values)
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/google_maps_service/elevation.rb', line 15 def elevation(locations: nil) params = {} if locations.kind_of?(Array) and locations.length == 2 and not locations[0].kind_of?(Array) locations = [locations] end params[:locations] = _convert_locations(locations) return get("/maps/api/elevation/json", params)[:results] end |
#elevation_along_path(path: nil, samples: nil) ⇒ Array
Provides elevation data sampled along a path on the surface of the earth.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/google_maps_service/elevation.rb', line 36 def elevation_along_path(path: nil, samples: nil) if path.kind_of?(String) path = "enc:%s" % path else path = _convert_locations(path) end params = { path: path, samples: samples } return get("/maps/api/elevation/json", params)[:results] end |