Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating heatmap data, simple google HeatMap

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.

like image 666
Yonahs Avatar asked Nov 20 '12 18:11

Yonahs


People also ask

What is a dynamic heatmap?

Defined: Dynamic Heat Map Dynamic heatmaps are a visual representation of website visitor behavior including basic navigation and interactions with dynamic elements like popups and forms.

Does Google have a heat map tool?

Google offers an official heatmap Chrome browser extension called Page Analytics (by Google). Once installed, it shows you where visitors click on your web pages.


1 Answers

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.

like image 179
Bubbles Avatar answered Sep 26 '22 12:09

Bubbles