Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if Google's Streetview Image API Returns "Sorry, we have no imagery here" (ie. NULL) Result?

The Google Street View Image API lets you embed a static (non-interactive) Street View panorama or thumbnail into your web page, without the use of JavaScript.

Request URL: http://maps.googleapis.com/maps/api/streetview?parameters

+The Problem+

If I give it an address for which it doesn't have a Streetview, it returns an image that says, "Sorry, we have no imagery here".

Based on the current API, I have no way of detecting if it found a Streetview or not. Anyone have a hack or suggestion for figuring this out?

+Examples+

Proper Streetview: http://maps.googleapis.com/maps/api/streetview?size=300x300&sensor=false&location=100+Highland+Ave+Baltimore,+MD+21224

Sorry Streetview: http://maps.googleapis.com/maps/api/streetview?size=300x300&sensor=false&location=1600+Pennsylvania+Ave,+Washington,+DC+20500

like image 737
Mike B. Avatar asked Mar 20 '12 21:03

Mike B.


People also ask

Why does Google Maps say sorry we have no imagery here?

The reason is their image servers are blocking the request from this project (hybrid mobile project - Android) since it found out that there are invalid request is also coming from the project. The invalid request is referred to as the requests without proper header information.

How can you tell when a Google street image was taken?

Select the Street View option (if one is available), and you should see a small label at the bottom of the screen that says “Image Capture,” followed by a month and year. For some locations, Google has a history of Street View photographs available for browsing.

How often does Google update their Street View images?

In general, Google tries to take new Street View photos in major cities once every year. Less populated areas can probably expect new photos every three years or so — but don't be surprised if it takes even longer.

How long does it take for Google to update its Street View?

Afterwards, it takes months to process them. This means that content you see could be anywhere from a few months to a few years old. In some locations where we have collected imagery over many years, you may also be able to view changes to that imagery in our Time Machine function.


1 Answers

Consider using StreetViewService and StreetViewStatus objects in Google Maps: https://developers.google.com/maps/documentation/javascript/streetview#StreetViewService

Essentially what you'll have to do is create a StreetViewService object that will try to find a panorama based on location, using the getPanoramaByLocation(latlng:LatLng, radius:number, callback:function(StreetViewPanoramaData, StreetViewStatus)) method.

In the callback function, have a conditional argument that will check for the data availability if (status == google.maps.StreetViewStatus.OK). Based on the boolean return, execute the desired actions. The first link I provided got a great example of the use of these methods.

Note: I also notice you've got locations based on addresses. This can be simply converted to LatLng using the Geocoding Service ( https://developers.google.com/maps/documentation/javascript/geocoding )

like image 64
Suvi Vignarajah Avatar answered Sep 28 '22 08:09

Suvi Vignarajah