【发布时间】:2016-01-23 03:08:31
【问题描述】:
我是 javascript 新手,但我正在尝试使用 openlayers 3 从 GPX 轨道读取心率扩展。
拖放交互接受 GPX 格式的构造函数。我可以通过传递 ol.format.GPX 构造函数来读取基本信息(纬度、经度、ele、时间),但我不知道如何使用“readExtensions”选项传递构造函数。
根据 openlayers 文档 (http://openlayers.org/en/v3.1.1/apidoc/ol.format.GPX.html),它应该是一个回调函数,但是当我运行我的代码时,我得到一个错误:TypeError: d[g] is not a constructor。
var dragAndDropInteraction = new ol.interaction.DragAndDrop({
formatConstructors: [
//ol.format.GPX(extFeature),
new ol.format.GPX({
readExtensions: function(x) {
return x;
}
}),
ol.format.GeoJSON,
ol.format.IGC,
ol.format.KML,
ol.format.TopoJSON
]
});
我如何格式化构造函数,以便获得扩展以及标准功能?
【问题讨论】:
标签: openlayers-3