我希望可以选择从Google Spreadsheets保存geoJSON文件。
问题在这里提出:
https://gis.stackexchange.com/questions/140995/publishing-google-sheet-to-web-as-geojson-file
尽管此插件可用:
https://github.com/mapbox/geo-googledocs/
不起作用,因为地址解析收到错误消息:
https://github.com/mapbox/geo-googledocs/issues/42
UiApp已被弃用。请改用HtmlService。
我厌倦了将此插件提供的现有代码与为解决此问题而提出的代码结合起来:
https://gist.github.com/hidrodixtion/c3a6b6ba7af624d1800625efb7a40fbd
The code name is Geo.js as per the plugin provided above
我将功能doGet
放在Geocoder的上方,如下所示:
// Global variables
function doGet() {
return HtmlService.createHtmlOutputFromFile('Index');
}
var ss = Spreadsheetapp.getactiveSpreadsheet(),sheet = ss.getactiveSheet(),activeRange = ss.getactiveRange(),settings = {};
var geocoders = {
yahoo: {
...此处的另一部分代码:
https://raw.githubusercontent.com/mapbox/geo-googledocs/master/MapBox.js
不幸的是,它不起作用。
似乎我不知道我必须superseed the depreciated UiApp function with the HTML service。 问题是,我不知道应该替换Geo插件中代码的哪一部分。这可能真的很有帮助,因为该插件也可以进行地理编码。
组合的另一部分如下: 我更改了代码: //创建一个新的UI var app = UiApp.createApplication() .setTitle('导出GeoJSON') .setStyleAttribute('width','460') .setStyleAttribute('padding','20');
进入:
var app = HtmlService.createHtmlOutput().setWidth(800).setHeight(600);
.setTitle('Export GeoJSON') //line 105
.setStyleAttribute('width','460')
.setStyleAttribute('padding','20');
但是一旦保存,我就会得到: 语法错误。 (第105行,文件“ Geo”)
我从这里领取了这段代码:
https://gist.github.com/hidrodixtion/c3a6b6ba7af624d1800625efb7a40fbd 第141行
有人知道如何解决此问题吗?