1

只是想知道是否有一种简单的方法可以使用带有 Google 地图的热图图层在 2 组或更多组数据数组变量之间切换?

经典的例子:

var taxiData = [
new google.maps.LatLng(37.782551, -122.445368),
new google.maps.LatLng(37.782745, -122.444586), ...
];

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

但是,如果我想要一个 vartaxiDataJan、vartaxiDataFeb 并在两者之间切换怎么办?我想创建一个切换按钮,然后在数据集之间切换,在本例中为 2 个月。

我看了以下内容:更新热图数据,简单的谷歌热图

但这只会在数组底部添加一条新记录,而我想替换整个数组

提前致谢!

4

1 回答 1

2

似乎您一次只能拥有一个 HeatMapLayer 对象。这对我有用:

function toggleHeatmap() {
  if (firstData) {
    heatmap.setData(pointArray2);
    firstData=false;
  } else {
    heatmap.setData(pointArray);
    firstData=true;
  }
}

工作示例

代码片段:

function initialize() {
  var mapOptions = {
    zoom: 10,
    center: new google.maps.LatLng(37.774546, -122.433523),
    mapTypeId: google.maps.MapTypeId.SATELLITE
  };

  map = new google.maps.Map(document.getElementById('map-canvas'),
    mapOptions);

  pointArray = new google.maps.MVCArray(taxiData);
  pointArray2 = new google.maps.MVCArray(taxiData2);

  heatmap = new google.maps.visualization.HeatmapLayer({
    data: pointArray
  })

  heatmap.setMap(map);
  //  heatmap2.setMap(map);
}

function toggleHeatmap() {
  if (firstData) {
    heatmap.setData(pointArray2);
    firstData = false;
  } else {
    heatmap.setData(pointArray);
    firstData = true;
  }
}

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.setOptions({
    gradient: heatmap.get('gradient') ? null : gradient
  });
}

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

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

google.maps.event.addDomListener(window, 'load', initialize);

// Adding 500 Data Points
var map = null;
var heatmap = null;
var heatmap2 = null;
var pointArray = null;
var pointArray2 = null;
var firstData = true;
var taxiData = [
  new google.maps.LatLng(37.782551, -122.445368),
  new google.maps.LatLng(37.782745, -122.444586),
  new google.maps.LatLng(37.782842, -122.443688),
  new google.maps.LatLng(37.782919, -122.442815),
  new google.maps.LatLng(37.782992, -122.442112),
  new google.maps.LatLng(37.783100, -122.441461),
  new google.maps.LatLng(37.783206, -122.440829),
  new google.maps.LatLng(37.783273, -122.440324),
  new google.maps.LatLng(37.783316, -122.440023),
  new google.maps.LatLng(37.783357, -122.439794),
  new google.maps.LatLng(37.783371, -122.439687),
  new google.maps.LatLng(37.783368, -122.439666),
  new google.maps.LatLng(37.783383, -122.439594),
  new google.maps.LatLng(37.783508, -122.439525),
  new google.maps.LatLng(37.783842, -122.439591),
  new google.maps.LatLng(37.784147, -122.439668),
  new google.maps.LatLng(37.784206, -122.439686),
  new google.maps.LatLng(37.784386, -122.439790),
  new google.maps.LatLng(37.784701, -122.439902),
  new google.maps.LatLng(37.784965, -122.439938),
  new google.maps.LatLng(37.785010, -122.439947),
  new google.maps.LatLng(37.785360, -122.439952),
  new google.maps.LatLng(37.785715, -122.440030),
  new google.maps.LatLng(37.786117, -122.440119),
  new google.maps.LatLng(37.786564, -122.440209),
  new google.maps.LatLng(37.786905, -122.440270),
  new google.maps.LatLng(37.786956, -122.440279),
  new google.maps.LatLng(37.800224, -122.433520),
  new google.maps.LatLng(37.800155, -122.434101),
  new google.maps.LatLng(37.800160, -122.434430),
  new google.maps.LatLng(37.800378, -122.434527),
  new google.maps.LatLng(37.800738, -122.434598),
  new google.maps.LatLng(37.800938, -122.434650),
  new google.maps.LatLng(37.801024, -122.434889),
  new google.maps.LatLng(37.800955, -122.435392),
  new google.maps.LatLng(37.800886, -122.435959),
  new google.maps.LatLng(37.800811, -122.436275),
  new google.maps.LatLng(37.800788, -122.436299),
  new google.maps.LatLng(37.800719, -122.436302),
  new google.maps.LatLng(37.800702, -122.436298),
  new google.maps.LatLng(37.800661, -122.436273),
  new google.maps.LatLng(37.800395, -122.436172),
  new google.maps.LatLng(37.800228, -122.436116),
  new google.maps.LatLng(37.800169, -122.436130),
  new google.maps.LatLng(37.800066, -122.436167),
  new google.maps.LatLng(37.784345, -122.422922),
  new google.maps.LatLng(37.784389, -122.422926),
  new google.maps.LatLng(37.784437, -122.422924),
  new google.maps.LatLng(37.784746, -122.422818),
  new google.maps.LatLng(37.785436, -122.422959),
  new google.maps.LatLng(37.786120, -122.423112),
  new google.maps.LatLng(37.786433, -122.423029),
  new google.maps.LatLng(37.786631, -122.421213),
  new google.maps.LatLng(37.786660, -122.421033),
  new google.maps.LatLng(37.786801, -122.420141),
  new google.maps.LatLng(37.786823, -122.420034),
  new google.maps.LatLng(37.786831, -122.419916),
  new google.maps.LatLng(37.787034, -122.418208),
  new google.maps.LatLng(37.787056, -122.418034),
  new google.maps.LatLng(37.787169, -122.417145),
  new google.maps.LatLng(37.787217, -122.416715),
  new google.maps.LatLng(37.786144, -122.416403),
  new google.maps.LatLng(37.785292, -122.416257),
  new google.maps.LatLng(37.780666, -122.390374),
  new google.maps.LatLng(37.780501, -122.391281),
  new google.maps.LatLng(37.780148, -122.392052),
  new google.maps.LatLng(37.780173, -122.391148),
  new google.maps.LatLng(37.780693, -122.390592),
  new google.maps.LatLng(37.781261, -122.391142),
  new google.maps.LatLng(37.781808, -122.391730),
  new google.maps.LatLng(37.782340, -122.392341),
  new google.maps.LatLng(37.782812, -122.393022),
  new google.maps.LatLng(37.783300, -122.393672),
  new google.maps.LatLng(37.783809, -122.394275),
  new google.maps.LatLng(37.784246, -122.394979),
  new google.maps.LatLng(37.784791, -122.395958),
  new google.maps.LatLng(37.785675, -122.396746),
  new google.maps.LatLng(37.786262, -122.395780),
  new google.maps.LatLng(37.786776, -122.395093),
  new google.maps.LatLng(37.787282, -122.394426),
  new google.maps.LatLng(37.787783, -122.393767),
  new google.maps.LatLng(37.788343, -122.393184),
  new google.maps.LatLng(37.788895, -122.392506),
  new google.maps.LatLng(37.789371, -122.391701),
  new google.maps.LatLng(37.789722, -122.390952),
  new google.maps.LatLng(37.790315, -122.390305),
  new google.maps.LatLng(37.790738, -122.389616),
  new google.maps.LatLng(37.779448, -122.438702),
  new google.maps.LatLng(37.779023, -122.438585),
  new google.maps.LatLng(37.768244, -122.428138),
  new google.maps.LatLng(37.767942, -122.428581),
  new google.maps.LatLng(37.767482, -122.429094),
  new google.maps.LatLng(37.767031, -122.429606),
  new google.maps.LatLng(37.766732, -122.429986),
  new google.maps.LatLng(37.766680, -122.430058),
  new google.maps.LatLng(37.766633, -122.430109),
  new google.maps.LatLng(37.766580, -122.430211),
  new google.maps.LatLng(37.766367, -122.430594),
  new google.maps.LatLng(37.765910, -122.431137),
  new google.maps.LatLng(37.765353, -122.431806),
  new google.maps.LatLng(37.764962, -122.432298),
  new google.maps.LatLng(37.764868, -122.432486),
  new google.maps.LatLng(37.764518, -122.432913),
  new google.maps.LatLng(37.763435, -122.434173),
  new google.maps.LatLng(37.762847, -122.434953),
  new google.maps.LatLng(37.762291, -122.435935),
  new google.maps.LatLng(37.762224, -122.436074),
  new google.maps.LatLng(37.761957, -122.436892),
  new google.maps.LatLng(37.761652, -122.438886),
  new google.maps.LatLng(37.761284, -122.439955),
  new google.maps.LatLng(37.761210, -122.440068),
  new google.maps.LatLng(37.761064, -122.440720),
  new google.maps.LatLng(37.761040, -122.441411),
  new google.maps.LatLng(37.761048, -122.442324),
  new google.maps.LatLng(37.760851, -122.443118),
  new google.maps.LatLng(37.759977, -122.444591),
  new google.maps.LatLng(37.759913, -122.444698),
  new google.maps.LatLng(37.759623, -122.445065),
  new google.maps.LatLng(37.758902, -122.445158),
  new google.maps.LatLng(37.758428, -122.444570),
  new google.maps.LatLng(37.757687, -122.443340),
  new google.maps.LatLng(37.757583, -122.443240),
  new google.maps.LatLng(37.757019, -122.442787),
  new google.maps.LatLng(37.756603, -122.442322),
  new google.maps.LatLng(37.756380, -122.441602),
  new google.maps.LatLng(37.755790, -122.441382),
  new google.maps.LatLng(37.754493, -122.442133),
  new google.maps.LatLng(37.754361, -122.442206),
  new google.maps.LatLng(37.753719, -122.442650),
  new google.maps.LatLng(37.753096, -122.442915),
  new google.maps.LatLng(37.751617, -122.443211),
  new google.maps.LatLng(37.751496, -122.443246),
  new google.maps.LatLng(37.750733, -122.443428),
  new google.maps.LatLng(37.750126, -122.443536),
  new google.maps.LatLng(37.750103, -122.443784),
  new google.maps.LatLng(37.750390, -122.444010),
  new google.maps.LatLng(37.750448, -122.444013),
  new google.maps.LatLng(37.750536, -122.444040),
  new google.maps.LatLng(37.750493, -122.444141),
  new google.maps.LatLng(37.790859, -122.402808),
  new google.maps.LatLng(37.790864, -122.402768),
  new google.maps.LatLng(37.790995, -122.402539),
  new google.maps.LatLng(37.791148, -122.402172),
  new google.maps.LatLng(37.791385, -122.401312),
  new google.maps.LatLng(37.791405, -122.400776),
  new google.maps.LatLng(37.791288, -122.400528),
  new google.maps.LatLng(37.791113, -122.400441),
  new google.maps.LatLng(37.791027, -122.400395),
  new google.maps.LatLng(37.791094, -122.400311),
  new google.maps.LatLng(37.791211, -122.400183),
  new google.maps.LatLng(37.791060, -122.399334),
  new google.maps.LatLng(37.790538, -122.398718),
  new google.maps.LatLng(37.790095, -122.398086),
  new google.maps.LatLng(37.789644, -122.397360),
  new google.maps.LatLng(37.789254, -122.396844),
  new google.maps.LatLng(37.788855, -122.396397),
  new google.maps.LatLng(37.788483, -122.395963),
  new google.maps.LatLng(37.788015, -122.395365),
  new google.maps.LatLng(37.787558, -122.394735),
  new google.maps.LatLng(37.787472, -122.394323),
  new google.maps.LatLng(37.787630, -122.394025),
  new google.maps.LatLng(37.787767, -122.393987),
  new google.maps.LatLng(37.787486, -122.394452),
  new google.maps.LatLng(37.786977, -122.395043),
  new google.maps.LatLng(37.786583, -122.395552),
  new google.maps.LatLng(37.786540, -122.395610),
  new google.maps.LatLng(37.786516, -122.395659),
  new google.maps.LatLng(37.786378, -122.395707),
  new google.maps.LatLng(37.786044, -122.395362),
  new google.maps.LatLng(37.785598, -122.394715),
  new google.maps.LatLng(37.785321, -122.394361),
  new google.maps.LatLng(37.785207, -122.394236),
  new google.maps.LatLng(37.785751, -122.394062),
  new google.maps.LatLng(37.785996, -122.393881),
  new google.maps.LatLng(37.786092, -122.393830),
  new google.maps.LatLng(37.785998, -122.393899),
  new google.maps.LatLng(37.785114, -122.394365),
  new google.maps.LatLng(37.785022, -122.394441),
  new google.maps.LatLng(37.784823, -122.394635),
  new google.maps.LatLng(37.784719, -122.394629),
  new google.maps.LatLng(37.785069, -122.394176),
  new google.maps.LatLng(37.785500, -122.393650),
  new google.maps.LatLng(37.785770, -122.393291),
  new google.maps.LatLng(37.785839, -122.393159),
  new google.maps.LatLng(37.782651, -122.400628),
  new google.maps.LatLng(37.782616, -122.400599),
  new google.maps.LatLng(37.782702, -122.400470),
  new google.maps.LatLng(37.782915, -122.400192),
  new google.maps.LatLng(37.783137, -122.399887),
  new google.maps.LatLng(37.783414, -122.399519),
  new google.maps.LatLng(37.783629, -122.399237),
  new google.maps.LatLng(37.783688, -122.399157),
  new google.maps.LatLng(37.783716, -122.399106),
  new google.maps.LatLng(37.783798, -122.399072),
  new google.maps.LatLng(37.783997, -122.399186),
  new google.maps.LatLng(37.784271, -122.399538),
  new google.maps.LatLng(37.784577, -122.399948),
  new google.maps.LatLng(37.784828, -122.400260),
  new google.maps.LatLng(37.784999, -122.400477),
  new google.maps.LatLng(37.785113, -122.400651),
  new google.maps.LatLng(37.785155, -122.400703),
  new google.maps.LatLng(37.785192, -122.400749),
  new google.maps.LatLng(37.785278, -122.400839),
  new google.maps.LatLng(37.785387, -122.400857),
  new google.maps.LatLng(37.785478, -122.400890),
  new google.maps.LatLng(37.785526, -122.401022),
  new google.maps.LatLng(37.785598, -122.401148),
  new google.maps.LatLng(37.785631, -122.401202),
  new google.maps.LatLng(37.785660, -122.401267),
  new google.maps.LatLng(37.803986, -122.426035),
  new google.maps.LatLng(37.804102, -122.425089),
  new google.maps.LatLng(37.804211, -122.424156),
  new google.maps.LatLng(37.803861, -122.423385),
  new google.maps.LatLng(37.803151, -122.423214),
  new google.maps.LatLng(37.802439, -122.423077),
  new google.maps.LatLng(37.801740, -122.422905),
  new google.maps.LatLng(37.801069, -122.422785),
  new google.maps.LatLng(37.800345, -122.422649),
  new google.maps.LatLng(37.799633, -122.422603),
  new google.maps.LatLng(37.799750, -122.421700),
  new google.maps.LatLng(37.799885, -122.420854),
  new google.maps.LatLng(37.799209, -122.420607),
  new google.maps.LatLng(37.795656, -122.400395),
  new google.maps.LatLng(37.795203, -122.400304),
  new google.maps.LatLng(37.778738, -122.415584),
  new google.maps.LatLng(37.778812, -122.415189),
  new google.maps.LatLng(37.778824, -122.415092),
  new google.maps.LatLng(37.778833, -122.414932),
  new google.maps.LatLng(37.778834, -122.414898),
  new google.maps.LatLng(37.778740, -122.414757),
  new google.maps.LatLng(37.778501, -122.414433),
  new google.maps.LatLng(37.778182, -122.414026),
  new google.maps.LatLng(37.777851, -122.413623),
  new google.maps.LatLng(37.777486, -122.413166),
  new google.maps.LatLng(37.777109, -122.412674),
  new google.maps.LatLng(37.776743, -122.412186),
  new google.maps.LatLng(37.776440, -122.411800),
  new google.maps.LatLng(37.776295, -122.411614),
  new google.maps.LatLng(37.776158, -122.411440),
  new google.maps.LatLng(37.775806, -122.410997),
  new google.maps.LatLng(37.775422, -122.410484),
  new google.maps.LatLng(37.775126, -122.410087),
  new google.maps.LatLng(37.775012, -122.409854),
  new google.maps.LatLng(37.775164, -122.409573),
  new google.maps.LatLng(37.775498, -122.409180),
  new google.maps.LatLng(37.775868, -122.408730),
  new google.maps.LatLng(37.776256, -122.408240),
  new google.maps.LatLng(37.776519, -122.407928),
  new google.maps.LatLng(37.776539, -122.407904),
  new google.maps.LatLng(37.776595, -122.407854),
  new google.maps.LatLng(37.776853, -122.407547),
  new google.maps.LatLng(37.777234, -122.407087),
  new google.maps.LatLng(37.777644, -122.406558),
  new google.maps.LatLng(37.778066, -122.406017),
  new google.maps.LatLng(37.778468, -122.405499),
  new google.maps.LatLng(37.778866, -122.404995),
  new google.maps.LatLng(37.779295, -122.404455),
  new google.maps.LatLng(37.779695, -122.403950),
  new google.maps.LatLng(37.779982, -122.403584),
  new google.maps.LatLng(37.780295, -122.403223),
  new google.maps.LatLng(37.780664, -122.402766),
  new google.maps.LatLng(37.781043, -122.402288),
  new google.maps.LatLng(37.781399, -122.401823),
  new google.maps.LatLng(37.781727, -122.401407),
  new google.maps.LatLng(37.781853, -122.401247),
  new google.maps.LatLng(37.781894, -122.401195),
  new google.maps.LatLng(37.782076, -122.400977),
  new google.maps.LatLng(37.782338, -122.400603),
  new google.maps.LatLng(37.782666, -122.400133),
  new google.maps.LatLng(37.783048, -122.399634),
  new google.maps.LatLng(37.783450, -122.399198),
  new google.maps.LatLng(37.783791, -122.398998),
  new google.maps.LatLng(37.784177, -122.398959),
  new google.maps.LatLng(37.784388, -122.398971),
  new google.maps.LatLng(37.784404, -122.399128),
  new google.maps.LatLng(37.784586, -122.399524),
  new google.maps.LatLng(37.784835, -122.399927),
  new google.maps.LatLng(37.785116, -122.400307),
  new google.maps.LatLng(37.785282, -122.400539),
  new google.maps.LatLng(37.785346, -122.400692),
  new google.maps.LatLng(37.765769, -122.407201),
  new google.maps.LatLng(37.765790, -122.407414),
  new google.maps.LatLng(37.765802, -122.407755),
  new google.maps.LatLng(37.765791, -122.408219),
  new google.maps.LatLng(37.765763, -122.408759),
  new google.maps.LatLng(37.765726, -122.409348),
  new google.maps.LatLng(37.765716, -122.409882),
  new google.maps.LatLng(37.765708, -122.410202),
  new google.maps.LatLng(37.765705, -122.410253),
  new google.maps.LatLng(37.765707, -122.410369),
  new google.maps.LatLng(37.765692, -122.410720),
  new google.maps.LatLng(37.765699, -122.411215),
  new google.maps.LatLng(37.765687, -122.411789),
  new google.maps.LatLng(37.765666, -122.412373),
  new google.maps.LatLng(37.765598, -122.412883),
  new google.maps.LatLng(37.765543, -122.413039),
  new google.maps.LatLng(37.765532, -122.413125),
  new google.maps.LatLng(37.765500, -122.413553),
  new google.maps.LatLng(37.765448, -122.414053),
  new google.maps.LatLng(37.765388, -122.414645),
  new google.maps.LatLng(37.765323, -122.415250),
  new google.maps.LatLng(37.765303, -122.415847),
  new google.maps.LatLng(37.765251, -122.416439),
  new google.maps.LatLng(37.765204, -122.417020),
  new google.maps.LatLng(37.765172, -122.417556),
  new google.maps.LatLng(37.765164, -122.418075),
  new google.maps.LatLng(37.765153, -122.418618),
  new google.maps.LatLng(37.765136, -122.419112),
  new google.maps.LatLng(37.765129, -122.419378),
  new google.maps.LatLng(37.765119, -122.419481),
  new google.maps.LatLng(37.765100, -122.419852),
  new google.maps.LatLng(37.765083, -122.420349),
  new google.maps.LatLng(37.765045, -122.420930),
  new google.maps.LatLng(37.764992, -122.421481),
  new google.maps.LatLng(37.764980, -122.421695),
  new google.maps.LatLng(37.764993, -122.421843),
  new google.maps.LatLng(37.764986, -122.422255),
  new google.maps.LatLng(37.764975, -122.422823),
  new google.maps.LatLng(37.764939, -122.423411),
  new google.maps.LatLng(37.767980, -122.405745),
  new google.maps.LatLng(37.767380, -122.405299),
  new google.maps.LatLng(37.766604, -122.405297),
  new google.maps.LatLng(37.765838, -122.405200),
  new google.maps.LatLng(37.765139, -122.405139),
  new google.maps.LatLng(37.764457, -122.405094),
  new google.maps.LatLng(37.763716, -122.405142),
  new google.maps.LatLng(37.762932, -122.405398),
  new google.maps.LatLng(37.762126, -122.405813),
  new google.maps.LatLng(37.761344, -122.406215),
  new google.maps.LatLng(37.760556, -122.406495),
  new google.maps.LatLng(37.759732, -122.406484),
  new google.maps.LatLng(37.758910, -122.406228),
  new google.maps.LatLng(37.758182, -122.405695),
  new google.maps.LatLng(37.757676, -122.405118),
  new google.maps.LatLng(37.757039, -122.404346),
  new google.maps.LatLng(37.756335, -122.403719),
  new google.maps.LatLng(37.755503, -122.403406),
  new google.maps.LatLng(37.754665, -122.403242),
  new google.maps.LatLng(37.753837, -122.403172),
  new google.maps.LatLng(37.752986, -122.403112),
  new google.maps.LatLng(37.751266, -122.403355)
];

