Set path style in layer, rather than per feature

This commit is contained in:
Adam Goldsmith 2018-07-21 12:08:21 -04:00
parent ae14553891
commit 146f9f7bd2

View File

@ -74,7 +74,10 @@ function pathStyle(feature) {
} }
function plotPaths(packets) { function plotPaths(packets) {
let vector_layer = new VectorLayer({source: new VectorSource()}); let vector_layer = new VectorLayer({
source: new VectorSource(),
style: pathStyle
});
map.addLayer(vector_layer); map.addLayer(vector_layer);
packets packets
@ -98,8 +101,6 @@ function plotPaths(packets) {
hue: colorGen.get(map.size) hue: colorGen.get(map.size)
}); });
pathFeature.setStyle(pathStyle);
vector_layer.getSource().addFeature(pathFeature); vector_layer.getSource().addFeature(pathFeature);
pathFeature.getGeometry().transform(new Projection({code: "EPSG:4326"}), pathFeature.getGeometry().transform(new Projection({code: "EPSG:4326"}),
tile_layer.getSource().getProjection()); tile_layer.getSource().getProjection());