openskidata-format 0.14.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElevationProfile.d.ts +10 -2
- package/dist/Lift.d.ts +36 -5
- package/dist/Lift.js +21 -0
- package/dist/Lift.js.map +1 -1
- package/dist/LiftNameFormatter.d.ts +1 -1
- package/dist/LiftNameFormatter.js +16 -21
- package/dist/LiftNameFormatter.js.map +1 -1
- package/dist/Run.d.ts +83 -12
- package/dist/Run.js +88 -57
- package/dist/Run.js.map +1 -1
- package/dist/SkiArea.d.ts +55 -24
- package/dist/SkiArea.js +6 -0
- package/dist/SkiArea.js.map +1 -1
- package/dist/Source.d.ts +2 -2
- package/dist/Status.d.ts +12 -0
- package/dist/Status.js +12 -0
- package/dist/Status.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/util/exhaustiveMatchingGuard.d.ts +1 -0
- package/dist/util/exhaustiveMatchingGuard.js +8 -0
- package/dist/util/exhaustiveMatchingGuard.js.map +1 -0
- package/package.json +1 -1
- package/src/ElevationProfile.ts +9 -5
- package/src/Lift.ts +56 -5
- package/src/LiftNameFormatter.ts +10 -17
- package/src/Run.ts +122 -53
- package/src/SkiArea.ts +60 -22
- package/src/Source.ts +1 -1
- package/src/Status.ts +12 -0
- package/src/index.ts +0 -1
- package/src/util/exhaustiveMatchingGuard.ts +3 -0
- package/dist/Activity.d.ts +0 -5
- package/dist/Activity.js +0 -10
- package/dist/Activity.js.map +0 -1
- package/src/Activity.ts +0 -5
package/src/SkiArea.ts
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import { Activity } from './Activity'
|
|
2
1
|
import { FeatureType } from './FeatureType'
|
|
3
2
|
import { LiftType } from './Lift'
|
|
4
3
|
import { Location } from './Location'
|
|
5
|
-
import {
|
|
6
|
-
import Source from './Source'
|
|
4
|
+
import { RunDifficulty, RunDifficultyConvention } from './Run'
|
|
5
|
+
import { Source } from './Source'
|
|
7
6
|
import { Status } from './Status'
|
|
8
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A ski area feature is derived from several sources:
|
|
10
|
+
* - OpenStreetMap site=piste relations
|
|
11
|
+
* - OpenStreetMap landuse=winter_sports areas that contains ski runs
|
|
12
|
+
* - Skimap.org ski areas
|
|
13
|
+
*
|
|
14
|
+
* The processor attempts to merge the data of all sources to create a single ski area feature.
|
|
15
|
+
*
|
|
16
|
+
* In some cases merging may fail and duplicate ski areas will be produced. This is likely due to ambiguous data.
|
|
17
|
+
* Check:
|
|
18
|
+
* - that a site=piste relation contains all the lifts/runs. If many lifts/runs are missing, merging will fail.
|
|
19
|
+
* - that if there are multiple landuse=winter_sports areas representing a single ski area. In this case a multipolygon relation should be used.
|
|
20
|
+
* - that if there are multiple Skimap.org ski areas representing a single ski area.
|
|
21
|
+
*
|
|
22
|
+
* General recommendation for ski area tagging in OpenStreetMap:
|
|
23
|
+
* - start with a landuse=winter_sports area as it's easy to set up and maintain.
|
|
24
|
+
* - if that's not explicit enough, add a site=piste relation as well.
|
|
25
|
+
*
|
|
26
|
+
* Note: if runs are present but there is no associated ski area source, a ski area feature is generated with no name and no source.
|
|
27
|
+
*/
|
|
9
28
|
export type SkiAreaFeature = GeoJSON.Feature<SkiAreaGeometry, SkiAreaProperties>
|
|
10
29
|
|
|
11
30
|
export type SkiAreaGeometry =
|
|
@@ -13,42 +32,69 @@ export type SkiAreaGeometry =
|
|
|
13
32
|
| GeoJSON.Polygon
|
|
14
33
|
| GeoJSON.MultiPolygon
|
|
15
34
|
|
|
16
|
-
export
|
|
35
|
+
export type SkiAreaSummaryFeature = GeoJSON.Feature<
|
|
36
|
+
SkiAreaGeometry,
|
|
37
|
+
SkiAreaSummaryProperties
|
|
38
|
+
>
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @property {string} id - Unique identifier for the ski area. The ID is just a hash of the feature, so will change if the feature changes in any way. If a stable identifier is needed, use the wikidata_id property, or a source id.
|
|
42
|
+
* @property {string | null} name - Name of the ski area.
|
|
43
|
+
* @property {Source[]} sources - Data sources.
|
|
44
|
+
* @property {SkiAreaActivity[]} activities - Activities available at this ski area, derived from presence of ski runs and Skimap.org data.
|
|
45
|
+
* @property {SkiAreaStatistics} statistics - Statistics generated from associated runs / lifts.
|
|
46
|
+
* @property {Status | null} status - Operational status. Derived from OpenStreetMap lifecycle tags and Skimap.org data.
|
|
47
|
+
* @property {RunColorConvention} runConvention - Color convention used for runs at this ski area.
|
|
48
|
+
* @property {string[]} websites - Official website(s) of the ski area. Derived from the OpenStreetMap website tag and Skimap.org data.
|
|
49
|
+
* @property {string | null} wikidata_id - Wikidata identifier. Derived from the OpenStreetMap wikidata tag.
|
|
50
|
+
* @property {Location | null} location - Reverse geocoded country / region information.
|
|
51
|
+
*/
|
|
52
|
+
export type SkiAreaProperties = SkiAreaSummaryProperties & {
|
|
53
|
+
sources: Source[]
|
|
54
|
+
statistics?: SkiAreaStatistics
|
|
55
|
+
runConvention: RunDifficultyConvention
|
|
56
|
+
websites: string[]
|
|
57
|
+
wikidata_id: string | null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type SkiAreaSummaryProperties = {
|
|
17
61
|
type: FeatureType.SkiArea
|
|
18
62
|
id: string
|
|
19
63
|
name: string | null
|
|
20
|
-
|
|
21
|
-
activities: Activity[]
|
|
22
|
-
generated: boolean
|
|
23
|
-
statistics?: SkiAreaStatistics
|
|
64
|
+
activities: SkiAreaActivity[]
|
|
24
65
|
status: Status | null
|
|
25
|
-
runConvention: RunConvention
|
|
26
|
-
websites: string[]
|
|
27
66
|
location: Location | null
|
|
28
67
|
}
|
|
29
68
|
|
|
30
|
-
export
|
|
69
|
+
export enum SkiAreaActivity {
|
|
70
|
+
Downhill = 'downhill',
|
|
71
|
+
Nordic = 'nordic',
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type SkiAreaStatistics = {
|
|
31
75
|
runs: RunStatistics
|
|
32
76
|
lifts: LiftStatistics
|
|
33
77
|
minElevation?: number
|
|
34
78
|
maxElevation?: number
|
|
35
79
|
}
|
|
36
80
|
|
|
37
|
-
export
|
|
81
|
+
export type RunStatistics = {
|
|
38
82
|
minElevation?: number
|
|
39
83
|
maxElevation?: number
|
|
40
84
|
byActivity: RunStatisticsByActivityAndDifficulty
|
|
41
85
|
}
|
|
42
86
|
|
|
43
87
|
export type RunStatisticsByActivityAndDifficulty = {
|
|
44
|
-
[key in
|
|
88
|
+
[key in SkiAreaActivity | 'other']?: {
|
|
89
|
+
byDifficulty: RunStatisticsByDifficulty
|
|
90
|
+
}
|
|
45
91
|
}
|
|
46
92
|
|
|
47
93
|
export type RunStatisticsByDifficulty = {
|
|
48
94
|
[key in RunDifficulty | 'other']?: { count: number; lengthInKm: number }
|
|
49
95
|
}
|
|
50
96
|
|
|
51
|
-
export
|
|
97
|
+
export type LiftStatistics = {
|
|
52
98
|
minElevation?: number
|
|
53
99
|
maxElevation?: number
|
|
54
100
|
byType: LiftStatisticsByType
|
|
@@ -59,11 +105,3 @@ export type LiftStatisticsByTypeKey = LiftType | 'other'
|
|
|
59
105
|
export type LiftStatisticsByType = {
|
|
60
106
|
[key in LiftStatisticsByTypeKey]?: { count: number; lengthInKm: number }
|
|
61
107
|
}
|
|
62
|
-
|
|
63
|
-
export interface MapObjectStatistics {
|
|
64
|
-
count: number
|
|
65
|
-
lengthInKm: number
|
|
66
|
-
minElevation?: number
|
|
67
|
-
maxElevation?: number
|
|
68
|
-
combinedElevationChange?: number
|
|
69
|
-
}
|
package/src/Source.ts
CHANGED
package/src/Status.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status of a feature.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is not real-time status but indicates whether a feature is in operation when conditions permit or is abandoned, etc.
|
|
5
|
+
*
|
|
6
|
+
* Primarily derived from OpenStreetMap tags.
|
|
7
|
+
* Additionally, Skimap.org data provides status information for ski area features only.
|
|
8
|
+
*
|
|
9
|
+
* Tagging schemes supported are:
|
|
10
|
+
* - lifecycle prefixes (preferred) https://wiki.openstreetmap.org/wiki/Lifecycle_prefix
|
|
11
|
+
* - separate lifecycle tags ("proposed=yes", etc)
|
|
12
|
+
*/
|
|
1
13
|
export enum Status {
|
|
2
14
|
Operating = 'operating',
|
|
3
15
|
Disused = 'disused',
|
package/src/index.ts
CHANGED
package/dist/Activity.d.ts
DELETED
package/dist/Activity.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Activity = void 0;
|
|
4
|
-
var Activity;
|
|
5
|
-
(function (Activity) {
|
|
6
|
-
Activity["Downhill"] = "downhill";
|
|
7
|
-
Activity["Nordic"] = "nordic";
|
|
8
|
-
Activity["Backcountry"] = "backcountry";
|
|
9
|
-
})(Activity || (exports.Activity = Activity = {}));
|
|
10
|
-
//# sourceMappingURL=Activity.js.map
|
package/dist/Activity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../src/Activity.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB"}
|