Add the following to your HTML page:
<script src="http://www.heatmapapi.com/javascript/HeatmapAPI.aspx?k=(YOUR HEATMAPAPI KEY HERE)" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&key=(YOUR GOOGLE KEY HERE)" type="text/javascript"></script>
<script src="http://www.heatmapapi.com/javascript/HeatmapAPIGoogle.js" type="text/javascript"></script>
Add the following code to your HTML Page:
<script type="text/javascript">
var m = null;
function loadGoogle()
{
if (GBrowserIsCompatible())
{
m = new GMap2(document.getElementById("map"));
m.addControl(new GLargeMapControl());
m.addControl(new GMapTypeControl());
m.setCenter(new GLatLng(38.5, -121.8), 11);
initHeatmap();
}
else
alert('Your Internet browser is not compatible with this website.');
}
setTimeout('loadGoogle()', 1);
function initHeatmap()
{
// Heatmap Scripts
try
{
var myHM = new GEOHeatmap();
myHM.Init(400, 300); // Must be same as map size, or same ratio
var data = new Array();
// Generate random lat/lon and value points
for(p=0;p<50;p++)
{
var rLatD=Math.floor(Math.random()*1000);
var rLonD=Math.floor(Math.random()*1000);
var rValD=Math.floor(Math.random()*10);
data.push(38.47+(rLatD/15000));
data.push(-121.84+(rLonD/15000));
data.push(rValD);
}
myHM.SetData(data);
myHM.SetBoost(1); // Optional, see documentation
myHM.SetDecay(0); // Optional, see documentation
var preUrl = myHM.GetURL();
// Now render in our Google Map
var heatmapOverlay = new HMGoogleOverlay(preUrl);
m.addOverlay(heatmapOverlay);
}
catch(e)
{
alert(e.Message);
}
}
</script>
|