Google street view URL
Asked Answered
C

5

61

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 directly there. Is there any thing I can append to the url to make it switch to streetview without having the exact coordinates? I dont't want to code any javascript or flash.

Copra answered 23/12, 2008 at 1:46 Comment(0)
S
25

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...)

Scenic answered 23/12, 2008 at 4:33 Comment(6)
Thanks that site was what I was looking for. The problem is that streetview requires exact coordinates. The sollution was to first call it with output=kml, it sends back a simple xml then re call it with cbll= ...Copra
Glad that worked out for you. As I mentioned, you still need to get the angles for the cbp variable, but at least you'll get the right spot. At a minimum "&cbp=12,,,," gets you something to see, though.Scenic
The list of parameters link is broken.Genny
@Knownasilya Thanks - Someone appears to have mirrored it at asnsblues.blogspot.com.au/2011/11/… but I'll try to find an authoritative source...Scenic
In that case, how do sites like imstreetview.com and instantstreetview.com work?Amorino
@Amorino Good question, interesting sites. The answer I gave was correct in 2008 - they may have added that information to the geocoding API, or the google maps API since then. I'll check it sometime and see if I can figure it out.Scenic
B
161

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

Boddie answered 12/2, 2009 at 19:56 Comment(6)
Using the parameters layer=c&cbll= is at least still working for me.Baum
See my answer below for latest version of the Google Street View Get-API (10/2018). (Supplement to this above was rejected.)Urbanist
August 2019 Street View from url with lat/lon and layer='c' works in iOS, macOS, did not work in Android? Android removed the query parametersMileage
This is not answering the original question "switch to streetview without having the exact coordinates"Miru
interesting that the default zoom of 0, still has a little bit of zoom-out possible when you load the URL in your browser.Greaseball
This URL format doesn't work on iOS to open Google Maps app into street view. See @Marassa's answer below for a URL format that does work on iOS: https://mcmap.net/q/321461/-google-street-view-urlRood
S
25

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...)

Scenic answered 23/12, 2008 at 4:33 Comment(6)
Thanks that site was what I was looking for. The problem is that streetview requires exact coordinates. The sollution was to first call it with output=kml, it sends back a simple xml then re call it with cbll= ...Copra
Glad that worked out for you. As I mentioned, you still need to get the angles for the cbp variable, but at least you'll get the right spot. At a minimum "&cbp=12,,,," gets you something to see, though.Scenic
The list of parameters link is broken.Genny
@Knownasilya Thanks - Someone appears to have mirrored it at asnsblues.blogspot.com.au/2011/11/… but I'll try to find an authoritative source...Scenic
In that case, how do sites like imstreetview.com and instantstreetview.com work?Amorino
@Amorino Good question, interesting sites. The answer I gave was correct in 2008 - they may have added that information to the geocoding API, or the google maps API since then. I'll check it sometime and see if I can figure it out.Scenic
C
17

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)

Caster answered 3/7, 2019 at 12:27 Comment(0)
U
14

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.

Urbanist answered 30/10, 2018 at 20:8 Comment(0)
T
5

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

Talcahuano answered 27/4, 2010 at 22:46 Comment(1)
This does not work any more. Gives you a link without the parameters like goo.gl/maps/bCB8w3xUy4A2Urbanist

© 2022 - 2024 — McMap. All rights reserved.