var msec = (new Date()).getTime();
httpObj = GXmlHttp.create();
httpObj.open("get", "./point.csv?cache="+msec);
httpObj.onreadystatechange = function() {
if ((httpObj.readyState == 4) && (httpObj.status == 200)) {
var CR = String.fromCharCode(13);
var txt = httpObj.responseText;
pointData = txt.split(CR);
setTimeout("drawPolyline()", 10);
}
}
httpObj.send(null);
}
function drawPolyline() {
var points = new Array();
for (var i=0; i<count; i++) {
var px = pointData[i].split(",")[0];
var py = pointData[i].split(",")[1];
points.push(gp(px, py));
}
try { map.removeOverlay(polyObj); }catch(e){}
try { map.addOverlay(polyObj = new GPolyline(points, "#ff0000")); }catch(e){}
if (count++ < pointData.length) setTimeout("drawPolyline()", timer);
}
function gp(x,y) {
return new GLatLng(y, x);
}
//]]>
</script>
</head>
<body>
<div id="gmap" style="width: 500px; height: 400px"></div>
</body>
</html>