Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"merge2": "^1",
"ngeohash": "^0.6.3",
"object-hash": "^3",
"openskidata-format": "^10.0.0",
"openskidata-format": "^11.0.0",
"osmtogeojson": "3.0.0-beta.5",
"parallel-transform": "^1",
"pg": "^8.12.0",
Expand Down
4 changes: 4 additions & 0 deletions src/PrepareGeoJSON.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ Map {
],
"stations": [],
"status": "operating",
"tunnel": null,
"type": "lift",
"websites": [],
"wikidataID": null,
Expand Down Expand Up @@ -252,6 +253,7 @@ Map {
],
"stationIds": [],
"status": "operating",
"tunnel": null,
},
"type": "Feature",
},
Expand Down Expand Up @@ -301,6 +303,7 @@ Map {
],
"snowfarming": null,
"snowmaking": null,
"tunnel": null,
},
"type": "Feature",
},
Expand Down Expand Up @@ -406,6 +409,7 @@ Map {
},
],
"status": "operating",
"tunnel": null,
"type": "run",
"uses": [
"downhill",
Expand Down
2 changes: 2 additions & 0 deletions src/PrepareGeoJSONWithElevation.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ it("adds elevations to lift geometry", async () => {
],
"stations": [],
"status": "operating",
"tunnel": null,
"type": "lift",
"websites": [],
"wikidataID": null,
Expand Down Expand Up @@ -306,6 +307,7 @@ it("completes without adding elevations when elevation server fails", async () =
],
"stations": [],
"status": "operating",
"tunnel": null,
"type": "lift",
"websites": [],
"wikidataID": null,
Expand Down
2 changes: 2 additions & 0 deletions src/TestHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export function mockRunFeature<G extends InputRunGeometry>(options: {
patrolled: options.patrolled !== undefined ? options.patrolled : null,
snowmaking: null,
snowfarming: null,
tunnel: null,
grooming: options.grooming || null,
skiAreas: options.skiAreas || [],
elevationProfile: null,
Expand Down Expand Up @@ -256,6 +257,7 @@ export function mockLiftFeature<G extends LiftGeometry>(options: {
bubble: null,
heating: null,
detachable: null,
tunnel: null,
access: null,
stations: [],
skiAreas: options.skiAreas || [],
Expand Down
2 changes: 2 additions & 0 deletions src/features/LiftFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type OSMLiftTags = {
"aerialway:summer:access"?: string;

website?: string;
tunnel?: string;
};

export type MapboxGLLiftProperties = {
Expand All @@ -50,6 +51,7 @@ export type MapboxGLLiftProperties = {
access: Access | null;
stationIds: string[];
skiAreas: string[];
tunnel: boolean | null;
};

export type InputLiftGeometry =
Expand Down
2 changes: 2 additions & 0 deletions src/features/RunFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type OSMRunTags = {
"piste:oneway"?: string;

website?: string;
tunnel?: string;
};

export type InputRunGeometry =
Expand Down Expand Up @@ -65,6 +66,7 @@ export type MapboxGLRunProperties = {
grooming: RunGrooming | null;
snowmaking: boolean | null;
snowfarming: boolean | null;
tunnel: boolean | null;
// Run uses. Multiple uses are supported by rendering parallel lines for each use.
// The value is the offset of the line from the baseline. The average of all offsets is always 0.
downhill?: number;
Expand Down
10 changes: 10 additions & 0 deletions src/io/GeoPackageWriter.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ describe("GeoPackageWriter", () => {
detachable: null,
bubble: null,
heating: null,
tunnel: null,
access: null,
stations: [],
skiAreas: [],
Expand Down Expand Up @@ -121,6 +122,7 @@ describe("GeoPackageWriter", () => {
patrolled: null,
snowmaking: null,
snowfarming: null,
tunnel: null,
grooming: null,
skiAreas: [],
elevationProfile: null,
Expand Down Expand Up @@ -298,6 +300,7 @@ describe("GeoPackageWriter", () => {
patrolled: null,
snowmaking: null,
snowfarming: null,
tunnel: null,
grooming: null,
skiAreas: [],
elevationProfile: null,
Expand Down Expand Up @@ -351,6 +354,7 @@ describe("GeoPackageWriter", () => {
detachable: null,
bubble: null,
heating: null,
tunnel: null,
access: null,
stations: [],
skiAreas: [],
Expand Down Expand Up @@ -385,6 +389,7 @@ describe("GeoPackageWriter", () => {
detachable: null,
bubble: null,
heating: null,
tunnel: null,
access: null,
stations: [],
skiAreas: [],
Expand Down Expand Up @@ -435,6 +440,7 @@ describe("GeoPackageWriter", () => {
detachable: null,
bubble: null,
heating: null,
tunnel: null,
access: null,
stations: [],
skiAreas: [],
Expand Down Expand Up @@ -575,6 +581,7 @@ describe("GeoPackageWriter", () => {
detachable: null,
bubble: null,
heating: null,
tunnel: null,
access: null,
stations: [],
skiAreas: [
Expand Down Expand Up @@ -632,6 +639,7 @@ describe("GeoPackageWriter", () => {
detachable: null,
bubble: null,
heating: null,
tunnel: null,
access: null,
stations: [],
skiAreas: [
Expand Down Expand Up @@ -713,6 +721,7 @@ describe("GeoPackageWriter", () => {
patrolled: null,
snowmaking: null,
snowfarming: null,
tunnel: null,
grooming: null,
skiAreas: [
{
Expand Down Expand Up @@ -810,6 +819,7 @@ describe("GeoPackageWriter", () => {
detachable: null,
bubble: null,
heating: null,
tunnel: null,
access: null,
stations: [],
skiAreas: [],
Expand Down
2 changes: 2 additions & 0 deletions src/transforms/CSVFormatter.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ describe("CSVFormatter", () => {
patrolled: true,
snowmaking: null,
snowfarming: null,
tunnel: null,
grooming: null,
description: null,
skiAreas: [
Expand Down Expand Up @@ -196,6 +197,7 @@ describe("CSVFormatter", () => {
duration: 600,
oneway: null,
detachable: true,
tunnel: null,
description: null,
access: null,
stations: [],
Expand Down
1 change: 1 addition & 0 deletions src/transforms/LiftFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export function formatLift(feature: InputLiftFeature): LiftFeature | null {
bubble: mapOSMBoolean(tags["aerialway:bubble"]),
heating: mapOSMBoolean(tags["aerialway:heating"]),
detachable: mapOSMBoolean(tags["aerialway:detachable"]),
tunnel: tags["tunnel"] !== undefined ? true : null,
access: tags["access"] === "private" ? "private" : null,
stations: [],
skiAreas: [],
Expand Down
2 changes: 2 additions & 0 deletions src/transforms/MapboxGLFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export function formatter(
grooming: properties.grooming,
snowmaking: properties.snowmaking,
snowfarming: properties.snowfarming,
tunnel: properties.tunnel,
skiAreas: properties.skiAreas.map((skiArea) => skiArea.properties.id),
};

Expand Down Expand Up @@ -139,6 +140,7 @@ export function formatter(
access: properties.access,
stationIds: properties.stations.map((station) => station.properties.id),
skiAreas: properties.skiAreas.map((skiArea) => skiArea.properties.id),
tunnel: properties.tunnel,
};

return {
Expand Down
1 change: 1 addition & 0 deletions src/transforms/RunFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function formatRun(feature: InputRunFeature): RunFeature[] {
patrolled: mapOSMBoolean(getOrElse(tags, "piste:patrolled", "patrolled")),
snowmaking: mapOSMBoolean(tags["piste:snowmaking"]),
snowfarming: mapOSMBoolean(tags["piste:snowfarming"]),
tunnel: tags["tunnel"] !== undefined ? true : null,
lit: mapOSMBoolean(getOrElse(tags, "piste:lit", "lit")),
grooming: getGrooming(tags),
skiAreas: [],
Expand Down
1 change: 1 addition & 0 deletions src/transforms/RunFormatter.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe("RunFormatter", () => {
},
],
"status": "operating",
"tunnel": null,
"type": "run",
"uses": [
"downhill",
Expand Down
3 changes: 3 additions & 0 deletions src/transforms/normalization/RunJoining.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function mergedProperties(
.map((p) => p.snowfarming)
.reduce(snowfarmingReducer),
grooming: allProperties.map((p) => p.grooming).reduce(groomingReducer),
tunnel: allProperties.map((p) => p.tunnel).reduce(tunnelReducer),
skiAreas: uniquedByID(allProperties.flatMap((p) => p.skiAreas)),
elevationProfile: allProperties[0].elevationProfile,
sources: uniquedSources(
Expand Down Expand Up @@ -201,6 +202,8 @@ const snowmakingReducer = priorityReducer([true, false, null]);

const snowfarmingReducer = priorityReducer([true, false, null]);

const tunnelReducer = priorityReducer([true, false, null]);

const litReducer = priorityReducer([true, false, null]);

function uniquedByID<Feature extends { properties: { id: string } }>(
Expand Down