Google street view URL

后端 未结 5 1540
心在旅途
心在旅途 2020-11-28 21:18

Hi I have the address of a property and my application can launch a browser to go to http://maps.google.com?q=searchStringHere. If a good match is found it will take it dire

相关标签:
5条回答
  • 2020-11-28 21:34

    Building a Google Street View URL

    Basic Google Map URL http://maps.google.com/maps?q=

    q= Query - anything passed in this parameter is treated as if it had been typed into the query box on the maps.google.com page.

    Basic url to display GPS cords location

    http://maps.google.com/maps?q=31.33519,-89.28720

    http://maps.google.com/maps?q=&layer=c

    layer= Activates overlays. Current options are "t" traffic, "c" street view. Append (e.g. layer=tc) for simultaneous.

    http://maps.google.com/maps?q=&layer=c&cbll=

    cbll= Latitude,longitude for Street View

    http://maps.google.com/maps?q=&layer=c&cbll=31.33519,-89.28720

    http://maps.google.com/maps?q=&layer=c&cbll=31.335198,-89.287204&cbp=

    cbp= Street View window that accepts 5 parameters:

    1. Street View/map arrangement, 11=upper half Street View and lower half map, 12=mostly Street View with corner map

    2. Rotation angle/bearing (in degrees)

    3. Tilt angle, -90 (straight up) to 90 (straight down)

    4. Zoom level, 0-2

    5. Pitch (in degrees) -90 (straight up) to 90 (straight down), default 5

    The one below is: (11) upper half Street View and lower half map, (0) Facing North, (0) Straight Ahead, (0) Normal Zoom, (0) Pitch of 0

    This one works as is, just change the cords and if you want to face a different direction (the 0 after 11) http://maps.google.com/maps?q=&layer=c&cbll=31.335198,-89.287204&cbp=11,0,0,0,0

    For more Google Street View code interpertation

    0 讨论(0)
  • 2020-11-28 21:41

    Update 10/2018

    The GET API (see Haygood's answer) seems to be outdated but some calls still seem to work.

    Base URL:

    changed to http://www.google.com/maps (map.google.com/maps still works but redirects)

    Parameters:

    • q: is ignored, can be skipped For more Google Street View code interpertation

    • layer: The parameter must be set to c (t is no more supported and breaks it)

    • cbll: latitude and longitude (unchanged)
    • cbp: only parameter 2 (rotation angle) and 5 (pitch) are still supported

      1. is ignored, can be 0 or empty string

      2. Rotation angle/bearing (in degrees)

      3. is ignored, can be 0 or empty string

      4. is ignored, can be 0 or empty string

      5. Pitch (in degrees) -90 (straight up) to 90 (straight down)

    Updated examples: http://www.google.com/maps?layer=c&cbll=31.335198,-89.287204

    or http://www.google.com/maps?layer=c&cbll=31.335198,-89.287204&cbp=,30,,,20 with rotation 30 and pitch 20.

    0 讨论(0)
  • 2020-11-28 21:42

    UPDATE 07/2019:

    Solution of 10/2018 still works for me as of now, but I have found an official documented way to construct the Street View URL:

    Forming the Street View URL

    https://www.google.com/maps/@?api=1&map_action=pano&parameters

    Parameters

    • map_action=pano (required): Specifies the type of view to display. Maps and Street View share the same endpoint. To ensure a panorama is displayed, the action must be specified as pano.

    One of the following URL parameters is also required:

    • viewpoint: The viewer displays the panorama photographed closest to the viewpoint location, specified as comma-separated latitude/longitude coordinates (for example 46.414382,10.013988). 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.

    • pano: The specific panorama ID of the image to display. If you specify a pano you may also specify a viewpoint. The viewpoint is only used if Google Maps cannot find the panorama ID. If pano is specified but not found, and a viewpoint is NOT specified, no panorama image is displayed. Instead, Google Maps opens in default mode, displaying a map centered on the user's current location.

    The following URL parameters are optional:

    • heading: Indicates the compass heading of the camera in degrees clockwise from North. Accepted values are from -180 to 360 degrees. If omitted, a default heading is chosen based on the viewpoint (if specified) of the query and the actual location of the image.

    • pitch: Specifies the angle, up or down, of the camera. The pitch is specified in degrees from -90 to 90. Positive values will angle the camera up, while negative values will angle the camera down. The default pitch of 0 is set based on on the position of the camera when the image was captured. Because of this, a pitch of 0 is often, but not always, horizontal. For example, an image taken on a hill will likely exhibit a default pitch that is not horizontal.

    • fov: Determines the horizontal field of view of the image. The field of view is expressed in degrees, with a range of 10 - 100. It defaults to 90. When dealing with a fixed-size viewport, the field of view is considered the zoom level, with smaller numbers indicating a higher level of zoom.

    Example 1: Uses only a viewpoint to specify location.

    https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=48.857832,2.295226&heading=-45&pitch=38&fov=80

    Source: https://developers.google.com/maps/documentation/urls/guide (scroll to the bottom for Street View URLs)

    0 讨论(0)
  • 2020-11-28 21:45

    Unfortunately not - there's no simple answer, based on the address.

    Firstly, the list of parameters for the Google Maps site is documented here, so you can use that as your starting point.

    The easy part is that you need to select the streetview layer "&layer=c".

    However, before anything will display in that layer, you need to specify where your view is. You set the position by the latitude and longitude in cbll and the angle of the camera with some options in cbp.

    To get the latitude and longitude from the address, you need to use a geocoding service, like the google maps api.

    However, this will only get you a street view close to the address. In addition to knowing where the street view needs to be from, you also need to know which angle to point the camera at - this will be different for every address, depending on where the nearest point the StreetView camera took a photo from was, so it's not easy to do automatically (with any information that I know is available...)

    0 讨论(0)
  • 2020-11-28 21:52

    You can get the values by pressing the link button at the top of the street view.

    0 讨论(0)
提交回复
热议问题