Class: GoogleMapsPlatform::StreetViewApiController
- Inherits:
-
BaseController
- Object
- BaseController
- GoogleMapsPlatform::StreetViewApiController
- Defined in:
- lib/google_maps_platform/controllers/street_view_api_controller.rb
Overview
StreetViewApiController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#street_view(size, fov: nil, heading: nil, location: nil, pano: nil, pitch: nil, radius: nil, return_error_code: nil, signature: nil, source: nil) ⇒ ApiResponse
The Street View Static API lets you embed a static (non-interactive) Street View panorama or thumbnail into your web page, without the use of JavaScript.
-
#street_view_metadata(heading: nil, location: nil, pano: nil, pitch: nil, radius: nil, return_error_code: nil, signature: nil, size: nil, source: nil) ⇒ ApiResponse
The Street View Static API metadata requests provide data about Street View panoramas.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from GoogleMapsPlatform::BaseController
Instance Method Details
#street_view(size, fov: nil, heading: nil, location: nil, pano: nil, pitch: nil, radius: nil, return_error_code: nil, signature: nil, source: nil) ⇒ ApiResponse
The Street View Static API lets you embed a static (non-interactive) Street View panorama or thumbnail into your web page, without the use of JavaScript. The viewport is defined with URL parameters sent through a standard HTTP request, and is returned as a static image. image in pixels. Must not exceed 640 pixels wide or high, anything over will default to 640 pixels. Size is specified as ‘widthxheight` - for example, `size=600x400` returns an image 600 pixels wide, and 400 high. view of the image. The field of view is expressed in degrees, with a maximum allowed value of 120. When dealing with a fixed-size viewport, as with a Street View image of a set size, field of view in essence represents zoom, with smaller numbers indicating a higher level of zoom. Default is 90. of the camera. Accepted values are from 0 to 360 (both values indicating North, with 90 indicating East, and 180 South). If no heading is specified, a value will be calculated that directs the camera towards the specified location, from the point at which the closest photograph was taken. retrieve place information. The Street View Static API will snap to the panorama photographed closest to this location. When an address text string is provided, the API may use a different camera location to better display the specified location. When a lat/lng is provided, the API searches a 50 meter radius for a photograph closest to this location. Because Street View imagery is periodically refreshed, and photographs may be taken from slightly different positions each time, it’s possible that your location may snap to a different panorama when imagery is updated. generally stable, though panoramas may change ID over time as imagery is refreshed. the camera relative to the Street View vehicle. This is often, but not always, flat horizontal. Positive values angle the camera up (with 90 degrees indicating straight up); negative values angle the camera down (with -90 indicating straight down). Default is 0. meters, in which to search for a panorama, centered on the given latitude and longitude. Valid values are non-negative integers. Default is 50 meters. Indicates whether the API should return a non ‘200 Ok` HTTP status when no image is found (`404 NOT FOUND`), or in response to an invalid request (400 BAD REQUEST). Valid values are true and false. If set to true, an error message is returned in place of the generic gray image. This eliminates the need to make a separate call to check for image availability. verify that any site generating requests using your API key is authorized to do so. Requests that do not include a digital signature might fail. For more information, see [Get a Key and Signature](developers.google.com/maps/documentation/streetview/get -api-key). selected sources. Valid values are: * default uses the default sources for Street View; searches are not limited to specific sources. * outdoor limits searches to outdoor collections. Indoor collections are not included in search results. Note that outdoor panoramas may not exist for the specified location. Also note that the search only returns panoramas where it’s possible to determine whether they’re indoors or outdoors. For example, PhotoSpheres are not returned because it’s unknown whether they are indoors or outdoors.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/google_maps_platform/controllers/street_view_api_controller.rb', line 74 def street_view(size, fov: nil, heading: nil, location: nil, pano: nil, pitch: nil, radius: nil, return_error_code: nil, signature: nil, source: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/maps/api/streetview', Server::DEFAULT) .query_param(new_parameter(size, key: 'size') .is_required(true)) .query_param(new_parameter(fov, key: 'fov')) .query_param(new_parameter(heading, key: 'heading')) .query_param(new_parameter(location, key: 'location')) .query_param(new_parameter(pano, key: 'pano')) .query_param(new_parameter(pitch, key: 'pitch')) .query_param(new_parameter(radius, key: 'radius')) .query_param(new_parameter(return_error_code, key: 'return_error_code')) .query_param(new_parameter(signature, key: 'signature')) .query_param(new_parameter(source, key: 'source')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('ApiKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:dynamic_deserializer)) .is_api_response(true)) .execute end |
#street_view_metadata(heading: nil, location: nil, pano: nil, pitch: nil, radius: nil, return_error_code: nil, signature: nil, size: nil, source: nil) ⇒ ApiResponse
The Street View Static API metadata requests provide data about Street View panoramas. Using the metadata, you can find out if a Street View image is available at a given location, as well as getting programmatic access to the latitude and longitude, the panorama ID, the date the photo was taken, and the copyright information for the image. Accessing this metadata allows you to customize error behavior in your application. of the camera. Accepted values are from 0 to 360 (both values indicating North, with 90 indicating East, and 180 South). If no heading is specified, a value will be calculated that directs the camera towards the specified location, from the point at which the closest photograph was taken. retrieve place information. The Street View Static API will snap to the panorama photographed closest to this location. When an address text string is provided, the API may use a different camera location to better display the specified location. When a lat/lng is provided, the API searches a 50 meter radius for a photograph closest to this location. Because Street View imagery is periodically refreshed, and photographs may be taken from slightly different positions each time, it’s possible that your location may snap to a different panorama when imagery is updated. generally stable, though panoramas may change ID over time as imagery is refreshed. the camera relative to the Street View vehicle. This is often, but not always, flat horizontal. Positive values angle the camera up (with 90 degrees indicating straight up); negative values angle the camera down (with -90 indicating straight down). Default is 0. meters, in which to search for a panorama, centered on the given latitude and longitude. Valid values are non-negative integers. Default is 50 meters. Indicates whether the API should return a non ‘200 Ok` HTTP status when no image is found (`404 NOT FOUND`), or in response to an invalid request (400 BAD REQUEST). Valid values are true and false. If set to true, an error message is returned in place of the generic gray image. This eliminates the need to make a separate call to check for image availability. verify that any site generating requests using your API key is authorized to do so. Requests that do not include a digital signature might fail. For more information, see [Get a Key and Signature](developers.google.com/maps/documentation/streetview/get -api-key). image in pixels. Size is specified as `widthxheight` - for example, `size=600x400` returns an image 600 pixels wide, and 400 high. selected sources. Valid values are: * default uses the default sources for Street View; searches are not limited to specific sources. * outdoor limits searches to outdoor collections. Indoor collections are not included in search results. Note that outdoor panoramas may not exist for the specified location. Also note that the search only returns panoramas where it’s possible to determine whether they’re indoors or outdoors. For example, PhotoSpheres are not returned because it’s unknown whether they are indoors or outdoors.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/google_maps_platform/controllers/street_view_api_controller.rb', line 167 def (heading: nil, location: nil, pano: nil, pitch: nil, radius: nil, return_error_code: nil, signature: nil, size: nil, source: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/maps/api/streetview/metadata', Server::DEFAULT) .query_param(new_parameter(heading, key: 'heading')) .query_param(new_parameter(location, key: 'location')) .query_param(new_parameter(pano, key: 'pano')) .query_param(new_parameter(pitch, key: 'pitch')) .query_param(new_parameter(radius, key: 'radius')) .query_param(new_parameter(return_error_code, key: 'return_error_code')) .query_param(new_parameter(signature, key: 'signature')) .query_param(new_parameter(size, key: 'size')) .query_param(new_parameter(source, key: 'source')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('ApiKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StreetViewResponse.method(:from_hash)) .is_api_response(true)) .execute end |