I'm making an app that uses the Google Street View Image API
I have no problem getting an image of the street view based on the address/coordinates
but - I want to detect if the specific address has a Street View image available (in order to show a different behavior for addresses that doesn't have it)
The only idea I got so far is to read the pixels of the returned image and detect whether this is the image the I got when there is no image available
Any other idea?
Thanks!
Google has an api endpoint where you can look up the metadata for a panorama/streetview:
https://maps.googleapis.com/maps/api/streetview/metadata?key=YOUR_API_KEY&location=STRING_ADDRESS_OR_LAT_LNG_COORDINATES
You can check the
status
property of the response.Successful Response
Failed Response
@see https://developers.google.com/maps/documentation/streetview/metadata
Using google.maps.StreetViewService.getPanoramaByLocation( latlng, radius, callback()), you can check whether there is a streetview panorama. If there is a streetview panorama, then there must be an image of streetview.
You can refer the reference of google : https://developers.google.com/maps/documentation/javascript/reference#StreetViewService
Or refer to the example of StreetViewService : https://google-developers.appspot.com/maps/documentation/javascript/examples/streetview-service