1

All of the sudden I appear to be getting inaccurate status codes from the Google Maps Javascript API. For example, with this code:

sv.getPanorama({
    location: {lat: 35.685, lng: 139.7514}, 
    radius: 350
  }, function(data, status) {
    console.log("getPano() location = "+data.location.latLng);
    console.log("getPano() panoID = "+data.location.pano);
    console.log("getPano() status = "+status);
});

With this, I get the following output:

new getPano() location = (35.685175, 139.75279950000004)
getPano() panoID = F:-2eRkGOODHZg/VtKZ7EGeepI/AAAAAAAADLY/Fvhw3HeTfXcAVq0wuHxq22LnoTtpeUx2A
getPano() status = OK

When I try to build a request URL based on this data, such as:

https://maps.googleapis.com/maps/api/streetview?size=640x540&location=35.685175,139.75279950000004

or with the pano ID:

https://maps.googleapis.com/maps/api/streetview?size=640x540&pano=F:-2eRkGOODHZg/VtKZ7EGeepI/AAAAAAAADLY/Fvhw3HeTfXcAVq0wuHxq22LnoTtpeUx2A

I get the "Sorry, we have no imagery here." image. In other words, even though the status came back as OK, there is no pano available at this location. Visiting Google Maps manually for this latLng bears this out. Google does have satellite imagery for that location, but not a Street View pano.

This code used to work, so I'm confused as to what is going on. Why is the API returning an OK pano status for this location when the panoID and latLng point to no image?

UPDATE: I would appreciate any confirmations that my findings are the same for others (e.g. that it's not something I'm doing wrong), and, any ideas for workarounds. My app is one that pulls up static street view images for latLng locations, but if there isn't a street view image available I shift to satellite. I use the getPanorama() status to determine which direction to take.

kaskader
  • 1,931
  • 16
  • 24
mix
  • 6,943
  • 15
  • 61
  • 90
  • This doesn't look like a valid pano ID: `F:-2eRkGOODHZg/VtKZ7EGeepI/AAAAAAAADLY/Fvhw3HeTfXcAVq0wuHxq22LnoTtpeUx2A` – geocodezip Aug 19 '16 at 11:22
  • that's the pano ID the API gives me for that latLng. is there some alternative method of checking/verifying the ID? – mix Aug 19 '16 at 16:44
  • Is this the correct place: [fiddle](http://jsfiddle.net/b4pzs6dn/)? If so, have you URL encoded the URL? – geocodezip Aug 19 '16 at 17:57
  • That looks like the place, but I'm trying to get static images not the panoramic viewer. Here's a fiddle that demonstrates my problem: https://jsfiddle.net/forgetcolor/d7m8xtxt/2/ – mix Aug 19 '16 at 18:29
  • Just in case, I tried encoding the panoID with `encodeURIComponent()`, but no difference: https://jsfiddle.net/forgetcolor/chwq7bap/1/ – mix Aug 19 '16 at 18:38

3 Answers3

1

Since a few days ago, google.maps.StreetViewService.getPanorama() is indeed returning panos that cannot be displayed in the JavaScript API.

This is an issue in the API, please start it on the issue tracker to get updates:

Issue 10335: Bug: StreetViewService getPanorama() reporting incorrect status for many latLng pairs

kaskader
  • 1,931
  • 16
  • 24
1

The new Street View Image Metadata API will let you query for the availability of Street View panoramas at given locations, and it will only return panoramas that are actually available in the Street View Image API. This will get you rid of Issue 10335.

Locations may be specified by address or latlng. If a panorama is found, the response will include the pano ID, to use in the Street View Image API request. These metadata queries are free of charge.

miguev
  • 4,481
  • 21
  • 41
0

There is a separate feature request in the public issue tracker to enable access to panoramas with a pano ID like F:-2eRkGOODHZg/VtKZ7EGeepI/AAAAAAAADLY/Fvhw3HeTfXcAVq0wuHxq22LnoTtpeUx2A in the Street View Image API:

https://issuetracker.google.com/issues/35829459

If you are interested in this feature please star the feature request to add your vote.

UPDATE

The feature request that I mentioned before is now marked as Fixed.

Google implemented access to User Generated content via the Street View Image API. However, the pano ID format has been changed during this process.

For example, you mentioned the pano ID F:-2eRkGOODHZg/VtKZ7EGeepI/AAAAAAAADLY/Fvhw3HeTfXcAVq0wuHxq22LnoTtpeUx2A.

Now the new pano ID for this panorama is CAMSRi0yZVJrR09PREhaZy9WdEtaN0VHZWVwSS9BQUFBQUFBQURMWS9Gdmh3M0hlVGZYY0FWcTB3dUh4cTIyTG5vVHRwZVV4MkE.

You can easily convert previous pano IDs to the new ones using the Street View Image Metadata requests that are free of charge and don't consume your quota:

https://maps.googleapis.com/maps/api/streetview/metadata?pano=F%3A-2eRkGOODHZg%2FVtKZ7EGeepI%2FAAAAAAAADLY%2FFvhw3HeTfXcAVq0wuHxq22LnoTtpeUx2A&key=YOUR_API_KEY

{
    "copyright":"© Alberto Saito","date":"2016-02",
    "location":{
        "lat":35.685175,
        "lng":139.7527995
    },"pano_id":"CAMSRi0yZVJrR09PREhaZy9WdEtaN0VHZWVwSS9BQUFBQUFBQURMWS9Gdmh3M0hlVGZYY0FWcTB3dUh4cTIyTG5vVHRwZVV4MkE.",
    "status":"OK"
}

Now apply the new pano ID and enjoy:

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

xomena
  • 31,125
  • 6
  • 88
  • 117