Skip to content

Commit 34484fa

Browse files
committed
Add arrows showing turn penalties.
1 parent e179168 commit 34484fa

File tree

5 files changed

+168
-0
lines changed

5 files changed

+168
-0
lines changed

debug/arrows.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"0": {
3+
"height": 30,
4+
"pixelRatio": 1,
5+
"width": 30,
6+
"x": 0,
7+
"y": 0
8+
},
9+
"135": {
10+
"height": 30,
11+
"pixelRatio": 1,
12+
"width": 30,
13+
"x": 30,
14+
"y": 0
15+
},
16+
"45": {
17+
"height": 30,
18+
"pixelRatio": 1,
19+
"width": 30,
20+
"x": 0,
21+
"y": 30
22+
},
23+
"90": {
24+
"height": 30,
25+
"pixelRatio": 1,
26+
"width": 30,
27+
"x": 30,
28+
"y": 30
29+
},
30+
"n135": {
31+
"height": 30,
32+
"pixelRatio": 1,
33+
"width": 30,
34+
"x": 60,
35+
"y": 0
36+
},
37+
"n45": {
38+
"height": 30,
39+
"pixelRatio": 1,
40+
"width": 30,
41+
"x": 90,
42+
"y": 0
43+
},
44+
"n90": {
45+
"height": 30,
46+
"pixelRatio": 1,
47+
"width": 30,
48+
"x": 60,
49+
"y": 30
50+
}
51+
}

debug/arrows.png

1.34 KB
Loading

debug/[email protected]

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"0": {
3+
"height": 60,
4+
"pixelRatio": 2,
5+
"width": 60,
6+
"x": 0,
7+
"y": 0
8+
},
9+
"135": {
10+
"height": 60,
11+
"pixelRatio": 2,
12+
"width": 60,
13+
"x": 60,
14+
"y": 0
15+
},
16+
"45": {
17+
"height": 60,
18+
"pixelRatio": 2,
19+
"width": 60,
20+
"x": 0,
21+
"y": 60
22+
},
23+
"90": {
24+
"height": 60,
25+
"pixelRatio": 2,
26+
"width": 60,
27+
"x": 60,
28+
"y": 60
29+
},
30+
"n135": {
31+
"height": 60,
32+
"pixelRatio": 2,
33+
"width": 60,
34+
"x": 120,
35+
"y": 0
36+
},
37+
"n45": {
38+
"height": 60,
39+
"pixelRatio": 2,
40+
"width": 60,
41+
"x": 180,
42+
"y": 0
43+
},
44+
"n90": {
45+
"height": 60,
46+
"pixelRatio": 2,
47+
"width": 60,
48+
"x": 120,
49+
"y": 60
50+
}
51+
}

debug/[email protected]

2.66 KB
Loading

debug/index.html

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"zoom": 12.177865411775025,
118118
"bearing": 0,
119119
"pitch": 0,
120+
"sprite": "arrows",
120121
"sources": {
121122
"composite": {
122123
"url": "mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7",
@@ -5113,6 +5114,71 @@
51135114
},
51145115
"source-layer": "speeds",
51155116
"interactive": true
5117+
},
5118+
{
5119+
"id": "osrm-0", "type": "symbol", "source": "osrm", "source-layer": "turns",
5120+
"layout": { "icon-image": "0", "icon-offset": [10,0], "icon-allow-overlap": true, "icon-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] },
5121+
"text-field": "{cost}", "text-offset": [2,0], "text-allow-overlap": true, "text-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] } ,
5122+
"text-size": { "base": 1, "stops": [ [ 10, 8 ], [ 18, 11 ] ] }, "text-font": [ "Arial Unicode MS Bold" ] },
5123+
"paint": {
5124+
"icon-color" : "#ffffff", "icon-halo-color" : "#ffffff", "icon-halo-width" : 2,
5125+
"text-color": "hsl(0, 0%, 100%)", "text-halo-width": { "base": 1, "stops": [ [ 10, 10 ], [ 18, 13 ] ] }, "text-halo-color": "hsl(0, 0%, 0%)", "text-halo-blur": 0
5126+
},
5127+
"filter": ["all",[">=","turn_angle",-22.5],["<","turn_angle",22.5]]
5128+
},
5129+
{
5130+
"id": "osrm-45", "type": "symbol", "source": "osrm", "source-layer": "turns",
5131+
"layout": { "icon-image": "45", "icon-offset": [20,20], "icon-allow-overlap": true, "icon-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] },
5132+
"text-field": "{cost}", "text-offset": [2,2], "text-allow-overlap": true, "text-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] } ,
5133+
"text-size": { "base": 1, "stops": [ [ 10, 8 ], [ 18, 11 ] ] }, "text-font": [ "Arial Unicode MS Bold" ]},
5134+
"paint": { "icon-color" : "#ffffff", "icon-halo-color" : "#ffffff", "icon-halo-width" : 2,
5135+
"text-color": "hsl(0, 0%, 100%)", "text-halo-width": { "base": 1, "stops": [ [ 10, 10 ], [ 18, 13 ] ] }, "text-halo-color": "hsl(0, 0%, 0%)", "text-halo-blur": 0},
5136+
"filter": ["all",[">=","turn_angle",22.5],["<","turn_angle",67.5]]
5137+
},
5138+
{
5139+
"id": "osrm-90", "type": "symbol", "source": "osrm", "source-layer": "turns",
5140+
"layout": { "icon-image": "90", "icon-offset": [20,20], "icon-allow-overlap": true, "icon-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] },
5141+
"text-field": "{cost}", "text-offset": [2,2], "text-allow-overlap": true, "text-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] } ,
5142+
"text-size": { "base": 1, "stops": [ [ 10, 8 ], [ 18, 11 ] ] }, "text-font": [ "Arial Unicode MS Bold" ]},
5143+
"paint": { "icon-color" : "#ffffff", "icon-halo-color" : "#ffffff", "icon-halo-width" : 2,
5144+
"text-color": "hsl(0, 0%, 100%)", "text-halo-width": { "base": 1, "stops": [ [ 10, 10 ], [ 18, 13 ] ] }, "text-halo-color": "hsl(0, 0%, 0%)", "text-halo-blur": 0},
5145+
"filter": ["all",[">=","turn_angle",67.5],["<","turn_angle",115.5]]
5146+
},
5147+
{
5148+
"id": "osrm-135", "type": "symbol", "source": "osrm", "source-layer": "turns",
5149+
"layout": { "icon-image": "135", "icon-offset": [20,20], "icon-allow-overlap": true, "icon-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] },
5150+
"text-field": "{cost}", "text-offset": [2,2], "text-allow-overlap": true, "text-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] } ,
5151+
"text-size": { "base": 1, "stops": [ [ 10, 8 ], [ 18, 11 ] ] }, "text-font": [ "Arial Unicode MS Bold" ]},
5152+
"paint": { "icon-color" : "#ffffff", "icon-halo-color" : "#ffffff", "icon-halo-width" : 2,
5153+
"text-color": "hsl(0, 0%, 100%)", "text-halo-width": { "base": 1, "stops": [ [ 10, 10 ], [ 18, 13 ] ] }, "text-halo-color": "hsl(0, 0%, 0%)", "text-halo-blur": 0},
5154+
"filter": ["all",[">=","turn_angle",115.5],["<","turn_angle",180]]
5155+
},
5156+
{
5157+
"id": "osrm-n135", "type": "symbol", "source": "osrm", "source-layer": "turns",
5158+
"layout": { "icon-image": "n135", "icon-offset": [20,40], "icon-allow-overlap": true, "icon-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] },
5159+
"text-field": "{cost}", "text-offset": [2,4], "text-allow-overlap": true, "text-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] } ,
5160+
"text-size": { "base": 1, "stops": [ [ 10, 8 ], [ 18, 11 ] ] }, "text-font": [ "Arial Unicode MS Bold" ]},
5161+
"paint": { "icon-color" : "#ffffff", "icon-halo-color" : "#ffffff", "icon-halo-width" : 2,
5162+
"text-color": "hsl(0, 0%, 100%)", "text-halo-width": { "base": 1, "stops": [ [ 10, 10 ], [ 18, 13 ] ] }, "text-halo-color": "hsl(0, 0%, 0%)", "text-halo-blur": 0},
5163+
"filter": ["all",["<=","turn_angle",-115.5],[">","turn_angle",-180]]
5164+
},
5165+
{
5166+
"id": "osrm-n90", "type": "symbol", "source": "osrm", "source-layer": "turns",
5167+
"layout": { "icon-image": "n90", "icon-offset": [20,40], "icon-allow-overlap": true, "icon-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] },
5168+
"text-field": "{cost}", "text-offset": [2,4], "text-allow-overlap": true, "text-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] } ,
5169+
"text-size": { "base": 1, "stops": [ [ 10, 8 ], [ 18, 11 ] ] }, "text-font": [ "Arial Unicode MS Bold" ]},
5170+
"paint": { "icon-color" : "#ffffff", "icon-halo-color" : "#ffffff", "icon-halo-width" : 2,
5171+
"text-color": "hsl(0, 0%, 100%)", "text-halo-width": { "base": 1, "stops": [ [ 10, 10 ], [ 18, 13 ] ] }, "text-halo-color": "hsl(0, 0%, 0%)", "text-halo-blur": 0},
5172+
"filter": ["all",["<=","turn_angle",-67.5],[">","turn_angle",-115.5]]
5173+
},
5174+
{
5175+
"id": "osrm-n45", "type": "symbol", "source": "osrm", "source-layer": "turns",
5176+
"layout": { "icon-image": "n45", "icon-offset": [20,40], "icon-allow-overlap": true, "icon-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] },
5177+
"text-field": "{cost}", "text-offset": [2,4], "text-allow-overlap": true, "text-rotate": { property: "bearing_in", stops: [[0, 0], [360, 360]] } ,
5178+
"text-size": { "base": 1, "stops": [ [ 10, 8 ], [ 18, 11 ] ] }, "text-font": [ "Arial Unicode MS Bold" ]},
5179+
"paint": { "icon-color" : "#ffffff", "icon-halo-color" : "#ffffff", "icon-halo-width" : 2 ,
5180+
"text-color": "hsl(0, 0%, 100%)", "text-halo-width": { "base": 1, "stops": [ [ 10, 10 ], [ 18, 13 ] ] }, "text-halo-color": "hsl(0, 0%, 0%)", "text-halo-blur": 0},
5181+
"filter": ["all",["<=","turn_angle",-22.5],[">","turn_angle",-67.5]]
51165182
}
51175183
],
51185184
"created": "2016-03-14T20:42:54.687Z",

0 commit comments

Comments
 (0)