更新热图数据,简单谷歌HeatMap [英] Updating heatmap data, simple google HeatMap
问题描述
我已经构建了这个android应用程序来收集我的课程项目的经度,纬度和电话信号。我的目标是将此信息移植到简单的热图网页。我的问题是在这个例子中更新我的heatmap数据变量的最好方法是什么:
https://google-developers.appspot.com/maps/documentation/javascript/examples/layer-heatmap
特别是这个变量:
var taxiData = [
new google.maps .LatLng(37.782551,-122.445368),
new google.maps.LatLng(37.782745,-122.444586),...
];
我接受所有建议,我几乎是网页开发的新手。 Google地图让这个非常简单。你可能会注意到,在这个例子中,taxiData被加载到一个特定的谷歌数组 -
pointArray = new google.maps。回MVCArray(taxiData);
然后将其作为热图映射到地图中:
heatmap = new google.maps.visualization.HeatmapLayer({
data:pointArray
});
heatmap.setMap(map);
MVCArray可以更新,地图会自动更新。所以,如果你需要添加一个新的LatLng到你的热图中,只需放:
pointArray.push(new LatLng(<坐标>));
地图会更新。
I've built this android app to collect longitude,latitude, and phone signals for my class project. My objective is to port this info to a simple heatmap webpage. My question is what's the best way to update my heatmap data variable in this example:
https://google-developers.appspot.com/maps/documentation/javascript/examples/layer-heatmap
This variable in particular:
var taxiData = [
new google.maps.LatLng(37.782551, -122.445368),
new google.maps.LatLng(37.782745, -122.444586), ...
];
I'm open to all suggestions, I'm pretty much a novice with web development.
Google maps makes this very straightforward. You might notice later on in this example, taxiData is loaded into a specific google array here -
pointArray = new google.maps.MVCArray(taxiData);
And then this is put into the map as a heatmap here:
heatmap = new google.maps.visualization.HeatmapLayer({
data: pointArray
});
heatmap.setMap(map);
The MVCArray can be updated, and the map will automatically update. So, if you need to add a new LatLng to your heatmap, simply put:
pointArray.push(new LatLng(<coordinates>));
And the map will update.
这篇关于更新热图数据,简单谷歌HeatMap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!