<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Overlay_Poly_Sample.aspx.cs"
Inherits="Samples.Overlays.Overlay_Poly_Sample" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>折线</title>
<style type="text/css">
#maps
{
height: 450px;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=zh-CN"></script>
<script language="javascript" type="text/javascript">
//地图初始化函数
function initialize() {
var LatLng = new google.maps.LatLng(0, -180);
var Options = {
zoom: 3, center: LatLng, mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById("maps"), Options);
//折线数据对象数组
var flightPlanCoordinates = [
new google.maps.LatLng(37.772323, -122.214897),
new google.maps.LatLng(21.291982, -157.821856),
new google.maps.LatLng(-18.142599, 178.431),
new google.maps.LatLng(-27.46758, 153.027892)
];
//创建折线对象
var flightPath = new google.maps.Polyline(
{
path: flightPlanCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 6
});
//将折线对象设置到地图上
flightPath.setMap(map);
}
//将地图初始化函数绑定到window的load事件
google.maps.event.addDomListener(window, "load", initialize);
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="maps">
</div>
</form>
</body>
</html>