I have added a geojson to my map. One of the feature's properties is called delay - it contains numbers between 0 and 160. Below, I have tried to make line-width a function of the value in this property (using this link as an example), just as one would style color. In fact, I would like it to be a mathematical function ( sqrt(delay) as opposed to using categories), but in either case I receive a syntax error in the console every time unexpected ")", suggesting that one cannot style line-width in the same way as color. What would be the best workaround in Mapbox JS GL?
map.on('load', function () {
map.addSource("routes", {
"type": "geojson",
"data": "simplify_830.geojson"
});
map.addLayer({
"id": "routes",
"type": "line",
"source": "routes",
"layout": {},
"paint": {
"line-color": "#FFA500",
'line-width': {
property: 'delay',
stops: [
[0, 2],
[20, 4],
[40, 6],
[60, 8],
[80, 10],
[100, 12],
[120, 14],
[140, 16],
[160, 20]
]
},
"filter": ["==", "name", ""]
});