javascript - Load Google Spreadsheet to visualize with leaflet -
my data source map based on mapbox.js hosted in spreadsheet on google drive. use geo google docs export locations geojson , leaflet.markercluster visualize them on map.
i need load registers directly google drive changes reflected without exporting data. mapbox.js api has different methods fullfill none of them works me. question (a) of them preferred 1 , (b) how can make 1 work:
markerlayer.loadurl() methode loads , shows geojson data can't figure out how directly access google drive file in geojson format without exporting first.
i tried use jquery getjson method callback doesn't call defined function:
$.getjson("https://spreadsheets.google.com/feeds/list/key/od6/public/basic?alt=json-in-script&callback=loadmarkers");
markerlayer.setgeojson(): published spreadsheet csv , used csv2geojson convert geojson similary loading csv markers example. using following code typeerror: t undefined error @ line 5 of mapbox.js.
$.ajax({ url: 'https://docs.google.com/spreadsheet/pub?key=key&output=csv', success: function csvload(csv) { markerlayer.setgeojson(csv2geojson.csv2geojson(csv, function(err, data) { })); } });
thanks help.
take @ recline.js, library building data applications. has google docs data source allows read spreadsheet using google docs json api this:
recline.backend.gdocs.fetch({ url: 'https://docs.google.com/a/okfn.org/spreadsheet/ccc?key=0aon3jiuouxluddlgv2lcakoydvh1u014chrqcxpowve#gid=0' }) .done(function(result) { // structure of result below console.log(result); });
more details , examples @ https://github.com/okfn/recline.backend.gdocs
Comments
Post a Comment