Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoiding "Sorry, we have no imagery here" with Google Maps

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?

like image 625
Eric Hydrick Avatar asked May 10 '12 03:05

Eric Hydrick


2 Answers

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).

like image 138
Chad Killingsworth Avatar answered Sep 21 '22 18:09

Chad Killingsworth


<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.

like image 24
ShriKant A Avatar answered Sep 21 '22 18:09

ShriKant A