Avoiding “Sorry, we have no imagery here” with Goo

2020-08-26 04:02发布

问题:

I'm writing a Google Maps application, for the most part it works fine. But if I request walking directions between 2 points that are very close to each other (like 2 buildings that are next door to 1 another), the map zooms in so close that the hybrid images turns to tiles reading "Sorry, we have no imagery here."

From debugging notes in my code, it appears that the zoom level of the map isn't being set until after the function that updates the DirectionsRenderer runs (adding a map.getZoom() call shows me the map's zoom property for the previous round of directions I requested.

Because of this, MazZoomService isn't really doing me much good either. Is there a way to detect what the zoom level of the map will be when processing directions so I can zoom the image back out to something that doesn't show an error message?

回答1:

Use the MaxZoomService inside of the map's "zoom_changed" event. If the current zoom level is greater than the max, map.setZoom(max).

If you wish to only enable this behavior from the results of a DirectionsRenderer update, you'll need to set a flag and possibly a timer (DirectionsRenderer doesn't always change the map zoom level).



回答2:

<meta http-equiv="Content-Security-Policy" content="default-src *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; img-src * data: 'unsafe-inline'">--add this tag in header.



回答3:

I was having this issue in an angular app, I am writing.

It turned out that my Content Security Policy was blocking Google, which in turn stopped all images from loading and threw the error "Sorry, we have no imagery here." As soon as I added Google URL into my Content Security Policy and everything went back to normal!



回答4:

I had this experience when I switch from satellite to map option. At this point the zoom setting was 18. I decided to reduce the zoom size downwards. At the zoom size of 12 and below, the imagery error was resolved and the map image shows well.



回答5:

I had the same error, the map was showing different tiles with the message "sorry we have no imagery error". But, the underlying problem was different. Since the question title is generic, I added the answer so it may help someone.

On some inspections, I found that the error was because the lat, long (coordinates) values which were dynamically retrieved from the database were null values. So, you may check if you are passing the invalid coordinates in the map init function.

update Interchange of lat and long values may also cause the problem if the combination is invalid.