var taxiData2 = [
  new google.maps.LatLng(37.523833602, -121.989997251),
  new google.maps.LatLng(37.524210200, -121.990779198),
  new google.maps.LatLng(37.524726358, -121.991851578),
  new google.maps.LatLng(37.525089294, -121.992612404),
  new google.maps.LatLng(37.525422474, -121.993359901),
  new google.maps.LatLng(37.526038963, -121.994701341),
  new google.maps.LatLng(37.526570795, -121.995782690),
  new google.maps.LatLng(37.527136322, -121.996942912),
  new google.maps.LatLng(37.527580646, -121.997856204),
  new google.maps.LatLng(37.528191854, -121.999072501),
  new google.maps.LatLng(37.528815719, -122.000236328),
  new google.maps.LatLng(37.529289296, -122.001103771),
  new google.maps.LatLng(37.529754157, -122.001971046),
  new google.maps.LatLng(37.530221196, -122.002834047),
  new google.maps.LatLng(37.530701479, -122.003711212),
  new google.maps.LatLng(37.531321740, -122.004844529),
  new google.maps.LatLng(37.531952980, -122.006005255),
  new google.maps.LatLng(37.532433012, -122.006894155),
  new google.maps.LatLng(37.532908601, -122.007765873),
  new google.maps.LatLng(37.533371198, -122.008620491),
  new google.maps.LatLng(37.533985172, -122.009751210),
  new google.maps.LatLng(37.534610546, -122.010902128),
  new google.maps.LatLng(37.535255868, -122.012088083),
  new google.maps.LatLng(37.535721650, -122.012951671),
  new google.maps.LatLng(37.536187684, -122.013761530),
  new google.maps.LatLng(37.536692693, -122.014525624),
  new google.maps.LatLng(37.537444550, -122.015483843),
  new google.maps.LatLng(37.538264635, -122.016343993),
  new google.maps.LatLng(37.539146411, -122.017094844),
  new google.maps.LatLng(37.540081244, -122.017806216),
  new google.maps.LatLng(37.540789096, -122.018335533),
  new google.maps.LatLng(37.541497785, -122.018864682),
  new google.maps.LatLng(37.542416274, -122.019544957),
  new google.maps.LatLng(37.543301570, -122.020211737),
  new google.maps.LatLng(37.543940606, -122.020695792),
  new google.maps.LatLng(37.544811653, -122.021350418),
  new google.maps.LatLng(37.545741876, -122.022043937),
  new google.maps.LatLng(37.546437239, -122.022562189),
  new google.maps.LatLng(37.547346088, -122.023243722),
  new google.maps.LatLng(37.548013707, -122.023746552),
  new google.maps.LatLng(37.548917192, -122.024426240),
  new google.maps.LatLng(37.549601322, -122.024934854),
  new google.maps.LatLng(37.550472202, -122.025587050),
  new google.maps.LatLng(37.551343584, -122.026240838),
  new google.maps.LatLng(37.552264001, -122.026934440),
  new google.maps.LatLng(37.552990963, -122.027478928),
  new google.maps.LatLng(37.553741310, -122.028069601),
  new google.maps.LatLng(37.554743199, -122.028976522),
  new google.maps.LatLng(37.555689096, -122.029965335),
  new google.maps.LatLng(37.556571375, -122.030904778),
  new google.maps.LatLng(37.557393807, -122.031794182),
  new google.maps.LatLng(37.558221687, -122.032724070),
  new google.maps.LatLng(37.559069181, -122.033636356),
  new google.maps.LatLng(37.559715090, -122.034327946),
  new google.maps.LatLng(37.560372986, -122.035032445),
  new google.maps.LatLng(37.561250571, -122.035973900),
  new google.maps.LatLng(37.562117092, -122.036909488),
  new google.maps.LatLng(37.562774400, -122.037611723),
  new google.maps.LatLng(37.563429865, -122.038306248),
  new google.maps.LatLng(37.564301918, -122.039240326),
  new google.maps.LatLng(37.565187633, -122.040175411),
  new google.maps.LatLng(37.565854916, -122.040889968),
  new google.maps.LatLng(37.566517002, -122.041598322),
  new google.maps.LatLng(37.567383355, -122.042526534),
  new google.maps.LatLng(37.605739684, -122.065798460),
  new google.maps.LatLng(37.606691952, -122.066461301),
  new google.maps.LatLng(37.607550342, -122.067077874),
  new google.maps.LatLng(37.608135231, -122.067465620),
  new google.maps.LatLng(37.608768819, -122.067896366),
  new google.maps.LatLng(37.609184980, -122.068194343),
  new google.maps.LatLng(37.609457225, -122.068385618),
  new google.maps.LatLng(37.609636765, -122.068513693),
  new google.maps.LatLng(37.609725697, -122.068577144),
  new google.maps.LatLng(37.609864669, -122.068677895),
  new google.maps.LatLng(37.610002551, -122.068775041),
  new google.maps.LatLng(37.610253086, -122.068944942),
  new google.maps.LatLng(37.610473949, -122.069103863),
  new google.maps.LatLng(37.610715515, -122.069281308),
  new google.maps.LatLng(37.610907126, -122.069415921),
  new google.maps.LatLng(37.611032603, -122.069503679),
  new google.maps.LatLng(37.611072333, -122.069531340),
  new google.maps.LatLng(37.611166378, -122.069598060),
  new google.maps.LatLng(37.611294286, -122.069689506),
  new google.maps.LatLng(37.611392857, -122.069758489),
  new google.maps.LatLng(37.611449351, -122.069797465),
  new google.maps.LatLng(37.611499642, -122.069832250),
  new google.maps.LatLng(37.611588993, -122.069898802),
  new google.maps.LatLng(37.611684715, -122.069971976),
  new google.maps.LatLng(37.611744896, -122.070016484),
  new google.maps.LatLng(37.611853526, -122.070093095),
  new google.maps.LatLng(37.612028121, -122.070215470),
  new google.maps.LatLng(37.612074389, -122.070248411),
  new google.maps.LatLng(37.612100205, -122.070271629),
  new google.maps.LatLng(37.612100708, -122.070271126),
  new google.maps.LatLng(37.612100876, -122.070270791),
  new google.maps.LatLng(37.612101127, -122.070270623),
  new google.maps.LatLng(37.612120406, -122.070283615),
  new google.maps.LatLng(37.612144462, -122.070300044),
  new google.maps.LatLng(37.612173798, -122.070318903),
  new google.maps.LatLng(37.612226940, -122.070355197),
  new google.maps.LatLng(37.612272369, -122.070387551),
  new google.maps.LatLng(37.612355602, -122.070446727),
  new google.maps.LatLng(37.612423244, -122.070494420),
  new google.maps.LatLng(37.612469093, -122.070526942),
  new google.maps.LatLng(37.612542267, -122.070579412),
  new google.maps.LatLng(37.612667911, -122.070669937),
  new google.maps.LatLng(37.612881566, -122.070823912),
  new google.maps.LatLng(37.613108548, -122.070985013),
  new google.maps.LatLng(37.613234109, -122.071076794),
  new google.maps.LatLng(37.613358496, -122.071166900),
  new google.maps.LatLng(37.613457235, -122.071237811),
  new google.maps.LatLng(37.613577431, -122.071321043),
  new google.maps.LatLng(37.613684049, -122.071397737),
  new google.maps.LatLng(37.622624435, -122.077779381),
  new google.maps.LatLng(37.623195410, -122.078146005),
  new google.maps.LatLng(37.623765128, -122.078549426),
  new google.maps.LatLng(37.624376671, -122.078986290),
  new google.maps.LatLng(37.624991567, -122.079426927),
  new google.maps.LatLng(37.625625994, -122.079879717),
  new google.maps.LatLng(37.626255055, -122.080324377),
  new google.maps.LatLng(37.626893421, -122.080781777),
  new google.maps.LatLng(37.627530277, -122.081239680),
  new google.maps.LatLng(37.628186329, -122.081704122)
];
<script src="https://maps.googleapis.com/maps/api/js?libraries=visualization"></script>
<div id="panel">
  <button onclick="toggleHeatmap()">Toggle Heatmap</button>
  <button onclick="changeGradient()">Change gradient</button>
  <button onclick="changeRadius()">Change radius</button>
  <button onclick="changeOpacity()">Change opacity</button>
</div>
<div id="map-canvas" style="height:500px; width:600px;"></div>

于 2013-05-31T00:46:14.323 回答