2012-03-30 18 views
1

私はフュージョンテーブルレイヤーを使ってこの実装を行っています。ここでは、A〜Zの文字で事前定義されたマーカーアイコンを使用してマップ上で検索クエリの結果を表示しようとしています(元のGoogleマップと同じように)。フュージョンレイヤーにはいくつのマーカーを置くことができますか?

私は、これはすべてのマーカーのための一般的なアイコンで、第一の層を作成することである達成の方法は...

var layer = new google.maps.FusionTablesLayer({ 
    query: { 
     select: 'Geometry', 
     from: 0000000 
    }, 
    map: map, 
    options: { 
     suppressInfoWindows: true 
    }, 
    styles: [{ 
     markerOptions: { 
      iconName: "measle_white" 
     } 
    }] 
}); 

。一方、私はどこに基づきST_DISTANCE順序で25件の結果を得るために同じテーブルを照会マップは

var queryUrlHead = 'http://www.google.com/fusiontables/api/query?sql=', 
    queryUrlTail = '&jsonCallback=success', 
    query = 'SELECT+ID+FROM+0000000+ORDER+BY+ST_DISTANCE(Geometry,LATLNG('+position.coords.latitude+','+position.coords.longitude+'))+LIMIT+25'; 

var queryurl = queryUrlHead + query + queryUrlTail; 

ザ・

は、JSONオブジェクトは、私が「IDS」と呼ぶユニークIDの配列で返され、(geopositioned)中央に配置されます。私は次にいくつかのトリガー(zoomchanged)を使用して、文字アイコン( thisに触発されている)で最も近い25のアイコンを再描画します。

google.maps.event.addListener(map, 'zoom_changed', function() { 

layer.setOptions({ 
    styles: [{ 
      markerOptions: { 
       iconName: "measle_white" 
      } 
     }, //fallback 
     { 
      where: "'ID' = " + ids.table.rows[0][0], 
      markerOptions: { 
       iconName: "a_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[1][0], 
      markerOptions: { 
       iconName: "b_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[2][0], 
      markerOptions: { 
       iconName: "c_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[3][0], 
      markerOptions: { 
       iconName: "d_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[4][0], 
      markerOptions: { 
       iconName: "e_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[5][0], 
      markerOptions: { 
       iconName: "f_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[6][0], 
      markerOptions: { 
       iconName: "g_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[7][0], 
      markerOptions: { 
       iconName: "h_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[8][0], 
      markerOptions: { 
       iconName: "i_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[9][0], 
      markerOptions: { 
       iconName: "j_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[10][0], 
      markerOptions: { 
       iconName: "k_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[11][0], 
      markerOptions: { 
       iconName: "l_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[12][0], 
      markerOptions: { 
       iconName: "m_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[13][0], 
      markerOptions: { 
       iconName: "n_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[14][0], 
      markerOptions: { 
       iconName: "o_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[15][0], 
      markerOptions: { 
       iconName: "p_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[16][0], 
      markerOptions: { 
       iconName: "q_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[17][0], 
      markerOptions: { 
       iconName: "r_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[18][0], 
      markerOptions: { 
       iconName: "s_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[19][0], 
      markerOptions: { 
       iconName: "t_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[20][0], 
      markerOptions: { 
       iconName: "u_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[21][0], 
      markerOptions: { 
       iconName: "v_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[22][0], 
      markerOptions: { 
       iconName: "w_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[23][0], 
      markerOptions: { 
       iconName: "x_blue" 
      } 
     }, { 
      where: "'ID' = " + ids.table.rows[24][0], 
      markerOptions: { 
       iconName: "z_blue" 
      } 
     } 
    ] 
}); 

これは実際には、トップ5の結果A-D(フォールバックアイコンの+1)を除いてはっきりと動作します。何がここで間違っていた?私はいくつかの限界に達しましたか(markerOptionsは5つの値しかとらないのですか?)、またはコードを壊しましたか?

サイドノート:This exampleはレイヤーあたり5つ以上のアイコンが表示されていますが、Googleはそれを作成しましたが、わかりません。

答えて

0

申し訳ありませんが、Maps APIを使用して5つのスタイルしか設定できません。この制限はdevelopers guideに記載されています。 すべての可能なアイコンを表示しているマップがFTレイヤーではないと思われます。あなたはFTのUIを介して行われている場合は、より多くのスタイルを持つことができますが、それは動的ではない、おそらくあなたの状況では動作しません。

関連する問題