ポリゴン(多角形)を描画する

説明

ポリゴン(多角形)を描画するにはdraw_poly()を使います。パラメータは配列形式で指定します。配列要素が経度、緯度になります。経度、緯度は半角空白で区切って文字列形式で指定します。

サンプルプログラム

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title>電子国土(国土地理院)</title>
<script type="text/javascript"><!--
function app_main(){
top.map.draw_xyunit("deg");
top.map.draw_level("all");
top.map.draw_width(2);
top.map.draw_color(255,0,0);
top.map.draw_color2(0,0,128);
top.map.draw_poly(["137.953 36.114","137.963 36.114","137.963 36.121"]);
top.map.setMapCenter(137.95340448617935, 36.114983812119554, 18000);
top.map.openMap();
}
// --></script>
</head>
<body>
<h1>ポリゴン(多角形)を描画する</h1>
<iframe name="map" src="./map.html" width="640" height="480"></iframe>
</body>
</html>
サンプルを実行
[戻る]