How can we highlight(change color) roads, footpaths or cycle paths in mapbox gl js using toggle button?
0
votes
2 Answers
2
votes
You could use setPaintProperty to change a layer's fill color like it is done in this official Mapbox example (for a layer with "type": "fill"):
https://www.mapbox.com/mapbox-gl-js/example/color-switcher/
For a layer with "type": "line" this PaintProperty would be line-color:
https://www.mapbox.com/mapbox-gl-js/style-spec#paint-line-line-color