-
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
Draft
claysmalley
wants to merge
22
commits into
main
Choose a base branch
from
clay-bridge-areas
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add bridge rendering #934
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5d5d643
add bridge rendering
claysmalley e8c2a9e
Merge branch 'main' into clay-bridge-areas
ZeLonewolf dad7da7
change bridge color and add guardrail
claysmalley 13b51fc
change bridge outline to separate layer
claysmalley 8992147
Merge branch 'main' into clay-bridge-areas
ZeLonewolf 7a9fba2
Merge branch 'main' into clay-bridge-areas
claysmalley a27d6a3
Merge branch 'main' into clay-bridge-areas
claysmalley e1b258c
Merge branch 'main' into clay-bridge-areas
claysmalley 089bddb
Merge branch 'main' into clay-bridge-areas
claysmalley 55ec1c3
Merge branch 'main' into clay-bridge-areas
claysmalley 62dfc89
de-emphasize road casing on bridges at high zoom
claysmalley 0f36c5c
undo road casing opacity change
claysmalley 7091942
Merge branch 'main' into clay-bridge-areas
claysmalley 05049a3
Merge branch 'main' into clay-bridge-areas
ZeLonewolf aab8f3f
Merge branch 'main' into clay-bridge-areas
claysmalley ef34e68
Merge branch 'main' into clay-bridge-areas
claysmalley 80c9688
change bridge outline to knockout at high zoom
claysmalley 5ca7325
Merge branch 'main' into clay-bridge-areas
claysmalley 49fa8e8
Merge branch 'main' into clay-bridge-areas
claysmalley 483ad6f
factor out width expression
claysmalley e359c4f
Merge branch 'main' into clay-bridge-areas
ZeLonewolf 4d19fe8
Merge branch 'main' into clay-bridge-areas
claysmalley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
"use strict"; | ||
|
||
import * as Color from "../constants/color.js"; | ||
import * as Util from "../js/util.js"; | ||
|
||
const width = [ | ||
"match", | ||
["get", "class"], | ||
["rail", "transit"], | ||
["match", ["get", "service"], ["siding", "spur", "yard"], 12, 16], | ||
"motorway", | ||
["match", ["get", "ramp"], 1, 19, 29], | ||
"trunk", | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
35, | ||
["match", ["get", "ramp"], 1, 17, 29], | ||
], | ||
"primary", | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
33, | ||
["match", ["get", "ramp"], 1, 16, 26], | ||
], | ||
"secondary", | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
27, | ||
["match", ["get", "ramp"], 1, 15, 21], | ||
], | ||
["tertiary", "busway", "bus_guideway"], | ||
[ | ||
"match", | ||
["get", "expressway"], | ||
1, | ||
21, | ||
["match", ["get", "ramp"], 1, 14, 19], | ||
], | ||
"minor", | ||
15, | ||
"service", | ||
[ | ||
"match", | ||
["get", "service"], | ||
["alley", "driveway", "drive-through", "parking_aisle"], | ||
10, | ||
12, | ||
], | ||
0, | ||
]; | ||
|
||
// Bridge areas | ||
export const bridge = { | ||
type: "fill", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
id: "bridge", | ||
minzoom: 15, | ||
layout: { | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"fill-color": Color.bridgeFill, | ||
"fill-opacity": ["interpolate", ["linear"], ["zoom"], 16, 0.9, 19, 0.8], | ||
}, | ||
filter: ["all", ["==", ["get", "class"], "bridge"]], | ||
}; | ||
|
||
export const bridgeOutline = { | ||
...bridge, | ||
type: "line", | ||
id: "bridge-outline", | ||
layout: { | ||
"line-cap": "butt", | ||
"line-join": "bevel", | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"line-color": Color.bridgeBackgroundFill, | ||
"line-opacity": ["interpolate", ["linear"], ["zoom"], 16, 1, 19, 0.4], | ||
"line-width": 0.5, | ||
}, | ||
}; | ||
|
||
// 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", | ||
"line-join": "bevel", | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"line-color": Color.bridgeFill, | ||
"line-width": Util.zoomInterpolate(width), | ||
}, | ||
filter: [ | ||
"all", | ||
["==", ["get", "brunnel"], "bridge"], | ||
[ | ||
"in", | ||
["get", "class"], | ||
[ | ||
"literal", | ||
[ | ||
"motorway", | ||
"trunk", | ||
"primary", | ||
"secondary", | ||
"tertiary", | ||
"busway", | ||
"bus_guideway", | ||
"minor", | ||
"service", | ||
"rail", | ||
"transit", | ||
], | ||
], | ||
], | ||
], | ||
}; | ||
|
||
export const bridgeCasingBackground = { | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
id: "bridge_casing-background", | ||
minzoom: 13, | ||
layout: { | ||
"line-cap": "butt", | ||
"line-join": "bevel", | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"line-color": Color.bridgeBackgroundFill, | ||
"line-opacity": ["interpolate", ["linear"], ["zoom"], 16, 1, 19, 0.4], | ||
"line-width": Util.zoomInterpolate( | ||
Util.multiplyMatchExpression(width, 1.1) | ||
), | ||
}, | ||
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"], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 layer and the main road bridge layer need a line cap of
square
. Otherwise, the bridge area seems to extend beyond the roadway, obscuring a small segment of the roadway past either end of the 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.
I tried that and it looks weirder to me:
"line-cap": "butt",
"line-cap": "square",
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.
Hm, maybe just the normal bridge roadway layer then?