地図のスケールを取得する

説明

地図のスケールを取得するにはgetMapScale()で取得することができます。

サンプルプログラム

<!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.openMap("http://cyberjapan.jp/japan0.htm");
top.map.setMapCenter(137.95340448617935, 36.114983812119554, 20000);
top.map.openMap();
}
function getMScale(n){
var s = top.map.getMapScale();
document.getElementById("mapscale").innerHTML = "スケール:"+s;
}
// --></script>
</head>
<body>
<h1>地図のスケールを取得</h1>
<form>
<input type="button" value="地図のスケールを表示" onclick="getMScale()">
</form>
<div id="mapscale"></div>
<iframe name="map" src="./map.html" width="640" height="480"></iframe>
</body>
</html>
サンプルを実行
[戻る]