胡子哥哥
在没有看到您的风格或 tilesets 的结构的情况下,很难给出具体的建议。但是,根据您对设置的描述,我相信您可以通过使用静态图像 API 的查询字符串参数动态生成路线样式层来实现“重新着色路线”的目标addlayer。addlayer之所以强大,主要是因为它允许您在请求时充分利用样式表达式来设置地图数据的样式。(注意:此建议假设您的路线具有一些显着特征。)mapbox/streets-v11作为概念的快速证明,这里是采用样式并添加新样式层的静态图像请求。该层使用match表达式根据道路的“类别”为道路着色:https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/-122,36.99,11/300x300?before_layer=road-number-shield&addlayer={%22id%22:%22road-overlay%22,%22type%22:%22line%22,%22source%22:%22composite%22,%22source-layer%22:%22road%22,%22paint%22:{%22line-color%22:%20[%22match%22,%20[%22get%22,%20%22class%22],%20%22motorway%22,%20%22%23ff0000%22,%20%22primary%22,%20%22%23FFFF00%22,%20%22secondary%22,%20%22%23FF00FF%22,%20%22street%22,%20%22%2300FFFF%22,%20%22%23FFFFFF%22],%22line-width%22:2}}&access_token=your.tk产生以下结果: