Google maps 融合表自动完成文本搜索

Google maps 融合表自动完成文本搜索,google-maps,search,autocomplete,google-fusion-tables,Google Maps,Search,Autocomplete,Google Fusion Tables,我看了一下,它显示了一个带有自动完成搜索框的融合表映射层。但在本例中,只有fusion表的前500行在自动完成中进行索引 找到下面的参考资料 function initAutoComplete(tableId) { // Retrieve the unique store names using GROUP BY workaround. var queryText = encodeURIComponent( "SELECT 'FB_INDO_2000', CO

我看了一下,它显示了一个带有自动完成搜索框的融合表映射层。但在本例中,只有fusion表的前500行在自动完成中进行索引

找到下面的参考资料

  function initAutoComplete(tableId) {
    // Retrieve the unique store names using GROUP BY workaround.
    var queryText = encodeURIComponent(
        "SELECT 'FB_INDO_2000', COUNT() " +
        'FROM ' + tableId + " GROUP BY 'FB_INDO_2000'");
    var query = new google.visualization.Query(
        'http://www.google.com/fusiontables/gvizdata?tq='  + queryText);

    query.send(function(response) {
      var numRows = response.getDataTable().getNumberOfRows();

      // Create the list of results for display of autocomplete.
      var results = [];
      for (var i = 0; i < numRows; i++) {
        results.push(response.getDataTable().getValue(i, 0));
      }

      // Use the results to create the autocomplete options.
      $('#store').autocomplete({
        source: results,
        minLength: 2
      });
    });
  }
但无法实现自动完成。

使用,它没有该限制

代码的工作版本:

<script src="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT%20'FB_INDO_2000'%20FROM%201E9BosnI16GISRmTBkINI2aWlYVdZae46v8jClAc%20GROUP%20BY%20'FB_INDO_2000'&callback=drawMap&key=AIzaSyCAI2GoGWfLBvgygLKQp5suUk3RCG7r_ME" type="text/javascript" ></script>

   function drawMap(response) {
      var numRows = response.rows.length;

      // Create the list of results for display of autocomplete.
      var results = [];
      for (var i = 0; i < numRows; i++) {
        results.push(response.rows[i][0]);
      }

      // Use the results to create the autocomplete options.
      $('#store').autocomplete({
        source: results,
        minLength: 2
      });
   };

功能图(响应){
var numRows=response.rows.length;
//创建结果列表以显示自动完成。
var结果=[];
对于(变量i=0;i

问题在于,您使用的是谷歌可视化API来获取数据,它的行数限制为500行。通过JSONP发布的FT 1.0 API并不像@Swires指出的那样。
请参见此示例:

我自己在此处将我的小提琴修改为FT API v1:但自动完成功能不起作用。我哪里错了?您没有正确使用Fusion Tables v1 API(您仍在使用google.visualization.Query调用,您需要用等效的v1调用替换该调用)。用一把有效的小提琴更新了我的答案(以及使其工作所需的代码)检查javascript控制台:
uncaughtreferenceerror:queryresponse未定义
自我将我的小提琴修改为FT API v1此处:jsfiddle.net/HnwA2/3,但自动完成功能不起作用。我错在哪里?
<script src="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT%20'FB_INDO_2000'%20FROM%201E9BosnI16GISRmTBkINI2aWlYVdZae46v8jClAc%20GROUP%20BY%20'FB_INDO_2000'&callback=drawMap&key=AIzaSyCAI2GoGWfLBvgygLKQp5suUk3RCG7r_ME" type="text/javascript" ></script>

   function drawMap(response) {
      var numRows = response.rows.length;

      // Create the list of results for display of autocomplete.
      var results = [];
      for (var i = 0; i < numRows; i++) {
        results.push(response.rows[i][0]);
      }

      // Use the results to create the autocomplete options.
      $('#store').autocomplete({
        source: results,
        minLength: 2
      });
   };