Multicolor polylines for a route in mapbox

末鹿安然 提交于 2021-02-09 10:49:28

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!