0

GoogleMapsAPIでいくつかのプロットのプロトタイプを作成しようとしています。私はここのコードに従い、私のコードは機能するはずだと思いますが、空白の画面が表示されます。すべてのオブジェクトには正しいデータのように見えるものがありますが、残念ながらサイコロはありません。どんな助けでもいただければ幸いです。

<!DOCTYPE html>
<html>
<head>
<title>Google Maps Test</title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=<key removed>&sensor=false"></script>
<style type="text/css">
</style>
<script type="text/javascript">
function initialize() {
    var myLatLng = new google.maps.LatLng(33.001466, -97.354317);

    var mapOptions = {
        zoom:6,
        center:myLatLng,
        mapTypeId: google.maps.MapTypeId.TERRAIN
    };
    console.log(mapOptions);

    var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
    console.log(map);

    var routeCoordinates = [
        new google.maps.LatLng(33.001466, -97.354317),
        new google.maps.LatLng(33.025001, -97.352171),
        new google.maps.LatLng(33.033219, -97.341700),
        new google.maps.LatLng(33.049321, -97.320414),
        new google.maps.LatLng(33.051335, -97.304020),
        new google.maps.LatLng(33.059464, -97.298355),
        new google.maps.LatLng(33.083919, -97.295609),
        new google.maps.LatLng(33.111314, -97.291918),
        new google.maps.LatLng(33.136042, -97.289257),
        new google.maps.LatLng(33.182818, -97.287111)
    ];
    console.log(routeCoordinates);

    var routePath = new google.maps.Polyline({
        path:routeCoordinates,
        strokeColor:"#000000",
        strokeOpacity:.90,
        strokeWeight: 2,
        editable:false
    });
    console.log(routePath);

    routePath.setMap(map);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas">

</div>
</body>
</html>
4

1 に答える 1

1

キーを削除してマップdivにサイズを指定すると、マップは機能します。

http://www.geocodezip.com/JohnSwaringenSO.html

于 2012-09-18T21:47:49.860 に答える