Google Fusion地图信息窗口未格式化

时间:2013-03-04 16:29:43

标签: google-fusion-tables infowindow

我创建了一个包含2层的Google Fusion Map。所有似乎都正常工作,只有一个例外。

我使用Google Fusion Table工具格式化了两个图层的信息窗口。但是,第1层上的信息窗口没有按照下面的代码显示。它在Google Fusion Table工具中运行良好。

有人能发现我做错了吗?感谢。

    

    <meta charset="UTF-8">
    <title>Smithfield Foods UK</title>
    <link rel="stylesheet" type="text/css" media="all" href="FusionMapTemplate.css" />

    <script type="text/javascript"
        src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <script type="text/javascript">

        function initialize() {
            var defaultZoom = 10;
            var defaultCenter = new google.maps.LatLng(52.6500, 1.2800)
            var locationColumn = 'geometry'

            var map = new google.maps.Map(document.getElementById('map-canvas'), {
                center: defaultCenter,
                zoom: defaultZoom,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });

            var infoWindow = new google.maps.InfoWindow();

            // Initialize the first layer
            var FirstLayer = new google.maps.FusionTablesLayer({
                query: {
                select: 'geometry',
                from: '1hpGzmMBg8bDgPOGrAXvc0_QVLSBqQ0O5vpLbfUE'
                },
                map: map,
                styleId: 3,
                templateID: 5,
                suppressInfoWindows: true
            });
            google.maps.event.addListener(FirstLayer, 'click', function(e) {windowControl(e, infoWindow, map);
            });

            // Initialize the second layer
            var SecondLayer = new google.maps.FusionTablesLayer({
                query: {
                    select: 'PostCode',
                    from: '1RrCcRC-1vU0bfHQJTQWqToR-vllSsz9iKnI5WEk'
                },
                map: map,
                styleId: 2,
                templateId: 2,
                suppressInfoWindows: true
            });
            google.maps.event.addListener(SecondLayer, 'click', function(e) {windowControl(e, infoWindow, map);
            });
        }   

        // Open the info window at the clicked location
        function windowControl(e, infoWindow, map) {
            infoWindow.setOptions({
                content: e.infoWindowHtml,
                position: e.latLng,
                pixelOffset: e.pixelOffset
            });
            infoWindow.open(map);
        }

        google.maps.event.addDomListener(window, 'load', initialize);

    </script>
</head>

<body>
    <div id="map-canvas"></div>

</body>

1 个答案:

答案 0 :(得分:2)

问题:

templateID: 5,
//-------^

D必须为小写