簡體   English   中英

帶有Google表格的Mapbox數據

[英]Mapbox data with google sheets

我正在努力開發一個眾包網站,該網站從Google表單獲取信息並在地圖上顯示此信息。 我正在使用mapbox,正在尋找一種方法來獲取Google電子表格中的數據點(含經緯度信息)以自動顯示在地圖上。 任何提示將不勝感激,謝謝!

我正在做一個類似的項目。

我“發布”了我的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地圖 omn​​ivore 一起使用。 表單結果放在Google工作表中-使用一些腳本自動對其進行地理編碼-將工作表中的結果以csv的形式發布到網絡上-坐標會自動拉到加載時會更新的地圖。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM