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?
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).
<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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With