Google Maps Javascript - 放大时禁用3d视图

时间:2018-06-15 19:41:35

标签: javascript google-maps google-apps-script google-api google-apps

有没有办法在放大时禁止谷歌地图进入3D模式?

我想保持这样,只是放大: here

但是当我放大当前时,它会渲染3D: here

1 个答案:

答案 0 :(得分:2)

这是Satellite视图中的45-degree imagery。初始化地图时,您可以在MapOptions中设置tilt: 0,以避免在非常接近放大时使用该图像的地图。这是一个simple sample JSBin

<!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;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: new google.maps.LatLng(37.422009,-122.084302),
          tilt: 0,
          mapTypeId: "satellite",
          zoom: 19
        });
      }
    </script>
    <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&callback=initMap"
    async defer></script>
  </body>
</html>