【发布时间】:2015-10-26 00:52:51
【问题描述】:
我通过依次分别从多个 GeoJSON 功能加载数组 multipointCoords 来填充 OpenLayer 3 功能。每次加载 GeoJSON 功能时,我都会重用以下函数:
function makeLineString(multipointCoords) {
var trackSource = new ol.source.Vector();
var lineString = new ol.geom.LineString([ // create a linestring geometry from the GeoJSON data for the tracks
ol.proj.fromLonLat(multipointCoords[0][0])
]);
var trackFeature = new ol.Feature({ // create a feature with the linestring geometry
geometry: lineString
});
trackSource.addFeature(trackFeature); // add the feature to the sourc
var trackLayer = new ol.layer.Vector({ // create a layer with that source
source: trackSource
});
map.addLayer(trackLayer); // add the layer to the map
};
我是将所有特征(无论它们来自哪个数据集)加载到同一层还是创建了多个“trackLayers”?有没有办法解决它们来自数据集的层和特征?
【问题讨论】:
-
别忘了提供反馈?对吗?
标签: openlayers-3