4
votes

I'm using google static map api. But following below link

http://maps.googleapis.com/maps/api/staticmap?center=62.995158,106.171875&zoom=15&size=360x360&maptype=satellite

nothing is shown in the image except a message "Sorry, we have no imagery available".

Can anyone help me on how to handle this scenario? I mean to say is that whenever this happens any kind of notification or callback can be written.

1
It would be useful if it returned an error code instead/as well - duncan
Did you add API key? - Verma
Yes, I have added API key. This issue is not because of API Key. Sometimes for some region, the satellite view after a particular zoom level will not be avaible. - Shreeram K

1 Answers

0
votes

EDIT(2019): in November 2016, a new feature was added to the Street View Image API to query for the availability of Street View panoramas at given locations (address or latlng), or even pano IDs. These queries are free of charge. This had been requested precisely to deal with the "Sorry we have no imagery here" status. See Street View Image Metadata documentation for more details.

The API only ever return images, and it'd break the user experience if it didn't.

When no imagery is found (or you run out of quota) the API returns an image with the error so that it's visible form an IMG tag or wherever the image is embedded.

If you'd prefer an error code, I image you'll be downloading the image form the API, checking for the error code, and then sending the image to the user if there was no error. For such scenario, a JSON output would help, but would need to be requested separately from the image itself (e.g. by additional request parameter). This sounds like it'd overlap with:

Issue 6908: Feature Request: Retrieve satellite photo tile date

in that it asks for text-only output. I'd recommend you file a feature request, or at least adding a comment on Issue 6908 to reflect that other details would be interesting to have in a text response.