-
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
Support for highway=track #717
base: main
Are you sure you want to change the base?
Changes from 10 commits
47174eb
cab046c
3cde280
4e98493
3d8a28b
d9222d7
dbc6700
c5895ae
abe2c7c
530ac4c
ab1e133
15a832e
77c1a22
5b3ba34
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,147 @@ | ||
"use strict"; | ||
|
||
import * as Color from "../constants/color.js"; | ||
|
||
const trackSelect = ["==", ["get", "class"], "track"]; | ||
const unpavedSelect = ["!=", ["get", "surface"], "paved"]; | ||
const pavedSelect = ["==", ["get", "surface"], "paved"]; | ||
const bridgeSelect = ["==", ["get", "brunnel"], "bridge"]; | ||
const fordSelect = ["==", ["get", "brunnel"], "ford"]; | ||
const notFordSelect = ["!=", ["get", "brunnel"], "ford"]; | ||
const opacity = ["interpolate", ["exponential", 1.2], ["zoom"], 12, 0, 13, 1]; | ||
const getBrunnel = ["get", "brunnel"]; | ||
|
||
export const track = { | ||
id: "highway-track", | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
filter: ["all", trackSelect, unpavedSelect], | ||
minzoom: 12, | ||
paint: { | ||
"line-color": ["match", getBrunnel, "ford", Color.waterLine, "#d4b791"], | ||
"line-opacity": opacity, | ||
"line-blur": 0.75, | ||
"line-width": 0.5, | ||
"line-dasharray": [12, 3], | ||
"line-offset": 0, | ||
"line-gap-width": [ | ||
"interpolate", | ||
["exponential", 1.2], | ||
["zoom"], | ||
13, | ||
0.7, | ||
20, | ||
6, | ||
], | ||
}, | ||
}; | ||
|
||
export const pavedTrack = { | ||
id: "highway-track-paved", | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
filter: ["all", trackSelect, pavedSelect], | ||
minzoom: 12, | ||
paint: { ...track.paint }, | ||
}; | ||
pavedTrack["paint"]["line-dasharray"] = [1, 0]; | ||
|
||
export const trackBridge = { | ||
id: "highway-track-bridge", | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
filter: ["all", trackSelect, unpavedSelect, bridgeSelect], | ||
minzoom: 12, | ||
paint: { ...track.paint }, | ||
}; | ||
|
||
export const pavedTrackBridge = { | ||
id: "highway-track-paved-bridge", | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
filter: ["all", trackSelect, pavedSelect, bridgeSelect], | ||
minzoom: 12, | ||
paint: { ...pavedTrack.paint }, | ||
}; | ||
|
||
// Bridge casing layers | ||
export const bridgeCasing = { | ||
id: "track-bridge-casing", | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
filter: ["all", bridgeSelect, trackSelect], | ||
minzoom: 13, | ||
layout: { | ||
"line-cap": "butt", | ||
"line-join": "bevel", | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"line-color": "black", | ||
"line-opacity": opacity, | ||
"line-width": [ | ||
"interpolate", | ||
["exponential", 1.2], | ||
["zoom"], | ||
13, | ||
1.1, | ||
20, | ||
11, | ||
], | ||
}, | ||
}; | ||
// Bridge casing layers | ||
export const bridgeFill = { | ||
id: "track-bridge-fill", | ||
type: "line", | ||
source: "openmaptiles", | ||
"source-layer": "transportation", | ||
filter: ["all", bridgeSelect, trackSelect], | ||
minzoom: 13, | ||
layout: { | ||
"line-cap": "butt", | ||
"line-join": "bevel", | ||
visibility: "visible", | ||
}, | ||
paint: { | ||
"line-color": Color.backgroundFill, | ||
"line-opacity": opacity, | ||
"line-width": [ | ||
"interpolate", | ||
["exponential", 1.2], | ||
["zoom"], | ||
13, | ||
1.0, | ||
20, | ||
10, | ||
], | ||
}, | ||
}; | ||
|
||
export const legendEntries = [ | ||
{ | ||
description: "Land access track", | ||
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 diplomatic wording is more appropriate in contexts like id-tagging-schema and the OSM Wiki, where it’s important for mappers to apply the right tag and not apply the wrong tag. But we have much more latitude in a legend, where the reader just has to get the gist of what distinguishes this entry from the ones above it. For comparison, the entry for expressways condenses an entire highly technical wiki article into just a few words. That’s what you’ve done here, but out of context, “land access” raises more questions than it answers. In my opinion, even a description as simple as “Unpaved track” or “Unpaved off-road track” would suffice. I don’t think the reader would be left with the impression that they’re looking at running tracks or railroad tracks (which has its own section). Many print maps say things like “Vehicle tracks” or “4×4 tracks”, but we aren’t distinguishing by mode of transportation here. 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. "track" isn't really a word we use for that here though. The closest American-ism is a "two-track road" in my vernacular. 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. “Track” or “tracks” is a word in American English. It’s more general than Part of the reason we’re in this quandary is that conventional transportation maps don’t even distinguish this notion of a This outdoors-oriented atlas exemplifies the kitchen-sink approach: * Other roads in urban areas are typically paved public streets. In rural areas they include local back roads, rough 4WD routes, private roads, and logging roads. Some of these roads are usable, but others are closed to public use, or seasonally impassable, or both. Inquire locally before attempting to drive “Other Roads.” 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. Thanks for the feedback. Shortened to |
||
layers: [track.id], | ||
filter: notFordSelect, | ||
}, | ||
{ | ||
description: "Land access track - ford", | ||
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. So far we’ve omitted brunnels from the legend because taking them out of context can be confusing. (A road bridge, for one thing, looks just like a normal road on its own.) We’d need to add some functionality to the legend to place another linear feature across the spotlighted feature. But I think the ford treatment you’ve implemented looks intuitive enough on its own. 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. For now I've left the ford-specific legend entries to avoid the case of ford-styling ending up in the legend when both unpaved ford and non-ford are present (such as at this location) as well as allow a concrete ford surrounded by unpaved tracks to get an entry noting that it is paved (such as at this location). Maybe this isn't ideal, but dropping any filters and sometimes showing blue for tracks felt particularly wrong. 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. I certainly agree with filtering out fords from the general track entries, but in the absence of the crossing lines capability I described above, it’s probably less confusing overall to omit any entries about the fords. The main issue is actually that the legend is depicting the track as a single dashed line, whereas it’s actually two parallel lines. I assume that’s because it doesn’t honor the If we keep the ford entries around, we might be able to combine them into one entry. There are other examples where we avoided breaking out combinations of attributes – for example, there’s only one expressway entry, even though multiple classes of roads that render differently can be expressways. This works because the entry clearly is about a particular aspect of the line, not trying to visually represent every possible expressway. 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. #770 tracks the incorrect implementation of |
||
layers: [track.id], | ||
filter: fordSelect, | ||
}, | ||
{ | ||
description: "Paved land access track", | ||
layers: [pavedTrack.id], | ||
filter: notFordSelect, | ||
}, | ||
{ | ||
description: "Paved land access track - ford", | ||
layers: [pavedTrack.id], | ||
filter: fordSelect, | ||
}, | ||
]; |
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.
Also add an entry for
ford=yes
, as well as a second entry forsurface
that describes the stylistic variation on tracks.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.
Thanks for the feedback. Added these taginfo entries in ab1e133.