I want to make a map that represent the traffic for a city. So I have some traffic metrics that I want to visualize on the map. I wish to color each road different colours depending it's current traffic.
Something like that:
I tried to find a tutorial on how to apply style to only part of a roads, but I could not find how to do that.
Thank you very much it will help a lot thanks!!
You should go with a stylefunction for a vector layer:
https://openlayers.org/en/v4.6.5/apidoc/ol.html#.StyleFunction
A sample from OL3:
http://openlayersbook.github.io/ch11-creating-web-map-apps/example-02.html
Elaborating on the above example