Hi,
I want to plot polygon(triangle)from excel sheet having 3 consecutive rows with its column 1 and 2 have same coordinates values and next 3 rows have different values with column 1 and 2 but this code is not reading this sheet and showing error "Line:929 Error:Number expected".
But when i am reading sheet having all rows have different values with column 1 and 2 so its running well.
Plz can anyone solve this error.
Thanks in advance
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Google Maps API Sample</title>
<<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q" type="text/javascript"></script>
<script type="text/javascript">
document.write("<pre>");
function initialize() {
array=new Array()
var Excel;
Excel = new ActiveXObject("Excel.Application");
Excel.Visible = false;
var a=Excel.Workbooks.Open("C:/desktop/Book1.xlsx").sheets(1);
for(var r=1;r<=a.usedrange.rows.count;r++)
{
array[r-1]=new Array()
for(var c=1;c<=a.usedrange.columns.count;c++)
array[r-1][c-1]=a.Cells(r,c).Value;
}
var x=0,y=0,p1=0,p2=0;
for(len in array)
{
x+=array[len][1];
y+=array[len][2];
}
p1=(x/array.length);
p2=(y/array.length);
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(p1,p2), 3);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GMapTypeControl());
for(m=0;m<array.length;m++)>
{
var lat =array[m][1];
var lon = array[m][2];
var latOffset = 0.5;
var lonOffset = 2;
var latOffset2 = 0.5;
var lonOffset2 = 2;
var polygon = new GPolygon([
new GLatLng(lat , lon ),
new GLatLng(lat - latOffset2, lon + (lonOffset-1)),
new GLatLng(lat - latOffset2, lon - (lonOffset-1)),
new GLatLng(lat , lon ),
], "#ff0000", 0.1 , 0.9, "#ff0000", 0.9);
map.addOverlay(polygon);
m++;
lat=array[m][1];
lon=array[m][2];
var polygon2 = new GPolygon([
new GLatLng ( lat, lon),
new GLatLng(lat ,lon + lonOffset2),
new GLatLng(lat + latOffset,lon + lonOffset2),
new GLatLng(lat,lon),
], "#f33f00", 0.1 , 0.9, "#f33f00", 0.9);
map.addOverlay(polygon2);
m++;
lat=array[m][1];
lon=array[m][2];
var polygon3 = new GPolygon([
new GLatLng( lat, lon),
new GLatLng( lat, lon - lonOffset2),
new GLatLng( lat + latOffset, lon - lonOffset2),
new GLatLng( lat ,lon),
], "#0000ff", 0.1 , 0.9, "#0000ff", 0.9);
map.addOverlay(polygon3);
}
}
}
document.write("</pre>");
</script>
</head>
<body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;">
<div id="map_canvas" style="width: 1000px; height: 900px">
</div>
</body>
</html>