Use pano id of new photo spheres with Google Streetview Image API

558 views Asked by At

I want to take the pano ID from a Google Streetview photosphere (e.g. this one: https://www.google.com/maps/@52.5162672,13.3777133,3a,75y,90t/data=!3m7!1e1!3m5!1s-C3h-fjBdBFo%2FWCz53BtP3dI%2FAAAAAAAAEok%2F2KEziwlh5e4SYRpoC1vnn0hQydXo9HpiACLIB!2e4!3e12!7i9000!8i4500) to receive static images with the help of the Streetview Image API. I am aware of the fact that there is a "pano" field which takes a pano ID, however Google seems to have changed the way the pano IDs look like. From what I understand the ID from the above link should be

"-C3h-fjBdBFo/WCz53BtP3dI/AAAAAAAAEok/2KEziwlh5e4SYRpoC1vnn0hQydXo9HpiACLIB"

(i.e. the part between !1s and !2e).

Pasting this ID into the Streetview API (http://maps.googleapis.com/maps/api/streetview?fov=120&pano=-C3h-fjBdBFo%2FWCz53BtP3dI%2FAAAAAAAAEok%2F2KEziwlh5e4SYRpoC1vnn0hQydXo9HpiACLIB&pitch=0&sensor=false&heading=36.9998231626&size=640x640) doesn't give me an image.

Am I missing something?

2

There are 2 answers

0
xomena On BEST ANSWER

Indeed, photo spheres weren't available in the Streetview Image API, but recently Google enabled access to User Generated content via Streetview Image API.

The important detail is that the pano ID format that you mentioned in this question was replaced by the new format.

Now the pano ID F:-C3h-fjBdBFo/WCz53BtP3dI/AAAAAAAAEok/2KEziwlh5e4SYRpoC1vnn0hQydXo9HpiACLIB from your question should be replaced by the new pano ID CAMSSi1DM2gtZmpCZEJGby9XQ3o1M0J0UDNkSS9BQUFBQUFBQUVvay8yS0V6aXdsaDVlNFNZUnBvQzF2bm4waFF5ZFhvOUhwaUFDTElC.

You can easily convert the previous pano ID to the new format using the Streetview Image Metadata requests. These requests are free of charge and don't consume a quota

https://maps.googleapis.com/maps/api/streetview/metadata?pano=F%3A-C3h-fjBdBFo%2FWCz53BtP3dI%2FAAAAAAAAEok%2F2KEziwlh5e4SYRpoC1vnn0hQydXo9HpiACLIB&key=YOUR_API_KEY

{
    "copyright":"© miguel angel Victoria",
    "date":"2016-11",
    "location":{
        "lat":52.51626719999999,
        "lng":13.3777133
    }, "pano_id":"CAMSSi1DM2gtZmpCZEJGby9XQ3o1M0J0UDNkSS9BQUFBQUFBQUVvay8yS0V6aXdsaDVlNFNZUnBvQzF2bm4waFF5ZFhvOUhwaUFDTElC",
   "status":"OK"
}

Use the new pano ID to retrieve photo sphere:

https://maps.googleapis.com/maps/api/streetview?pano=CAMSSi1DM2gtZmpCZEJGby9XQ3o1M0J0UDNkSS9BQUFBQUFBQUVvay8yS0V6aXdsaDVlNFNZUnBvQzF2bm4waFF5ZFhvOUhwaUFDTElC&size=600x400&key=YOUR_API_KEY

0
Tim Oesterreich On

To anyone having the same question:

There is an open "feature request" (though I still think it's a bug) for this issue: https://code.google.com/p/gmaps-api-issues/issues/detail?id=10402&q=apitype%3AStreetView&sort=-stars&colspec=ID%20Type%20Status%20Summary%20Internal%20Stars