Skip to content

Commit

Permalink
Merge pull request #755 from ZeLonewolf/clay-aerialway
Browse files Browse the repository at this point in the history
add aerialways
  • Loading branch information
claysmalley authored Mar 7, 2023
2 parents 4351e98 + 81a41fc commit 45456a9
Show file tree
Hide file tree
Showing 6 changed files with 282 additions and 23 deletions.
56 changes: 56 additions & 0 deletions scripts/taginfo_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,62 @@
"doc_url": "https://openmaptiles.org/schema/#class",
"icon_url": "https://raw.githubusercontent.com/ZeLonewolf/openstreetmap-americana/main/icons/poi_military_plane.svg"
},
{
"key": "aerialway",
"value": "cable_car",
"object_types": ["way"],
"description": "Cable cars are represented by a solid magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aerialway",
"value": "chair_lift",
"object_types": ["way"],
"description": "Chairlifts are represented by a solid magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aerialway",
"value": "gondola",
"object_types": ["way"],
"description": "Aerial gondolas are represented by a solid magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aerialway",
"value": "mixed_lift",
"object_types": ["way"],
"description": "Mixed aerial lifts are represented by a solid magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aerialway",
"value": "drag_lift",
"object_types": ["way"],
"description": "Drag lifts are represented by a dashed magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aerialway",
"value": "platter",
"object_types": ["way"],
"description": "Platter lifts are represented by a dashed magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aerialway",
"value": "j-bar",
"object_types": ["way"],
"description": "J-bar lifts are represented by a dashed magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aerialway",
"value": "t-bar",
"object_types": ["way"],
"description": "T-bar lifts are represented by a dashed magenta line that splits in two at high zoom.",
"doc_url": "https://openmaptiles.org/schema/#aerialway"
},
{
"key": "aeroway",
"value": "runway",
Expand Down
3 changes: 3 additions & 0 deletions src/constants/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const parkOutline = "hsla(136, 41%, 70%, 50%)";
export const parkLabel = "hsl(136, 71%, 29%)";
export const parkLabelHalo = "hsl(90, 27%, 94%)";

export const aerialwayLine = "hsl(310, 41%, 59%)";
export const aerialwayLabel = "hsl(310, 71%, 29%)";

export const airportFill = "hsl(250, 41%, 95%)";
export const airportOutline = "hsl(250, 41%, 79%)";
export const airportRunway = "hsl(250, 41%, 79%)";
Expand Down
5 changes: 5 additions & 0 deletions src/js/legend_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as ParkLayers from "../layer/park.js";
import * as BuildingLayers from "../layer/building.js";
import * as WaterLayers from "../layer/water.js";
import * as FerryLayers from "../layer/ferry.js";
import * as AerialwayLayers from "../layer/aerialway.js";

export const sections = [
{
Expand Down Expand Up @@ -40,6 +41,10 @@ export const sections = [
name: "Railroads",
entries: RailLayers.legendEntries,
},
{
name: "Aerial lifts",
entries: AerialwayLayers.legendEntries,
},
{
name: "Aviation",
entries: AerowayLayers.legendEntries,
Expand Down
144 changes: 144 additions & 0 deletions src/layer/aerialway.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
"use strict";

import * as Color from "../constants/color.js";

// Exponent base for inter-zoom interpolation
let aerialwayExp = 1.2;

let lineWidth = [
"interpolate",
["exponential", aerialwayExp],
["zoom"],
12,
1.2,
14.9999,
2.4,
15,
1.2,
16,
1.2,
20,
2.4,
];
let lineGapWidth = [
"interpolate",
["exponential", aerialwayExp],
["zoom"],
12,
0,
15,
0,
16,
1,
20,
16,
];

let casingLineWidth = [
"interpolate",
["exponential", aerialwayExp],
["zoom"],
12,
2,
15.9999,
4,
16,
2,
20,
4,
];
let casingLineGapWidth = [
"interpolate",
["exponential", aerialwayExp],
["zoom"],
12,
0,
16,
0,
20,
14.4,
];

export const lift = {
id: "lift",
type: "line",
paint: {
"line-color": Color.aerialwayLine,
"line-width": lineWidth,
"line-gap-width": lineGapWidth,
},
filter: [
"all",
["==", ["get", "class"], "aerialway"],
[
"in",
["get", "subclass"],
["literal", ["chair_lift", "cable_car", "gondola", "mixed_lift"]],
],
],
layout: {
visibility: "visible",
},
source: "openmaptiles",
"source-layer": "transportation",
};

export const liftCasing = {
id: "lift_casing",
type: "line",
paint: {
"line-color": Color.backgroundFill,
"line-width": casingLineWidth,
"line-gap-width": casingLineGapWidth,
},
filter: [
"all",
["==", ["get", "class"], "aerialway"],
[
"in",
["get", "subclass"],
["literal", ["chair_lift", "cable_car", "gondola", "mixed_lift"]],
],
],
layout: {
visibility: "visible",
},
source: "openmaptiles",
"source-layer": "transportation",
};

export const dragLift = {
id: "drag_lift",
type: "line",
paint: {
"line-color": Color.aerialwayLine,
"line-width": lineWidth,
"line-gap-width": lineGapWidth,
"line-dasharray": [5, 1],
},
filter: [
"all",
["==", ["get", "class"], "aerialway"],
[
"in",
["get", "subclass"],
["literal", ["drag_lift", "platter", "j-bar", "t-bar"]],
],
],
layout: {
visibility: "visible",
},
source: "openmaptiles",
"source-layer": "transportation",
};

export const legendEntries = [
{
description: "Aerial tramway or chairlift",
layers: [lift.id],
},
{
description: "Drag lift",
layers: [dragLift.id],
},
];
8 changes: 7 additions & 1 deletion src/layer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import * as Label from "../constants/label.js";

import * as lyrAerialway from "./aerialway.js";
import * as lyrAeroway from "./aeroway.js";
import * as lyrBackground from "./background.js";
import * as lyrBoundary from "./boundary.js";
Expand Down Expand Up @@ -135,7 +136,9 @@ export function build(locales) {
lyrRail.railway.fill(),

lyrOneway.road,
lyrOneway.link
lyrOneway.link,

lyrAerialway.dragLift
);

layers.push(lyrBuilding.building);
Expand Down Expand Up @@ -199,6 +202,9 @@ export function build(locales) {

layers.push(
//The labels at the end of the list draw on top of the layers at the beginning.
lyrAerialway.liftCasing,
lyrAerialway.lift,

lyrBoundary.countryLabelLeft,
lyrBoundary.countryLabelRight,
lyrWater.waterwayLabel,
Expand Down
Loading

0 comments on commit 45456a9

Please sign in to comment.