Search code examples
google-mapsgoogle-street-viewgoogle-maps-urls

Google Street View URL for Mobile - different results than Desktop


The same URL gives different results via Mobile & Desktop. A certain URL format for street view displays different results on different devices.

This is a starting reference for the URL's format: Google street view URL

When I load this URL: http://maps.google.com/maps?q=&layer=c&cbll=40.741895,-73.989308

in chrome via Desktop: I get a street view of a beach

in chrome via Android Mobile device: I get a street view of a street in New York (the correct response)

It seems that google presents via desktop a view (photo) that was made by a user and via Mobile a photo that was made by google.

But in another url: http://maps.google.com/maps?q=&layer=c&cbll=32.0522032,34.7633459

in chrome via Desktop: I get the correct street view, made by google

in chrome via Android Mobile device: "No results found for your search"

I guess this bug doesn't effect Google because they use a different entry point for street views in their services...

My goal is to present a Google Street View in a webview in an Android app and I'm trying to get the correct URL format for that. Does anyone know what is the correct format?


Solution

  • The officially supported and recommended by Google way is using Google Maps URLs. Google Maps URLs allow create universal cross-platform URLs that can be used both on desktop and mobile devices and support street view mode

    The pano action lets you launch a viewer to display Street View images as interactive panoramas. Each Street View panorama provides a full 360-degree view from a single location. Images contain 360 degrees of horizontal view (a full wrap-around) and 180 degrees of vertical view (from straight up to straight down). The pano action launches a viewer that renders the resulting panorama as a sphere with a camera at its center. You can manipulate the camera to control the zoom and the orientation of the camera.

    You example may be rewritten using Google Maps URLs

    https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=40.741895,-73.989308

    However, unfortunately, it gives me a beach street view on desktop. I believe this is a data issue on Google side and you can report a problem to Google using the Report a problem link in bottom right corner of the map.

    In the meantime I can suggest the following workaround. You can use Street View API metadata service to get a pano ID of the point you are interested in

    E.g. https://maps.googleapis.com/maps/api/streetview/metadata?location=40.741895%2C-73.989308&source=outdoor&key=YOUR_API_KEY

    Note that this service is free of charge and doesn't consume your quota

    Street View Static API metadata requests are free to use. No quota is consumed when you request metadata.

    Also it supports a source parameter that allows filter out non-Google panoramas. In aforementioned example I get the following metadata response

    {
      "copyright":"© Google, Inc.",
      "date":"2017-11",
      "location":{
        "lat":40.7419078,
        "lng":-73.9893223
      },
      "pano_id":"qH-ml27SSSYEXUCTT2NrhQ",
      "status":"OK"
    }  
    

    So, now I can create a Google Maps URL using a pano ID that will open expected street view panorama

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

    I hope this helps!