fusiontable table format

白昼怎懂夜的黑 提交于 2019-12-25 08:30:27

问题


I have a excel sheet which has around 5000 rows in it.I have used JavaScript API to view the location coloumn in my webpage.User can also query the results from my webpage using SQL API.Now I want to display those query results not only in map also as a table in my webpage.How to do it?


回答1:


Use the Visualization API.




回答2:


I believe the Visualization API has a 500 row limit. Another alternative is to use Fusion Table's JSONP support. I posted some example code in these SO answers:

https://stackoverflow.com/a/10343112/1211981

https://stackoverflow.com/a/9778985/1211981

UPDATE:

Here's an example link which lets a user download a FT as a CSV. It's a bit long and URL encoded for display in a web page.

https://www.google.com/fusiontables/api/query?sql=SELECT%20program,platform,observables,obs_url%20FROM%202796211%20WHERE%20%27program%27%20=%20%27NERACOOS%27%20and%20%27data_provider%27%20=%20%27LISICOS%27

And some code showing how to do it. Assuming your where clause is correct.

    var queryUrlHead = 'https://www.google.com/fusiontables/api/query?sql=';
    var qry = "SELECT * FROM " + table_id " WHERE " + where;

    var enc_qry = encodeURI(queryUrlHead + qry);

    var csv_link = '<a target="_new" href="' + enc_qry + '">Download as CSV</a><br />';
    // this is jQuery
    $("#csv_link").text('');
    $("#csv_link").append(csv_link);


来源:https://stackoverflow.com/questions/10429297/fusiontable-table-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!