【问题标题】:Street View error街景错误
【发布时间】:2018-02-19 08:43:02
【问题描述】:

最近几天我在我的网站上遇到了一个问题。当试图在地图上切换到街景时 - 将黄人丢在街道上后 - 我得到一个灰色的屏幕(参见屏幕截图)。 我的控制台(在 Chrome 上)显示此错误,在切换时弹出:

未捕获的类型错误:无法重新定义属性:地图 在定义属性() 在 pa (https://maps.googleapis.com/maps-api-v3/api/js/30/5/intl/en_gb/imagery_viewer.js:3:229) 在https://maps.googleapis.com/maps-api-v3/api/js/30/5/intl/en_gb/imagery_viewer.js:7:1https://maps.googleapis.com/maps-api-v3/api/js/30/5/intl/en_gb/imagery_viewer.js:866:268

我过去也遇到过这个问题,但我通过降级我的谷歌地图版本解决了这个问题。 我的 init_map:

function init_map() {
      var myOptions = {
        zoom: 4,
        center: new google.maps.LatLng(48.632909,17.138672),
        panControl: true,
        zoomControl: true,
        mapTypeControl: true,
        mapTypeControlOptions: {
          style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
          position: google.maps.ControlPosition.TOP_RIGHT
        },
        scaleControl: true,
        streetViewControl: true,
        gestureHandling: 'greedy',
        mapStreetViewControlOptions: {
          position: google.maps.ControlPosition.RIGHT_TOP
        },      
        overviewMapControl: false,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      var gmap = new google.maps.Map(document.getElementById("gmap"), myOptions);

我使用的是 3.29,它运行良好,现在,我遇到了 3.31 版本的问题:

<script src="maps.google.com/maps/api/js?v=3.31&key=....."; type="text/javascript"></script>

【问题讨论】:

  • 发布一些代码?
  • 如何加载地图库?可以发一下代码吗?
  • //我已经尝试了所有版本。在 14.02 之前它对我来说可以正常工作,但仅适用于已弃用的 3.29 版。

标签: javascript html google-maps google-maps-api-3 google-street-view


【解决方案1】:

我们遇到了同样的错误字符串,但在加载嵌入地图本身时会看到。看来我们正在另一个(现在未使用的)JS 文件中重新定义函数 Map(),重命名此函数解决了问题。

我并没有完全靠自己得出这个结论,请参阅 Google Product Forums 了解与您描述相同问题的用户。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-29
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 1970-01-01
    相关资源
    最近更新 更多