【问题标题】:Points for rows from fusion table not shown in map gadget地图小工具中未显示融合表中的行的点
【发布时间】:2015-08-24 06:02:18
【问题描述】:

我有一个Google Sites page,上面有显示以色列速度陷阱位置的 Google 地图。 它显示来自 Google Fusion Tables table 的位置,通过将“类型”列的值划分为存储桶来显示地图上的位置。 请参阅下面的地图小工具 XML。

最近,我添加了几个带有新类型的新行 (7)。我发现这些新位置的点未显示在我的 Google 协作平台页面上的地图小工具中。但是,在融合表页面中,我可以看到这些位置就好了。

知道为什么会发生这种情况吗?

谢谢, 亚龙

地图小工具 XML: (为了清楚起见,删除了未使用的功能)

<Module>
<ModulePrefs 
description="Israel Speed Traps"
width="500"
height="600">
</ModulePrefs>
<Content type="html"><![CDATA[
<!DOCTYPE html>
<html>
<head>
<style>
  #map_canvas { width: 100%; height: 100%; }
</style>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&language=iw"></script>
<script type="text/javascript">
var map;

var layer;
var tableid = 2943387;

function initialize() {
  map = new google.maps.Map(document.getElementById('map_canvas'), {
    center: new google.maps.LatLng(32.407792,35.502319),
    zoom: 8,
    mapTypeId: google.maps.MapTypeId.HYBRID
  });

  layer = new google.maps.FusionTablesLayer(tableid);
  layer.setQuery("SELECT 'Location' FROM " + tableid);
  layer.setMap(map);
}

</script>

</head>
<body onload="initialize();">

<div id="map_canvas"></div>

</body>
</html>
]]></Content>
</Module>

【问题讨论】:

    标签: google-maps google-fusion-tables


    【解决方案1】:

    您的代码使用了错误的tableId

    你说的表的ID是1uMTPGcFuJsNxKcCLkSxAOIMJCrlzNIV46MUTlD4

    但您的代码指向另一个 ID 为 1OZ8ty7BP3di6WVEwtM-CTJhoQaNlIpZowsSHkHPR 的表,其中不包含 type:7 的行

    此外,当您想在小工具中应用相同的外观时,您还必须定义 templateId(对于 infowindows)和 styleId(对于功能样式)

    固定脚本:

    <script type="text/javascript">
    var map,
        layer,
        tableid = '1uMTPGcFuJsNxKcCLkSxAOIMJCrlzNIV46MUTlD4';
    function initialize() {
      map = new google.maps.Map(document.getElementById('map_canvas'), {
        center: new google.maps.LatLng(32.407792,35.502319),
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.HYBRID
      });
    
      layer = new google.maps.FusionTablesLayer(tableid,{
          options: {
            styleId: 3,
            templateId:3
          }});
      layer.setQuery("SELECT 'Location' FROM " + tableid);
      layer.setMap(map);
    }
    
    </script>
    

    【讨论】:

    • 谢谢,我使用以下 URL 解决了这个问题,在菜单中打开的“发布”建议:google.com/fusiontables/… 我根据您对 3 和 3 的建议编辑了参数“y”和“tmplt”,并且它似乎已经解决了这个问题。
    猜你喜欢
    • 1970-01-01
    • 2013-12-11
    • 1970-01-01
    • 2013-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-20
    相关资源
    最近更新 更多