Skip to content

Instantly share code, notes, and snippets.

@ericjames
Last active October 31, 2021 16:06
Show Gist options
  • Save ericjames/dae441359618fa04e81d7a9ff4d4fdc5 to your computer and use it in GitHub Desktop.
Save ericjames/dae441359618fa04e81d7a9ff4d4fdc5 to your computer and use it in GitHub Desktop.
Mapbox Filter Examples
// Toggling the 'feature-state' boolean via map.setFeatureState
'line-width': [
'case',
['boolean', ['feature-state', 'hover'], false],
10,
2
]
// Interpolation of color and width examples
'line-color': [
"interpolate", ["linear"], ['get', "YR_START1"],
0,
'#edf8e9',
1860,
'#edf8e9',
1870,
'#00ff00',
1880,
'#2244ff',
1890,
'#ff00ff',
1900,
'#000'
],
'line-width': [
"interpolate", ["linear"], ['get', "YR_START1"],
0,
1,
1860,
1,
1870,
2,
1880,
3,
1890,
4,
1900,
6
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment