Quote:
Originally Posted by xelawho
I think not. hObj is just a name for the objects getting pushed onto the array.
If you look, google passes the entire array to the HeatmapLayer object, so I am thinking that in your case it would be:
Code:
var heatmap = new google.maps.visualization.HeatmapLayer({
data: heatMapData
});
heatmap.setMap(map);
as well
|
I am not sure. Because in the Google example, the array name is heatMapData.

In this case, our data is of latitude and longitude is in the variable named 'hObj'.
By the way, I tried this code and it didn't work :-
Code:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Heatmap Layer</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map { height: 100%;
float:right; }
</style>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=visualization"></script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
zoom: 5,
center: new google.maps.LatLng(21.1438, 79.0926),
mapTypeId: google.maps.MapTypeId.SATELLITE
};
downloadUrl("phpsqlajax_genxml.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var hObj = {
point
}
}
}
map = new google.maps.Map(document.getElementById('map'),
mapOptions);
var heatmap = new google.maps.visualization.HeatmapLayer({
data: hObj
});
heatmap.setMap(map);
}
</script>
</head>
<body onload="initialize()">
<div id="map" style="height: 600px; width: 800px;"></div>
</body>
</html>