How to show the streetview in info window for google map for the given address
I am using the Google API for showing the corresponding address in the Map.
Recently i added the street view for the map. but what is my proble开发者_JS百科m is if the street view is not existing for the given address it is showing the blank screen.
so instead of that in the info window itself not to show the street view link.
if the street view is existing only we have to show the street view link.
so how can i resolve the problem?
Thanks, Vara Prasad.M
If I understand you right, you're 'showing the corresponding address in the Map' by reverse geocoding a point on the map to get the street address. So you must know the coordinates of the point. And that must be how you're trying to get the StreetView panorama, by querying the service for that location, as aniri also notes.
So, if there is no StreetView results for the point you're using you can increase the radius in the service call and try again. A recursive method that keeps trying until it hits something within an overall maximum would be my recommendation.
Read here: http://code.google.com/apis/maps/documentation/javascript/services.html#StreetViewService
You can check of there's a street view available using the function getPanoramaByLocation(). If it returns ZERO_RESULTS, you'll know that no street view is available.
Api reference: http://code.google.com/apis/maps/documentation/javascript/reference.html#StreetViewService
精彩评论