Skip to content

Commit ab87168

Browse files
committed
Fix streetview highlighting for new basemap
1 parent e3d82ea commit ab87168

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

web/src/common/highlight_roads.ts

+8-24
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,15 @@ export function getRoadLayerNames(map: Map, mapStyle: string): string[] {
1616
if (mapStyle == "hybrid") {
1717
return ["Path", "Road", "Tunnel"].filter((l) => availableLayers.has(l));
1818
}
19-
// TODO Check if this is true in the new version
2019
if (mapStyle == "streets-v2") {
21-
let layers = [];
22-
for (let outer of ["road", "bridge", "tunnel"]) {
23-
for (let inner of [
24-
"link",
25-
"minor",
26-
"minor_construction",
27-
"motorway",
28-
"motorway_construction",
29-
"motorway_link",
30-
"path_pedestrian",
31-
"secondary_tertiary",
32-
"secondary_tertiary_construction",
33-
"service_track",
34-
"service_track_construction",
35-
"street",
36-
"trunk_primary",
37-
"trunk_primary_construction",
38-
"trunk_primary_link",
39-
]) {
40-
layers.push(`${outer}_${inner}`);
41-
}
42-
}
43-
return layers.filter((l) => availableLayers.has(l));
20+
return map
21+
.getStyle()
22+
.layers.filter(
23+
(layer) =>
24+
// @ts-expect-error source-layer is present
25+
layer["source-layer"] == "transportation" && layer.type == "line",
26+
)
27+
.map((layer) => layer.id);
4428
}
4529
if (mapStyle == "uk-openzoomstack-light") {
4630
return map

0 commit comments

Comments
 (0)