Skip to content

Commit 079e7e2

Browse files
committed
Update Buildings.html
Improve expression for better performance and clarity.
1 parent 34c2e69 commit 079e7e2

1 file changed

Lines changed: 20 additions & 28 deletions

File tree

Samples/PMTiles/Overture Building Theme/Buildings.html

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -150,34 +150,26 @@
150150
height: ["get", "height"],
151151
fillOpacity: 0.5,
152152
fillColor: [
153-
"case",
154-
['==', ['get', 'subtype'], 'agricultural'],
155-
"wheat",
156-
['==', ['get', 'subtype'], 'civic'],
157-
"teal",
158-
['==', ['get', 'subtype'], 'commercial'],
159-
"blue",
160-
['==', ['get', 'subtype'], 'education'],
161-
"aqua",
162-
['==', ['get', 'subtype'], 'entertainment'],
163-
"pink",
164-
['==', ['get', 'subtype'], 'industrial'],
165-
"yellow",
166-
['==', ['get', 'subtype'], 'medical'],
167-
"red",
168-
['==', ['get', 'subtype'], 'military'],
169-
"darkgreen",
170-
['==', ['get', 'subtype'], 'outbuilding'],
171-
"white",
172-
['==', ['get', 'subtype'], 'religious'],
173-
"khaki",
174-
['==', ['get', 'subtype'], 'residential'],
175-
"green",
176-
['==', ['get', 'subtype'], 'service'],
177-
"gold",
178-
['==', ['get', 'subtype'], 'transportation'],
179-
"orange",
180-
"grey",
153+
"match",
154+
155+
["get", "subtype"],
156+
157+
"agricultural", "wheat",
158+
"civic", "teal",
159+
"commercial", "blue",
160+
"education", "aqua",
161+
"entertainment", "pink",
162+
"industrial", "yellow",
163+
"medical", "red",
164+
"military", "darkgreen",
165+
"outbuilding", "white",
166+
"religious", "khaki",
167+
"residential", "green",
168+
"service", "gold",
169+
"transportation", "orange",
170+
171+
//Default color.
172+
"grey"
181173
],
182174
filter: ['any', ['==', ['geometry-type'], 'Polygon'], ['==', ['geometry-type'], 'MultiPolygon']]
183175
}

0 commit comments

Comments
 (0)