【发布时间】:2017-03-01 19:02:32
【问题描述】:
我正在开发一个众包网站,该网站从谷歌表单中获取输入并在地图上显示此信息。我正在使用 mapbox,并且正在寻找一种方法来让我的谷歌电子表格(带有纬度/经度信息)中的数据点自动显示在地图上。任何提示将不胜感激,谢谢!
【问题讨论】:
标签: javascript html google-sheets mapbox google-forms
我正在开发一个众包网站,该网站从谷歌表单中获取输入并在地图上显示此信息。我正在使用 mapbox,并且正在寻找一种方法来让我的谷歌电子表格(带有纬度/经度信息)中的数据点自动显示在地图上。任何提示将不胜感激,谢谢!
【问题讨论】:
标签: javascript html google-sheets mapbox google-forms
我正在做一个类似的项目。
我“发布”了我的 Google 电子表格:file > Publish To Web。
您应该会看到一个带有工作表 URL 的弹出窗口:
https://docs.google.com/spreadsheets/d/[your ID here]/pubhtml
一旦您拥有ID,您就可以在您的网站上使用它:
// ID of the Google Spreadsheet
var spreadsheetID = 'fakeExample';
// Make sure it is public or set to `Anyone with link can view`
var url = "https://spreadsheets.google.com/feeds/list/" + spreadsheetID + "/od6/public/values?alt=json";
$.getJSON(url, function(data) {
var entry = data.feed.entry;
$(entry).each(function(){
//do stuff with each entry in your spreadsheet
// for example, build a GeoJSON object with your lat/lons or add an individual marker
// ex: add the 'country' column to the `results` box
$('.results').prepend('<h2>'+this.gsx$country.$t+'</h2>);
});
});
【讨论】:
例如,我想您可以使用任何 mapbox js 映射 with omnivore。 表单结果进入谷歌工作表 - 使用一些脚本自动对其进行地理编码 - 将工作表发布到网络并以 csv 的结果显示 - 坐标会自动拉到加载时更新的地图。
【讨论】: