@@ -4,8 +4,8 @@ import * as Color from "../constants/color.js";
44import * as Util from "../js/util.js" ;
55
66const motorwayHue = 218 ;
7- const stateHue = 40 ;
8- const tollRoadHue = 100 ;
7+ const trunkHue = 0 ;
8+ const tollRoadHue = 50 ;
99
1010// Common filter expressions
1111const isRoad = [
@@ -31,16 +31,19 @@ const isToll = ["==", ["get", "toll"], 1];
3131const isNotToll = [ "!" , isToll ] ;
3232const isMotorway = [ "all" , [ "==" , [ "get" , "class" ] , "motorway" ] , isNotRamp ] ;
3333const isNotMotorway = [ "!=" , [ "get" , "class" ] , "motorway" ] ;
34- const isState = [
34+ const isTrunk = [ "all" , [ "==" , [ "get" , "class" ] , "trunk" ] , isNotRamp ] ;
35+ const isNotTrunk = [ "!" , isTrunk ] ;
36+ const isExpressway = [ "==" , [ "get" , "expressway" ] , 1 ] ;
37+ const isNotExpressway = [ "!" , isExpressway ] ;
38+ const isDivided = [ "any" , isMotorway , isExpressway ] ;
39+ const isArterial = [
3540 "match" ,
36- [ "get" , "network " ] ,
37- [ "us-highway " , "us-state " ] ,
38- isNotRamp ,
41+ [ "get" , "class " ] ,
42+ [ "primary " , "secondary " ] ,
43+ true ,
3944 false ,
4045] ;
41- const isNotState = [ "!" , isState ] ;
42- const isExpressway = [ "==" , [ "get" , "expressway" ] , 1 ] ;
43- const isNotExpressway = [ "!" , isExpressway ] ;
46+ const isNotArterial = [ "!" , isArterial ] ;
4447const isService = [ "==" , [ "get" , "class" ] , "service" ] ;
4548const isNotService = [ "!" , isService ] ;
4649const isMinorService = [
@@ -101,8 +104,11 @@ export const road = {
101104 "line-join" : "round" ,
102105 "line-sort-key" : [
103106 "+" ,
104- [ "to-number" , isMotorway ] ,
105- [ "to-number" , isState ] ,
107+ [
108+ "index-of" ,
109+ [ "get" , "class" ] ,
110+ [ "literal" , [ "tertiary" , "secondary" , "primary" , "trunk" , "motorway" ] ] ,
111+ ] ,
106112 [ "to-number" , isRamp ] ,
107113 ] ,
108114 } ,
@@ -118,8 +124,8 @@ export const road = {
118124 `hsl(${ tollRoadHue } , 60%, 70%)` ,
119125 isMotorway ,
120126 `hsl(${ motorwayHue } , 60%, 70%)` ,
121- isState ,
122- `hsl(${ stateHue } , 77 %, 50 %)` ,
127+ isTrunk ,
128+ `hsl(${ trunkHue } , 60 %, 70 %)` ,
123129 "#9c9c9c" ,
124130 ] ,
125131 8 ,
@@ -129,8 +135,8 @@ export const road = {
129135 `hsl(${ tollRoadHue } , 100%, 40%)` ,
130136 isMotorway ,
131137 `hsl(${ motorwayHue } , 100%, 45%)` ,
132- isState ,
133- `hsl(${ stateHue } , 77 %, 50 %)` ,
138+ isTrunk ,
139+ `hsl(${ trunkHue } , 60 %, 60 %)` ,
134140 "#9c9c9c" ,
135141 ] ,
136142 14 ,
@@ -140,10 +146,12 @@ export const road = {
140146 `hsl(${ tollRoadHue } , 100%, 35%)` ,
141147 isMotorway ,
142148 `hsl(${ motorwayHue } , 100%, 35%)` ,
143- isState ,
144- `hsl(${ stateHue } , 77 %, 50 %)` ,
149+ isTrunk ,
150+ `hsl(${ trunkHue } , 60 %, 60 %)` ,
145151 [ "all" , [ "==" , [ "get" , "class" ] , "motorway" ] , isRamp ] ,
146- "#000" ,
152+ "hsl(0, 0%, 20%)" ,
153+ isArterial ,
154+ "hsl(0, 0%, 30%)" ,
147155 "#9c9c9c" ,
148156 ] ,
149157 ] ,
@@ -153,30 +161,30 @@ export const road = {
153161 [ "zoom" ] ,
154162 4 ,
155163 1 ,
164+ 7 ,
165+ 1 ,
156166 8 ,
157167 [
158168 "case" ,
159- isMotorway ,
160- 3 ,
161- isExpressway ,
169+ isDivided ,
162170 1 ,
163- isState ,
171+ isTrunk ,
164172 2 ,
165173 [ "match" , [ "get" , "class" ] , [ "trunk" , "primary" ] , isNotRamp , false ] ,
166- 2 ,
174+ 1 ,
167175 0.25 ,
168176 ] ,
169177 18 ,
170178 [
171179 "case" ,
172- isMotorway ,
173- 6 ,
174- [ "all" , isState , isNotExpressway ] ,
180+ [ "all" , isMotorway , isNotExpressway ] ,
181+ 4 ,
182+ [ "all" , isTrunk , isNotExpressway ] ,
175183 4 ,
176184 [
177185 "match" ,
178186 [ "get" , "class" ] ,
179- [ "trunk" , "primary" , "secondary" , "tertiary" ] ,
187+ [ "motorway" , " trunk", "primary" , "secondary" , "tertiary" ] ,
180188 isNotRamp ,
181189 false ,
182190 ] ,
@@ -188,14 +196,14 @@ export const road = {
188196 20 ,
189197 [
190198 "case" ,
191- isMotorway ,
192- 10 ,
193- [ "all" , isState , isNotExpressway ] ,
199+ [ "all" , isMotorway , isNotExpressway ] ,
200+ 8 ,
201+ [ "all" , isTrunk , isNotExpressway ] ,
194202 8 ,
195203 [
196204 "match" ,
197205 [ "get" , "class" ] ,
198- [ "trunk" , "primary" , "secondary" , "tertiary" ] ,
206+ [ "motorway" , " trunk", "primary" , "secondary" , "tertiary" ] ,
199207 isNotRamp ,
200208 false ,
201209 ] ,
@@ -209,10 +217,12 @@ export const road = {
209217 "interpolate" ,
210218 [ "exponential" , 1.2 ] ,
211219 [ "zoom" ] ,
212- 4 ,
213- [ "case" , isExpressway , 1 , 0 ] ,
220+ 7 ,
221+ 0 ,
222+ 8 ,
223+ [ "case" , isDivided , 1 , 0 ] ,
214224 12 ,
215- [ "case" , isExpressway , 3 , 0 ] ,
225+ [ "case" , isDivided , 3 , 0 ] ,
216226 14 ,
217227 0 ,
218228 ] ,
@@ -288,29 +298,35 @@ export const roadBridgeCasing = {
288298
289299export const legendEntries = [
290300 {
291- description : "Controlled- access highway " ,
301+ description : "Freeway (controlled access, divided) " ,
292302 layers : [ road . id ] ,
293303 filter : [ "all" , isMotorway , isNotToll ] ,
294304 } ,
295305 {
296- description : "Limited- access highway " ,
306+ description : "Expressway (limited access, divided) " ,
297307 layers : [ road . id ] ,
298308 filter : [ "all" , isExpressway , isNotToll ] ,
299309 } ,
300310 {
301- description : "State highway" ,
311+ description : "Principal highway" ,
312+ layers : [ road . id ] ,
313+ filter : [ "all" , isTrunk , isNotToll , isNotExpressway ] ,
314+ } ,
315+ {
316+ description : "Arterial road" ,
302317 layers : [ road . id ] ,
303- filter : [ "all" , isState , isNotToll , isNotExpressway ] ,
318+ filter : [ "all" , isArterial , isNotToll , isNotExpressway ] ,
304319 } ,
305320 {
306321 description : "Local road" ,
307322 layers : [ road . id ] ,
308323 filter : [
309324 "all" ,
310325 isNotMotorway ,
311- isNotState ,
326+ isNotTrunk ,
312327 isNotToll ,
313328 isNotExpressway ,
329+ isNotArterial ,
314330 isNotRamp ,
315331 isNotService ,
316332 ] ,
0 commit comments