Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit e1d5d1a

Browse files
author
David Bailey
committed
working on speed
1 parent 63d2437 commit e1d5d1a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

speeds.tpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
<body>
1414
<div id="map" class="map"></div>
1515
<script type="text/javascript">
16+
function speed2color(speed){
17+
h = speed
18+
return Array(255*Math.sin(h),255*Math.sin(h+120),255*Math.sin(h+240),1);
19+
}
1620
var stops = {{!stops}};
1721
var speeds = {{!speeds}};
1822
var stopSource = new ol.source.Vector({
@@ -34,7 +38,7 @@
3438
return function(feature, resolution) {
3539
var style = new ol.style.Style({
3640
text: new ol.style.Text({ text: feature.getId(), scale: 1.5, fill: new ol.style.Fill({ color: 'rgba(0, 0, 0, 1)' }), stroke: new ol.style.Stroke({ color: 'rgba(255, 255, 255, 1)' }), offsetY: -20, offsetX: -20 }),
37-
stroke: new ol.style.Stroke({ color: 'rgba(' + Math.floor(feature.getId()) + ',' + Math.floor(feature.getId()) + ',' + Math.floor(feature.getId()) + ', 1)' }),
41+
stroke: new ol.style.Stroke({ width: feature.getId(), color: speed2color(feature.getId()) }),
3842
})
3943
return [style];
4044
}

0 commit comments

Comments
 (0)