【问题标题】:Individual radius for Google Maps Heatmap谷歌地图热图的单个半径
【发布时间】:2014-10-29 18:36:51
【问题描述】:

我正在使用 google maps javascript v3 api,并尝试使用此 api 热图层制作热图应用程序。 在我的应用程序中,我需要每个位置(加权 lanlng 位置)都有自己的半径。正如我在文档中看到的,为整个图层设置了半径属性(热图图层中所有位置的半径相同)。拥有多个热图层不是一个好的解决方案,因为它会大大降低应用程序的速度。有什么想法吗?

谢谢, 萨吉

【问题讨论】:

    标签: javascript google-maps google-maps-api-3 heatmap


    【解决方案1】:

    您可以制作多个热图图层。 https://github.com/pa7/heatmap.js/issues/96#issuecomment-272202758

    var data1 = [
    {location: new google.maps.LatLng(59.4072, 24.7053),weight:0.8},
    {location: new google.maps.LatLng(59.4372, 24.7473),weight: 1},
    {location: new google.maps.LatLng(59.4372, 24.7493),weight:0.8},
    {location: new google.maps.LatLng(59.483428, 24.841709),weight: 0.6},
    {location: new google.maps.LatLng(59.483256, 24.846666),weight: 0.2},
    {location: new google.maps.LatLng(59.409425, 27.278345),weight: 0.3}
    

    ];

    heatmap1 = new google.maps.visualization.HeatmapLayer1({ data: data1, radius: 10 });
    var data2 = [
    {location: new google.maps.LatLng(59.4072, 24.7053),weight:0.8},
    {location: new google.maps.LatLng(59.4372, 24.7473),weight: 1},
    {location: new google.maps.LatLng(59.4372, 24.7493),weight:0.8},
    {location: new google.maps.LatLng(59.483428, 24.841709),weight: 0.6},
    {location: new google.maps.LatLng(59.483256, 24.846666),weight: 0.2},
    {location: new google.maps.LatLng(59.409425, 27.278345),weight: 0.3}
    

    ];

    heatmap2 = new google.maps.visualization.HeatmapLayer2({ data: data2, radius: 3 });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-24
      • 2011-09-07
      • 2011-09-18
      • 2014-04-04
      • 1970-01-01
      相关资源
      最近更新 更多