Heatmap update, simple Google HeatMap

I created this Android application to collect longitude, latitude and phone signals for my class project. My goal is to transfer this information to a webpage on a simple webpage. My question is the best way to update the 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 am open to all suggestions, I am pretty new to web development.

+7
source share
1 answer

Google Maps makes this very easy. In this example, you may notice that taxiData is loading into a specific google array here -

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

And here it is placed on the map in the form of a heat map here:

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

MVCArray can be updated and the map will be automatically updated. So, if you need to add a new LatLng to your heatmap, just put:

 pointArray.push(new LatLng(<coordinates>)); 

And the map will be updated.

+24
source

All Articles