I am passing lat and lng variables and display google sreet view in a div. The problem is that when the StreetView is unavilable then nothing is displayed. I would like to c
You may want to check out the following reference:
Determining whether a road supports Street View by visual inspection of the
GStreetviewOverlayis not often feasible, or desirable from a user's perspective. For that reason, the API provides a service which programmatically requests and retrieves Street View data. This service is facilitated through use of theGStreetviewClientobject.
Basically you can use the getNearestPanoramaLatLng() method of the GStreetviewClient class, which will return you a GLatLng of the nearest point where street view is available. You can then use the distanceFrom() method to check if the nearest street view point is within a certain threshold from your source point.
Here is a full example, which I believe should be self explanatory:
Google Maps API - Street View Availability