GPolyline

書式

GPolyline(point, color, weight, opacity)

説明

地図にライン(線分)を表示します。位置はGPointで生成した座標値を配列で指定します。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<style type="text/css"><!--
v\:* { behavior:url(#default#VML); }
--></style>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAasAJryKxWJnBFVJa487d9hTHGAxTVT7IRADYa-JdYz7xQ8IQZBSthgDZdggYpQHsmm6WYtHstQFfLA" type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 400px"></div>
<script type="text/javascript">
//<![CDATA[
var map = new GMap(document.getElementById("map"));
var gpObj = new GPoint(138, 36);
map.centerAndZoom(gpObj, 11);
function addLine() {
var points = [new GPoint(136, 35), new GPoint(138, 39) ];
map.addOverlay(new GPolyline(points, "#ff0000"));
}
//]]>
</script>
<form>
<input type="button" value="ラインを表示" onClick="addLine()">
</form>
</body>
</html>