I want to mark some data on google map.
I use eclipse Java EE and xml file is in the same workspace;(workspace_jsp).
xml file:
<csv_data>
<row>
<time>10:01:43</time>
<latitude>37.4805016667</latitude>
<longitude>126.952741667</longitude>
<pdistance>0.000555</pdistance>
<totaldistance>0.000555</totaldistance>
<sectionspray>3343.0</sectionspray>
</row>
<row>
<time>10:01:57</time>
<latitude>37.4807483333</latitude>
<longitude>126.952753333</longitude>
<pdistance>0.027396</pdistance>
<totaldistance>0.027951</totaldistance>
<sectionspray>3320.0</sectionspray>
</row>
my code is
<!DOCTYPE html >
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>PHP/MySQL & Google Maps Example</title>
<script src="https://maps.googleapis.com/maps/api/js?key=~~~~"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var customIcons = {
restaurant: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png'
},
bar: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png'
}
};
function load() {
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(37.466285,126.948366),
zoom: 10,
mapTypeId: 'roadmap'
});
var infoWindow = new google.maps.InfoWindow;
// Change this depending on the name of your PHP file
downloadUrl("mark_info.xml", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("/csv_data/row");
for (var i = 0; i < markers.length; i++) {
var time = markers[i].getAttribute("time");
var ss = markers[i].getAttribute("sectionspray");
var pd = markers[i].getAttribute("pdistance");
var td = markers[i].getAttribute("totaldistance");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("latitude")),
parseFloat(markers[i].getAttribute("longitude")));
var html = "<b>" + time + "</b> <br/>" + ss + pd + td;
var icon = customIcons[pd] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function doNothing() {}
//]]>
</script>
</head>
<body onload="load()">
<div id="map" style="width: 2500px; height: 1500px"></div>
</body>
</html>
map is loaded on browser(IE, CHrome) but marks and infowindow..
what is wrong and how can I fix it?? please help me..