-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bridge rendering #934
base: main
Are you sure you want to change the base?
Add bridge rendering #934
Changes from 1 commit
5d5d643
e8c2a9e
dad7da7
13b51fc
8992147
7a9fba2
a27d6a3
e1b258c
089bddb
55ec1c3
62dfc89
0f36c5c
7091942
05049a3
aab8f3f
ef34e68
80c9688
5ca7325
49fa8e8
483ad6f
e359c4f
4d19fe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
"use strict"; | ||
|
||
import * as Color from "../constants/color.js"; | ||
import * as Util from "../js/util.js"; | ||
|
||
// Bridge areas | ||
export const bridge = { | ||
type: "fill-extrusion", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why a fill extrusion layer? Is it to avoid having to create a separate layer for each There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
id: "bridge", | ||
minzoom: 13, | ||
layout: { | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"fill-extrusion-color": Color.bridgeFill, | ||
"fill-extrusion-height": ["+", 3, ["coalesce", ["get", "layer"], 0]], | ||
"fill-extrusion-opacity": 0.6, | ||
}, | ||
filter: ["all", ["==", ["get", "class"], "bridge"]], | ||
}; | ||
|
||
// Bridge casing for highways and railways | ||
export const bridgeCasing = { | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
id: "bridge_casing", | ||
minzoom: 13, | ||
layout: { | ||
"line-cap": "butt", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This layer and the main road bridge layer need a line cap of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, maybe just the normal bridge roadway layer then? |
||
"line-join": "bevel", | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"line-color": Color.bridgeFill, | ||
"line-opacity": 0.8, | ||
"line-width": Util.zoomInterpolate([ | ||
"match", | ||
["get", "class"], | ||
["rail", "transit"], | ||
["match", ["get", "service"], ["siding", "spur", "yard"], 10, 14], | ||
"motorway", | ||
["match", ["get", "ramp"], 1, 18, 28], | ||
"trunk", | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
34, | ||
["match", ["get", "ramp"], 1, 16, 28], | ||
], | ||
"primary", | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
32, | ||
["match", ["get", "ramp"], 1, 15, 24], | ||
], | ||
"secondary", | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
26, | ||
["match", ["get", "ramp"], 1, 14, 20], | ||
], | ||
["tertiary", "busway", "bus_guideway"], | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
20, | ||
["match", ["get", "ramp"], 1, 13, 18], | ||
], | ||
"minor", | ||
14, | ||
"service", | ||
[ | ||
"match", | ||
["get", "service"], | ||
["alley", "driveway", "drive-through", "parking_aisle"], | ||
9, | ||
11, | ||
], | ||
20, | ||
]), | ||
}, | ||
filter: [ | ||
"all", | ||
["==", ["get", "brunnel"], "bridge"], | ||
[ | ||
"in", | ||
["get", "class"], | ||
[ | ||
"literal", | ||
[ | ||
"motorway", | ||
"trunk", | ||
"primary", | ||
"secondary", | ||
"tertiary", | ||
"busway", | ||
"bus_guideway", | ||
"minor", | ||
"service", | ||
"rail", | ||
"transit", | ||
], | ||
], | ||
], | ||
], | ||
}; | ||
|
||
export const legendEntries = [ | ||
{ | ||
description: "Bridge", | ||
layers: [bridge.id], | ||
filter: ["==", ["get", "class"], "bridge"], | ||
}, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rose-colored fill easily creates an association with the red fill color on freeways. Placing this color beneath every non-freeway bridge muddles the distinction between these road classifications.