2
我是新来的JavaScript,但想读从GPX轨道心脏率与延长3的OpenLayers的OpenLayers 3 readExtensions GPX
拖放交互接受对GPX格式的构造。我可以通过传递ol.format.GPX构造函数来读取基本信息(lat,lon,ele,time),但我无法弄清楚如何使用'readExtensions'选项传递构造函数。
根据openlayers文档(http://openlayers.org/en/v3.1.1/apidoc/ol.format.GPX.html),它应该是一个回调函数,但是当我运行我的代码时,出现错误:TypeError:d [g]不是构造函数。
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
]
});
我该如何格式化构造函数,以便获得扩展以及标准功能?