问题描述
我正在尝试使用在 javascript 中找到的 togpx 方法将 geojson 文件转换为 gpx 文件:
问题是,当我尝试保存文件时,我收到错误 IMarshal
,即使我将库放在浏览器页面中并作为命令行工具安装。
这是我的代码:
Uncaught ReferenceError: togpx is not defined
我使用 document.getElementById('export').onclick = function(e) {
var gpxFile;
// Extract GeoJson from drawnItems
var data = drawnItems.toGeoJSON();
// Stringify the GeoJson
var convertedData = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(data));
gpxFile = togpx(convertedData); //here I have the error
var convertedGpx = 'text/xml;charset=utf-8,' + encodeURIComponent(gpxFile);
// Create export
document.getElementById('export').setAttribute('href','data:' + convertedGpx);
document.getElementById('export').setAttribute('download','route.gpx');
}
你能帮我解决这个问题吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)