繁体   English   中英

openlayers 3 IGC文本来源

[英]openlayers 3 IGC source from text

我正在使用openlayers 3,并且正在寻找一种方法来加载跟踪数据,而不是从url,而是直接通过将文本添加到vectorsource IGC来加载。 我有坐标和时间作为数组的数据。 什么格式是正确的? 因此,对此:

var vectorSource = new ol.source.IGC({
projection: 'EPSG:3857',
urls: [
'data/igc/Clement-Latour.igc',
'data/igc/Damien-de-Baenst.igc',
'data/igc/Sylvain-Dhonneur.igc',
'data/igc/Tom-Payne.igc',
'data/igc/Ulrich-Prinz.igc'
]
});

我想使用这样的东西(不确定格式):

var vectorSource = new ol.source.IGC({
projection: 'EPSG:3857',
text: [
array1,
array2,
array3  // or arrayall with all three arrays, or text.. What is correct?
]
});

为了获得更多控制和灵活性,可以使用ol.source.Vectorol.format.IGC代替“方便的” ol.source.IGC 例如:

var source = new ol.source.Vector();

var format = new ol.format.IGC();
var readOptions = {featureProjection: 'EPSG:3857'};

var features = [
  format.readFeature(text1, readOptions),
  format.readFeature(text2, readOptions),
  format.readFeature(text3, readOptions)
];

source.addFeatures(features);

var layer = new ol.layer.Vector({source: source});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM