适用于Fusion Tables(Google地图)的iconStyler不会拉列数据 [英] iconStyler for Fusion Tables (Google Maps) won't pull column data

查看:131
本文介绍了适用于Fusion Tables(Google地图)的iconStyler不会拉列数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Maps API制作地图,并遇到了麻烦。在表格中,我有一个标记每个标记('mStyle',它是col3)的iconName的列。在下面的代码中,我试图设置基于列值的图标样式,并且我尝试了许多不同的迭代,但这些迭代没有奏效。包括这一个。

让我感到困惑的是,用iconName:'grn_blank'(或其他)替代iconStyler:{}确实有效。 markerOptions的文档位于以下位置: https://developers.google.com/fusiontables/ docs / v1 / reference / style

  var layer = new google.maps.FusionTablesLayer(); 
layer.setOptions

{
query:
{
select:col0,
from:1UtgWf_kgwI3iUtrWvH3vIbxJfBdutl9oR8Wjqhiv,
其中:

款式:
[{
markerOptions:
{
iconStyler:
{
kind:'fromColumn',
columnName:'mStyle',
}
}
}]
}
);

代码可以在这里访问: https://drive.google.com/file/d/0BxeBEc_dsbUqWVJwbV9JTXRvb2s/edit?usp=sharing



地图的外观应该是在DC区域以800种不同颜色(红色,紫色,蓝色,绿色,浅蓝色和白色)为标志。他们代表学校。我可以让它在基于浏览器的编辑器中工作,但是一旦我得到这件作品,我就添加动态,所以我需要它在Javascript中工作。

谢谢

解决方案

点击fusion表中的map选项卡用户界面,选择发布,获取HTML和Javascript。
在该代码中,获取图层定义:

  layer = new google.maps.FusionTablesLayer({
map:map,
heatmap:{enabled:false},
query:{
select:col0,
from:1UtgWf_kgwI3iUtrWvH3vIbxJfBdutl9oR8Wjqhiv,
其中:

选项:{
styleId:2,
templateId:2
}
});

您希望在那里定义styleId和templateId(对我来说看起来像2和2)。


I am building a map using the Google Maps API and have hit a snag. In the table I have a column that labels the iconName for each marker ('mStyle', it's col3). In the following code I am trying to set the icon style based on the column values, and I've tried many, many different iterations that haven't worked. Including this one.

What has perplexed me, is that replacing iconStyler:{} with iconName: 'grn_blank' (or whatever) does work. The documentation for markerOptions is here: https://developers.google.com/fusiontables/docs/v1/reference/style

        var layer = new google.maps.FusionTablesLayer();
    layer.setOptions
    (
    {
      query: 
      {
        select: "col0",
        from: "1UtgWf_kgwI3iUtrWvH3vIbxJfBdutl9oR8Wjqhiv",
        where: ""
      },
      styles: 
      [{
       markerOptions:
       { 
        iconStyler:
        {
          kind: 'fromColumn',
          columnName: 'mStyle',
        }               
       }
      }]
    }
    );

The code can be accessed here: https://drive.google.com/file/d/0BxeBEc_dsbUqWVJwbV9JTXRvb2s/edit?usp=sharing

The way the map should look is about 800 flags in the DC area, in various colors (red, purple, blue, green, light blue, and white). They represent schools. I can make it work in the browser-based editor, but I am adding dynamics once I get this piece to work, so I need it to work in Javascript.

Thanks

解决方案

Click on the map tab in the fusion tables UI, select "Publish", "Get HTML and Javascript". In that code grab the layer definition:

    layer = new google.maps.FusionTablesLayer({
      map: map,
      heatmap: { enabled: false },
      query: {
        select: "col0",
        from: "1UtgWf_kgwI3iUtrWvH3vIbxJfBdutl9oR8Wjqhiv",
        where: ""
      },
      options: {
        styleId: 2,
        templateId: 2
      }
    });

you want the styleId and templateId defined there (looks like 2 and 2 to me).

这篇关于适用于Fusion Tables(Google地图)的iconStyler不会拉列数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