Skip to content

Commit

Permalink
Add busways
Browse files Browse the repository at this point in the history
  • Loading branch information
claysmalley committed Jul 8, 2022
1 parent 50e2f6b commit 766ff4a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/americana.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ americanaLayers.push(
lyrRoad.secondaryTunnel.casing(),
lyrRoad.tertiaryExpresswayTunnel.casing(),
lyrRoad.tertiaryTunnel.casing(),
lyrRoad.buswayTunnel.casing(),
lyrRoad.minorTunnel.casing(),
lyrRoad.serviceTunnel.casing(),
lyrRoad.smallServiceTunnel.casing(),
Expand Down Expand Up @@ -124,6 +125,7 @@ americanaLayers.push(
lyrRoad.secondaryTunnel.fill(),
lyrRoad.tertiaryExpresswayTunnel.fill(),
lyrRoad.tertiaryTunnel.fill(),
lyrRoad.buswayTunnel.fill(),
lyrRoad.minorTunnel.fill(),
lyrRoad.serviceTunnel.fill(),
lyrRoad.smallServiceTunnel.fill(),
Expand Down Expand Up @@ -170,6 +172,7 @@ americanaLayers.push(
lyrRoad.secondary.casing(),
lyrRoad.tertiaryExpressway.casing(),
lyrRoad.tertiary.casing(),
lyrRoad.busway.casing(),
lyrRoad.minor.casing(),
lyrRoad.service.casing(),
lyrRoad.smallService.casing(),
Expand Down Expand Up @@ -201,6 +204,7 @@ americanaLayers.push(

lyrRoad.smallService.fill(),
lyrRoad.service.fill(),
lyrRoad.busway.fill(),
lyrRoad.minor.fill(),
lyrRoad.tertiary.fill(),
lyrRoad.tertiaryExpressway.fill(),
Expand Down Expand Up @@ -240,6 +244,7 @@ americanaLayers.push(

lyrRoad.smallService.surface(),
lyrRoad.service.surface(),
lyrRoad.busway.surface(),
lyrRoad.minor.surface(),
lyrRoad.tertiary.surface(),
lyrRoad.tertiaryExpressway.surface(),
Expand Down Expand Up @@ -283,6 +288,7 @@ var bridgeLayers = [
lyrRoad.smallServiceBridge.casing(),
lyrRoad.serviceBridge.casing(),
lyrRoad.minorBridge.casing(),
lyrRoad.buswayBridge.casing(),
lyrRoad.tertiaryBridge.casing(),
lyrRoad.tertiaryExpresswayBridge.casing(),
lyrRoad.secondaryBridge.casing(),
Expand Down Expand Up @@ -321,6 +327,7 @@ var bridgeLayers = [
lyrRoad.smallServiceBridge.fill(),
lyrRoad.serviceBridge.fill(),
lyrRoad.minorBridge.fill(),
lyrRoad.buswayBridge.fill(),
lyrRoad.tertiaryBridge.fill(),
lyrRoad.tertiaryExpresswayBridge.fill(),
lyrRoad.secondaryBridge.fill(),
Expand Down Expand Up @@ -404,6 +411,7 @@ americanaLayers.push(
lyrRoadLabel.primary,
lyrRoadLabel.secondary,
lyrRoadLabel.tertiary,
lyrRoadLabel.busway,
lyrRoadLabel.minor,
lyrRoadLabel.service,
lyrRoadLabel.smallService,
Expand Down
53 changes: 53 additions & 0 deletions src/layer/road.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,39 @@ class TertiaryExpresswayToll extends TertiaryToll {
}
}

class Busway extends Road {
constructor() {
super();
this.highwayClass = "busway";
this.brunnel = "surface";
this.link = false;
this.toll = false;
this.hue = 270;

this.minZoomFill = 11;
this.minZoomCasing = 11;

this.fillWidth = Util.zoomMultiply(trunkFillWidth, 0.5);
this.casingWidth = Util.zoomMultiply(trunkCasingWidth, 0.5);

this.fillColor = [
"interpolate",
["exponential", roadExp],
["zoom"],
this.minZoomFill,
`hsl(${this.hue}, 60%, 75%)`,
this.minZoomFill + 2,
`hsl(${this.hue}, 60%, 40%)`,
14.9999,
`hsl(${this.hue}, 30%, 40%)`,
15,
`hsl(${this.hue}, 30%, 75%)`,
];
this.casingColor = roadCasingColor(this.hue, this.minZoomCasing);
this.surfaceColor = `hsl(${this.hue}, 0%, 80%)`;
}
}

class Minor extends Road {
constructor() {
super();
Expand Down Expand Up @@ -1167,6 +1200,14 @@ class TertiaryExpresswayTollBridge extends TertiaryExpresswayToll {
}
}

class BuswayBridge extends Busway {
constructor() {
//undifferentiated
super();
this.brunnel = "bridge";
}
}

class MinorBridge extends Minor {
constructor() {
//undifferentiated
Expand Down Expand Up @@ -1457,6 +1498,15 @@ class TertiaryExpresswayTollTunnel extends TertiaryExpresswayToll {
}
}

class BuswayTunnel extends Busway {
constructor() {
super();
this.brunnel = "tunnel";
this.casingColor = `hsl(${this.hue}, 0%, 80%)`;
this.fillColor = `hsl(${this.hue}, 30%, 95%)`;
}
}

class MinorTunnel extends Minor {
constructor() {
super();
Expand Down Expand Up @@ -1620,6 +1670,7 @@ export const tertiary = new Tertiary();
export const tertiaryToll = new TertiaryToll();
export const tertiaryExpressway = new TertiaryExpressway();
export const tertiaryExpresswayToll = new TertiaryExpresswayToll();
export const busway = new Busway();
export const minor = new Minor();
export const minorToll = new MinorToll();
export const service = new Service();
Expand All @@ -1646,6 +1697,7 @@ export const tertiaryBridge = new TertiaryBridge();
export const tertiaryTollBridge = new TertiaryTollBridge();
export const tertiaryExpresswayBridge = new TertiaryExpresswayBridge();
export const tertiaryExpresswayTollBridge = new TertiaryExpresswayTollBridge();
export const buswayBridge = new BuswayBridge();
export const minorBridge = new MinorBridge();
export const minorTollBridge = new MinorTollBridge();
export const serviceBridge = new ServiceBridge();
Expand All @@ -1672,6 +1724,7 @@ export const tertiaryTunnel = new TertiaryTunnel();
export const tertiaryTollTunnel = new TertiaryTollTunnel();
export const tertiaryExpresswayTunnel = new TertiaryExpresswayTunnel();
export const tertiaryExpresswayTollTunnel = new TertiaryExpresswayTollTunnel();
export const buswayTunnel = new BuswayTunnel();
export const minorTunnel = new MinorTunnel();
export const minorTollTunnel = new MinorTollTunnel();
export const serviceTunnel = new ServiceTunnel();
Expand Down
11 changes: 11 additions & 0 deletions src/layer/road_label.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ export const tertiary = {
"source-layer": "transportation_name",
};

export const busway = {
id: "busway_label",
type: "symbol",
paint: textPaint,
filter: ["all", ["==", "class", "busway"]],
minzoom: 13,
layout: Object.assign(zoomDependentLayout(17), textLayout),
source: "openmaptiles",
"source-layer": "transportation_name",
};

export const minor = {
id: "minor_label",
type: "symbol",
Expand Down

0 comments on commit 766ff4a

Please sign in to comment.