http://code.google.com/intl/en/apis/kml/documentation/kml_tut.html _
kmlファイルを作成したいのですが、google-maps-v3を使用して地図の中心を設定する方法が見つかりません。
だから設定する方法。
ありがとう
http://code.google.com/intl/en/apis/kml/documentation/kml_tut.html _
kmlファイルを作成したいのですが、google-maps-v3を使用して地図の中心を設定する方法が見つかりません。
だから設定する方法。
ありがとう
Maps API V3 は現在、KML オーバーレイをサポートしていません。ただし、これは計画された機能です。
エキスパートプログラマー向けのJavaScriptマップライブラリであるOpenLayersで使用しているこの短い例を試してみてください。
<html>
<head>
<title>My OpenLayers: Google Layer</title>
<link rel="shortcut icon" href="http://www.gis.com.my/logo.ico" type="image/x-icon"/>
<link rel="stylesheet" href="http://openlayers.org/api/theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="http://openlayers.org/dev/examples/style.css" type="text/css" />
<!-- this gmaps key generated for http://localhost:8080/geoserver/ -->
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAl9RMqSzhPUXAfeBCXOussRTQDbvAygy0cfGJr8dEMAYKf3RWNBQqP9mjKIsqTfmAlz5LOJ3Xpy5s4w'></script>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init() {
// Create the map object
map = new OpenLayers.Map('map');
// Create a Google layer
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 20}
);
// Add layer to map
map.addLayer(gmap);
// Zoom to Kuala Lumpur, Malaysia
map.setCenter(new OpenLayers.LonLat(101.686855,3.139003), 13);
}
</script>
</head>
<body onload="init()">
<h1 id="title">My OpenLayers: Google Layer</h1>
<div id="map" style='width: 700px; height: 700px'></div>
</body>
</html>
google-maps-v3が強制的に中央に配置されることに注意してください。あなたが私が作った次のコードで見ることができるように:
map.setCenter(new OpenLayers.LonLat(101.686855,3.139003), 13);
LonLatはクアラルンプールにあります。経度はx座標であるため、学生時代の地理学の科目とは完全に異なることに注意してください。緯度はy座標です。デカルト座標の原理を参照してください。
幸運を。
よろしく、
zearth