使用自定义网址图标设置融合表标记?

RID*_*DER 1 google-maps-api-3 google-maps-markers google-fusion-tables

我想根据融合表中的字段设置我的融合表标记的样式.如果我使用默认的Google标记,则以下代码有效:

        layer = new google.maps.FusionTablesLayer({
      query: {
        select: 'bizCity',
        from: '1yfyijoeC3GwDnnLutBI8IFOH8y2mfZ8LJGUDly4'
      },
    styles: [
  {where: "'bizCatSub' = 'Antique & Classic Motorcycle Dealers'", markerOptions:{ iconName:"star"}}, // other landmarks
  {where: "'bizCatSub' = 'Other moto business'", markerOptions:{ iconName:"wht_pushpin"}}, //businesses
  {where: "'bizCatSub' = 'Shop'", markerOptions:{iconName:"red_blank"}}, //town houses
  {where: "'bizCatSub' = '12'", markerOptions:{ iconName:"orange_blank"}}, //country homes
  {where: "'bizCatSub' = '15'", markerOptions:{ iconName:"target"}},
  ]  
    });
    layer.setMap(map);
Run Code Online (Sandbox Code Playgroud)

你可以在这里看到jsfiddle.

但是,我想使用自己的自定义标记.为此,我尝试过这样的事情:

        layer = new google.maps.FusionTablesLayer({
      query: {
        select: 'bizCity',
        from: '1yfyijoeC3GwDnnLutBI8IFOH8y2mfZ8LJGUDly4'
      },
    styles: [
  {where: "'bizCatSub' = 'Antique & Classic Motorcycle Dealers'", markerOptions:{ url: "http://pollster.net/test/icons/dealer.png" }}, 
  {where: "'bizCatSub' = 'Other moto business'", markerOptions:{ url: "http://pollster.net/test/icons/othermoto.png" }}, 
  {where: "'bizCatSub' = 'Shop'", markerOptions:{ url: "http://pollster.net/test/icons/shop.png" }}
  ]  
    });
    layer.setMap(map);
Run Code Online (Sandbox Code Playgroud)

使用上面的代码,数据显示在地图上,但它使用默认标记,而不是根据请求设置样式. Jsfiddle在这里.我查看了样式和标记选项和图标的文档,并尝试了不同的变体,但没有任何对我有用.我想我错过了一些简单的东西,但不确定是什么.

谁知道我错过了什么?

Jef*_*ows 10

Fusion Table Layer实际上不允许自定义标记图标.这是一个已知问题:http://code.google.com/p/fusion-tables/issues/detail?id = 69

但是,有一些解决方法,可能最简单的一个是几个月前谷歌员工在该线程底部附近发布的:http://code.google.com/p/fusion-tables/issues/detail? ID = 69个#C107

解决方法的要点是你将不再使用FusionTableLayer,而是使用javascript来获取融合表数据并自己添加自定义标记.这是更多的代码,但它似乎运行得很好:https://googledrive.com/host/0B9htKoV1ZaKUU1g3ZnJCUWQyd28/customicons_viaApi.html

  • 所描述的解决方法使标记客户端而不是使用Google的服务器.除非你有大量的标记要显示,否则这通常不是问题. (2认同)