2017-10-13 88 views
2

我有asp.net项目更新谷歌热图

我在查看谷歌热图和需要更新它

这是在客户端脚本代码。

@section scripts { 
<script async defer 
     src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCea6mL2cqwVid2ESIjuJ0C31RbNVQNPY0&libraries=visualization&callback=initMap"> 
</script> 
<script type="text/javascript"> 



    var map, heatmap; 

    function initMap() { 
     map = new google.maps.Map(document.getElementById('map'), 
      { 
       zoom: 13, 
       center: { lat: 55.752622, lng: 37.617567 }, 
       mapTypeId: 'satellite' 
      }); 
     getPoints(); 
    } 

    function toggleHeatmap() { 
     heatmap.setMap(heatmap.getMap() ? null : map); 
    } 

    function changeGradient() { 
     var gradient = [ 
      'rgba(0, 255, 255, 0)', 
      'rgba(0, 255, 255, 1)', 
      'rgba(0, 191, 255, 1)', 
      'rgba(0, 127, 255, 1)', 
      'rgba(0, 63, 255, 1)', 
      'rgba(0, 0, 255, 1)', 
      'rgba(0, 0, 223, 1)', 
      'rgba(0, 0, 191, 1)', 
      'rgba(0, 0, 159, 1)', 
      'rgba(0, 0, 127, 1)', 
      'rgba(63, 0, 91, 1)', 
      'rgba(127, 0, 63, 1)', 
      'rgba(191, 0, 31, 1)', 
      'rgba(255, 0, 0, 1)' 
     ]; 
     heatmap.set('gradient', heatmap.get('gradient') ? null : gradient); 
    } 

    function changeRadius() { 
     heatmap.set('radius', heatmap.get('radius') ? null : 20); 
    } 

    function changeOpacity() { 
     heatmap.set('opacity', heatmap.get('opacity') ? null : 0.2); 
    } 


    //make loading 
    function getPoints() { 

     var taxiData = [ 
      new google.maps.LatLng(37.782551, -122.445368) 

     ]; 
     pointArray = new google.MAX_CUBE_MAP_TEXTURE_SIZE.MVCArray(taxiData); 
     heatmap = new google.maps.visualization.HeatmapLayer({ 
      data: pointArray 
     }); 
     heatmap.setMap(map); 


    } 
</script> 

}

我尝试这个方法来更新地图

功能getPoints()

,但我得到的错误

Uncaught TypeError: Cannot read property 'MVCArray' of undefined

在该行

pointArray = new google.MAX_CUBE_MAP_TEXTURE_SIZE.MVCArray(taxiData); 

我该如何解决这个问题?

感谢对帮助

回答

2
google.MAX_CUBE_MAP_TEXTURE_SIZE.MVCArray 

应改为:

google.maps.MVCArray 
+0

是。非常感谢 – Eugene