Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps Javascript API not loading closest zoom level?

Today I noticed that the closest available zoom level of satellite imagery was removed in a particular area (it may affect other areas but I am just focussing on one area that is definitely affected). Two days ago level 20 was available, now only level 19.

MaxZoomService still says the closest available zoom at this location is 20. But when map is at level 19, pressing the + zoom button does not increase zoom to level 20.

Is there are reason why I cannot zoom to level 20 when it says it's available?

Some theoretical explanations (all unconfirmed) include:

  1. Zoom level 20 was recently removed but the MaxZoomService has not been updated and is showing the old value
  2. Level 20 is temporarily broken at this location and will be restored soon (e.g. perhaps they are reprocessing the imagery tiles for this level?)

(I don't think there's confusion with available depth for top-down vs Oblique because both are locked to level 19).

Updates:

  • Map Tiles at level 20 that were previously loading still exist at the old URLs, they are just not loaded in the Javascript API Map. Perhaps this lends weight to the explanation that it's just a temporary issue with the service which lists available imagery layers?
  • Seems to be an issue globally, not an isolated geographic area
  • Changing to an earlier version of Google Maps Javascript API (e.g. adding ?v=3.29) does not appear to resolve the problem

See live example: https://jsfiddle.net/3qojzt76/

<!DOCTYPE html>
<html>
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
    <style>
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var map;
      
      var latlng = {lat: 37.8768101, lng: -122.2813413}
      
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          mapTypeId: google.maps.MapTypeId.SATELLITE,
          tilt: 0,
          center: latlng,
          zoom: 19
        });
        
        var mapZoomService = new google.maps.MaxZoomService()
        
        mapZoomService.getMaxZoomAtLatLng(latlng, function(MaxZoomResult){
            
            if(google.maps.MaxZoomStatus.OK){
                alert('map.getZoom(): '+map.getZoom()+', MaxZoomResult.zoom: ' + MaxZoomResult.zoom)
            }else{
                alert('Error: in google.maps.MaxZoomService().getMaxZoomAtLatLng()')
            }
        })
        
      }
    </script>
    <script src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap"
    async defer></script>
  </body>
</html>
like image 920
python1981 Avatar asked Jan 07 '18 00:01

python1981


People also ask

How do I zoom precisely on Google Maps?

You can zoom in and out of the map with one hand. Double tap a spot on the map, and then: Drag down to zoom in. Drag up to zoom out.

How do I set Google Maps to max zoom?

Setting up the minimum or maximum Zoom value for Google Maps can be done by adding the shortcode attribute with Store Locator Shortcode. Furthermore, the maximum value of Google Maps Zoom level is 22. Therefore, the defined maximum value must be below or equal to 22, which is the default.

Why is Google Maps API not working?

There are a several reasons why your google maps may not be working, the most common issue being no Google Map API key set or set incorrectly. To use the Google Maps JavaScript API, you must register your app project on the Google Cloud Platform Console and get a Google API key which you can add to your app.


1 Answers

This was a bug with Google Maps Javascript API and has been resolved by Google, as per https://issuetracker.google.com/issues/71715009

like image 108
python1981 Avatar answered Sep 24 '22 11:09

python1981