【问题标题】:Google Fusion Map Info Window Not FormattedGoogle Fusion Map Info 窗口未格式化
【发布时间】:2013-02-18 19:39:55
【问题描述】:

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

我已经使用 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>

【问题讨论】:

    标签: google-fusion-tables infowindow


    【解决方案1】:

    问题:

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

    D 必须小写

    【讨论】:

      猜你喜欢
      • 2022-10-25
      • 2013-01-12
      • 1970-01-01
      • 2012-11-04
      • 2015-07-21
      • 1970-01-01
      • 2014-12-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多