问题
i record routes with my app, mostly for motorbikes, and want to color it depending on the speed at each point of the route.
basically i know how to do it in mapbox and that is the problem. since you can set a color for only one polyline, i have to split up the route in speed sections and print every route sections polyline with it's specific color, which works fine basically. problem is that i have up to 500-2000 polylines for a route. so the map crashes very easily.
i don't have that problem when i set like 5000 image annotations to the map, which i can color individually. this could be a solution but it can take up to 20 seconds to print all image annotations. any other options to make a colored route like the on in the image ?
回答1:
This is not possible with out of the box mapbox polylines.
You will have to add a new layer, perform the translations and add the gradient lines yourself. This might get you started drawing the lines: https://stackoverflow.com/a/25034854/4019540
Good luck
来源:https://stackoverflow.com/questions/37806425/multicolor-polylines-for-a-route-in-mapbox