openskidata-format 14.0.0 → 16.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.
Files changed (94) hide show
  1. package/dist/ElevationProfile.d.ts +1 -0
  2. package/dist/ElevationProfile.d.ts.map +1 -0
  3. package/dist/ElevationProfile.js +15 -24
  4. package/dist/ElevationProfile.js.map +1 -1
  5. package/dist/FeatureType.d.ts +1 -0
  6. package/dist/FeatureType.d.ts.map +1 -0
  7. package/dist/FeatureType.js +2 -5
  8. package/dist/FeatureType.js.map +1 -1
  9. package/dist/Lift.d.ts +10 -8
  10. package/dist/Lift.d.ts.map +1 -0
  11. package/dist/Lift.js +22 -29
  12. package/dist/Lift.js.map +1 -1
  13. package/dist/LiftNameFormatter.d.ts +2 -1
  14. package/dist/LiftNameFormatter.d.ts.map +1 -0
  15. package/dist/LiftNameFormatter.js +11 -14
  16. package/dist/LiftNameFormatter.js.map +1 -1
  17. package/dist/Place.d.ts +1 -0
  18. package/dist/Place.d.ts.map +1 -0
  19. package/dist/Place.js +1 -2
  20. package/dist/Run.d.ts +10 -9
  21. package/dist/Run.d.ts.map +1 -0
  22. package/dist/Run.js +23 -30
  23. package/dist/Run.js.map +1 -1
  24. package/dist/RunDifficultyConvention.d.ts +2 -1
  25. package/dist/RunDifficultyConvention.d.ts.map +1 -0
  26. package/dist/RunDifficultyConvention.js +10 -15
  27. package/dist/RunDifficultyConvention.js.map +1 -1
  28. package/dist/SkiArea.d.ts +11 -12
  29. package/dist/SkiArea.d.ts.map +1 -0
  30. package/dist/SkiArea.js +2 -5
  31. package/dist/SkiArea.js.map +1 -1
  32. package/dist/SlopeGradingScale.d.ts +3 -2
  33. package/dist/SlopeGradingScale.d.ts.map +1 -0
  34. package/dist/SlopeGradingScale.js +21 -26
  35. package/dist/SlopeGradingScale.js.map +1 -1
  36. package/dist/SnowCoverHistory.d.ts +1 -0
  37. package/dist/SnowCoverHistory.d.ts.map +1 -0
  38. package/dist/SnowCoverHistory.js +9 -8
  39. package/dist/SnowCoverHistory.js.map +1 -1
  40. package/dist/Source.d.ts +2 -14
  41. package/dist/Source.d.ts.map +1 -0
  42. package/dist/Source.js +7 -43
  43. package/dist/Source.js.map +1 -1
  44. package/dist/Spot.d.ts +6 -5
  45. package/dist/Spot.d.ts.map +1 -0
  46. package/dist/Spot.js +6 -9
  47. package/dist/Spot.js.map +1 -1
  48. package/dist/Status.d.ts +1 -0
  49. package/dist/Status.d.ts.map +1 -0
  50. package/dist/Status.js +2 -5
  51. package/dist/Status.js.map +1 -1
  52. package/dist/ViewportHint.d.ts +1 -0
  53. package/dist/ViewportHint.d.ts.map +1 -0
  54. package/dist/ViewportHint.js +4 -10
  55. package/dist/ViewportHint.js.map +1 -1
  56. package/dist/index.d.ts +15 -15
  57. package/dist/index.d.ts.map +1 -0
  58. package/dist/index.js +14 -18
  59. package/dist/index.js.map +1 -1
  60. package/dist/util/exhaustiveMatchingGuard.d.ts +1 -0
  61. package/dist/util/exhaustiveMatchingGuard.d.ts.map +1 -0
  62. package/dist/util/exhaustiveMatchingGuard.js +1 -5
  63. package/dist/util/exhaustiveMatchingGuard.js.map +1 -1
  64. package/package.json +35 -23
  65. package/dist/SkiPass.d.ts +0 -82
  66. package/dist/SkiPass.js +0 -3
  67. package/dist/SkiPass.js.map +0 -1
  68. package/dist/testUtils.d.ts +0 -2
  69. package/dist/testUtils.js +0 -7
  70. package/dist/testUtils.js.map +0 -1
  71. package/src/ElevationProfile.test.ts +0 -738
  72. package/src/ElevationProfile.ts +0 -452
  73. package/src/FeatureType.ts +0 -6
  74. package/src/Lift.test.ts +0 -195
  75. package/src/Lift.ts +0 -219
  76. package/src/LiftNameFormatter.ts +0 -116
  77. package/src/Place.ts +0 -11
  78. package/src/Run.ts +0 -242
  79. package/src/RunDifficultyConvention.test.ts +0 -79
  80. package/src/RunDifficultyConvention.ts +0 -335
  81. package/src/SkiArea.ts +0 -128
  82. package/src/SkiPass.ts +0 -89
  83. package/src/SlopeGradingScale.test.ts +0 -151
  84. package/src/SlopeGradingScale.ts +0 -96
  85. package/src/SnowCoverHistory.test.ts +0 -103
  86. package/src/SnowCoverHistory.ts +0 -107
  87. package/src/Source.test.ts +0 -50
  88. package/src/Source.ts +0 -72
  89. package/src/Spot.ts +0 -140
  90. package/src/Status.ts +0 -20
  91. package/src/ViewportHint.ts +0 -208
  92. package/src/index.ts +0 -15
  93. package/src/testUtils.ts +0 -5
  94. package/src/util/exhaustiveMatchingGuard.ts +0 -3
@@ -1,335 +0,0 @@
1
- import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
2
- import turfCenter from "@turf/center";
3
- import * as turf from "@turf/helpers";
4
- import { AllGeoJSON } from "@turf/helpers";
5
-
6
- /**
7
- * Run difficulty colors vary by region. This enum defines the color convention used for runs at a ski area.
8
- * @enum {string}
9
- */
10
- export enum RunDifficultyConvention {
11
- /**
12
- * European color convention:
13
- * - Green: Novice
14
- * - Blue: Easy
15
- * - Red: Intermediate
16
- * - Black: Advanced/Expert
17
- * - Orange: Freeride/Extreme
18
- */
19
- EUROPE = 'europe',
20
-
21
- /**
22
- * Japanese color convention:
23
- * - Green: Novice/Easy
24
- * - Red: Intermediate
25
- * - Black: Advanced/Expert
26
- * - Orange: Freeride/Extreme
27
- */
28
- JAPAN = 'japan',
29
-
30
- /**
31
- * North American color convention:
32
- * - Green: Novice/Easy
33
- * - Blue: Intermediate
34
- * - Black: Advanced/Expert
35
- * - Orange: Freeride/Extreme
36
- */
37
- NORTH_AMERICA = 'north_america',
38
- }
39
-
40
- const northAmericanConventionGeometry = turf.multiPolygon([
41
- [
42
- [
43
- [66.89889168301036, 22.98946421817959],
44
- [76.79011657384558, 4.2607118936878265],
45
- [112.5459757578734, -40.008871147786486],
46
- [166.64372809287335, -58.19200446079054],
47
- [191.91699393212554, -33.377687858720755],
48
- [192.65370948033006, -8.971607939355977],
49
- [140.68354997294796, 5.451024881476499],
50
- [123.38582294700518, 21.801329456101513],
51
- [122.25942048875993, 24.243081370534554],
52
- [123.02414890399393, 26.354744126525432],
53
- [129.68307711216244, 35.3374262814546],
54
- [131.36509887116028, 39.1827837685222],
55
- [130.5715844381864, 42.515964349309684],
56
- [130.62108313985783, 42.63370843853855],
57
- [130.39263902117034, 42.73714858581644],
58
- [130.8150956808529, 42.87954610777132],
59
- [131.04334909066392, 42.88226217082041],
60
- [131.33954328617205, 43.445079879213296],
61
- [131.191137752773, 43.53879786242706],
62
- [131.2860140618261, 44.06115319070142],
63
- [131.1086866768622, 44.71097030226514],
64
- [130.95332209785204, 44.84377389211244],
65
- [131.56223386930952, 45.01998391706314],
66
- [131.87876159757576, 45.342467064732745],
67
- [131.9445424786545, 45.26381674117374],
68
- [132.89886314033083, 45.04768363738535],
69
- [132.9409663928247, 45.020634782943716],
70
- [133.12560828825156, 45.14828761444474],
71
- [133.11406817721956, 45.23774574998686],
72
- [133.1686920707706, 45.49559658174417],
73
- [133.4044528436404, 45.59600211321589],
74
- [133.49367119277423, 45.87840483196845],
75
- [133.57649823904808, 45.88061866181769],
76
- [133.7230811284722, 46.06662995573109],
77
- [133.68166349871666, 46.137321119014274],
78
- [133.9014556853037, 46.24315756590036],
79
- [134.29060710292293, 47.44981009549741],
80
- [134.53603145724082, 47.47580868032259],
81
- [134.80050117570937, 47.73143995381383],
82
- [134.54808493637842, 48.00270638588145],
83
- [134.7902354911858, 48.38077517538687],
84
- [134.53852703049813, 48.414602674179406],
85
- [134.05426284432252, 48.33207866806839],
86
- [133.44255382292891, 48.11130941788082],
87
- [133.06661598961256, 48.102793716410616],
88
- [132.65561957214425, 47.92377254119751],
89
- [132.57597035647728, 47.73126763647102],
90
- [131.5872859174675, 47.669086096155525],
91
- [130.978760673039, 47.70552624852317],
92
- [130.8927298265839, 47.92147467660291],
93
- [130.69208001471225, 48.07898424194457],
94
- [130.8424973965307, 48.32747681044523],
95
- [130.53333624266037, 48.638203333369944],
96
- [130.69902773150022, 48.86294984494779],
97
- [130.4313260036679, 48.91144552665949],
98
- [130.2336273608912, 48.877796693265594],
99
- [129.49472335519903, 49.445146325369194],
100
- [128.6404925727599, 49.6395594299683],
101
- [127.95892224407356, 49.62425806475295],
102
- [127.56973394676123, 49.842755131278835],
103
- [127.6749910879272, 50.240140628289964],
104
- [127.45368458653832, 50.26847480259133],
105
- [127.37394005798404, 50.29288471184299],
106
- [127.32612719828853, 50.34379944487219],
107
- [127.37997900840315, 50.60653687131031],
108
- [127.16325020595207, 50.933036917572906],
109
- [126.99177818739395, 51.326954509452236],
110
- [126.33131963313707, 52.493153867333206],
111
- [126.09655832692533, 52.86710580508279],
112
- [125.18461572471739, 53.21778527809076],
113
- [123.62905555865535, 53.56957077991163],
114
- [122.14662682326076, 53.507610554797225],
115
- [120.81940759451805, 53.31174251524433],
116
- [119.95478692741125, 52.77983494498105],
117
- [120.02183577608542, 52.55624852160162],
118
- [120.59821023820314, 52.5562523256705],
119
- [120.65182146309388, 52.027454302929755],
120
- [120.00845804883363, 51.63400833664596],
121
- [119.10923570584242, 50.3653464992334],
122
- [119.33042992474253, 50.30545934524457],
123
- [119.21648675850292, 50.099528593865784],
124
- [118.93783039700338, 49.98458223887849],
125
- [118.54626899510839, 49.94616013995508],
126
- [117.80663959739081, 49.53647108800752],
127
- [117.484738258086, 49.624317990557614],
128
- [117.26607476489426, 49.63477188589076],
129
- [116.96468681768641, 49.73160402967815],
130
- [116.62825050755794, 49.944503706705376],
131
- [116.2287910451044, 50.03623236447976],
132
- [115.97912115005505, 49.97893073129566],
133
- [115.72585372832015, 49.87560524136032],
134
- [115.38340104847777, 49.935338883138456],
135
- [115.15157871232401, 50.03624558574222],
136
- [114.96972180858182, 50.18262812854161],
137
- [114.32823723216535, 50.27374466694857],
138
- [113.21615782676918, 49.84014337192383],
139
- [113.06279976594055, 49.60262851502978],
140
- [112.75961978011298, 49.50544853175836],
141
- [112.4528903096238, 49.51941937053812],
142
- [111.93911320274538, 49.37324774723086],
143
- [111.69083700584588, 49.38804243172055],
144
- [110.68965090965844, 49.16705432804406],
145
- [108.61062678042163, 49.33457873762259],
146
- [107.90316280555385, 49.97532248790398],
147
- [106.49948671672877, 50.3809827302172],
148
- [105.51746011619525, 50.48702476586922],
149
- [103.97795584841299, 50.133831277984996],
150
- [102.69196601175406, 50.37681484681099],
151
- [102.27144249887641, 50.87948727040293],
152
- [102.17444849785716, 51.35640391793228],
153
- [100.63003834780625, 51.738599556839574],
154
- [98.92412930445079, 52.152271807237554],
155
- [98.0263146497278, 51.38702212297895],
156
- [97.83223938583137, 50.91503753447586],
157
- [98.30141292582249, 50.51549014567553],
158
- [98.03452228766315, 50.01401927081076],
159
- [97.21087912958029, 49.75344974439781],
160
- [96.59617521697089, 49.92558626439808],
161
- [94.58073504473032, 50.071206832869876],
162
- [94.44884921665886, 50.25288523325358],
163
- [94.28227879098631, 50.59029357818193],
164
- [93.06055432240078, 50.6108167038102],
165
- [92.95500531764452, 50.764378755264715],
166
- [92.38044935493656, 50.81536176617482],
167
- [89.61447548394369, 49.896510834163024],
168
- [89.41209157088667, 49.593951299041436],
169
- [87.21941106111126, 49.136371106937105],
170
- [86.47691458036888, 48.52706996107682],
171
- [85.66792655187515, 48.41217050021373],
172
- [85.61001315938637, 47.097608820611185],
173
- [83.06577876367635, 47.1684932958469],
174
- [82.19603900970611, 45.39598594758252],
175
- [79.94680702146206, 44.995940936938524],
176
- [80.74758671786947, 43.25101970631087],
177
- [80.16296382083789, 42.42004311892032],
178
- [79.08808560905646, 42.80565581050615],
179
- [77.46543003728954, 42.93866114713731],
180
- [77.30266016034727, 42.91577009179525],
181
- [77.06944317811468, 42.98941184436538],
182
- [76.83954492079482, 42.95784584611252],
183
- [76.66706605000616, 42.91054018927406],
184
- [76.35054751194656, 42.86314251596045],
185
- [76.22106905960021, 42.92109675548289],
186
- [75.8499512176796, 42.944841027684475],
187
- [75.69647619703395, 42.79434701877443],
188
- [75.20518050373951, 42.86058166470994],
189
- [74.86716288299183, 42.99486162795807],
190
- [74.21214208437436, 43.26799034589942],
191
- [73.54918053004673, 43.03445951036437],
192
- [73.43569691290458, 42.59058989745361],
193
- [73.50713573720739, 42.42885549027292],
194
- [73.32430827244477, 42.43964242187812],
195
- [73.28138720704561, 42.524654623049486],
196
- [72.89688006931604, 42.53825798475941],
197
- [72.7028920768594, 42.65445195418786],
198
- [71.8205490156389, 42.84297257066001],
199
- [71.24172502287257, 42.76218198674192],
200
- [70.96542642702568, 42.45295945325228],
201
- [70.87574064610243, 42.288978943546994],
202
- [70.93667564676599, 42.25956939262474],
203
- [71.0522698554054, 42.28801700409892],
204
- [71.26892670629547, 42.19664779423837],
205
- [70.22467025584973, 41.6109136918285],
206
- [70.1871419707528, 41.52357559397731],
207
- [70.29521282660394, 41.5196557335768],
208
- [70.4885172051716, 41.39563567019803],
209
- [70.6908234400903, 41.47973822440426],
210
- [70.78334977579652, 41.37596799777336],
211
- [70.7936135992125, 41.23200478517444],
212
- [71.40193377758987, 41.189890843929476],
213
- [71.72132931443616, 41.463007098837124],
214
- [72.25976659039807, 41.036213505586716],
215
- [73.12473655458163, 40.821214468109844],
216
- [71.8274169831183, 40.219535506292345],
217
- [71.2093915709481, 40.35194316359275],
218
- [70.70839519610914, 40.047767583705706],
219
- [70.00814064760502, 40.19597188360018],
220
- [69.3238929275289, 39.96163997362652],
221
- [69.25288425833449, 39.8365015771121],
222
- [69.36807176732333, 39.53622995828479],
223
- [70.5656905159378, 39.611522993563625],
224
- [70.81017094805003, 39.40296443017286],
225
- [71.05478901580443, 39.42623263483682],
226
- [71.09537841230028, 39.521081174175976],
227
- [71.48723105871241, 39.61179598590786],
228
- [71.80293870931277, 39.289369010362776],
229
- [72.03176071465103, 39.344791211184486],
230
- [72.22037536907436, 39.19478948035075],
231
- [72.34794908849406, 39.34434407454637],
232
- [73.15397827282933, 39.35800161267082],
233
- [73.41580743762637, 39.46694232025965],
234
- [73.60494023346439, 39.469004217709056],
235
- [73.53306087489301, 39.24817612724672],
236
- [73.8401473956308, 38.955283153545196],
237
- [73.7178756559239, 38.88418224181672],
238
- [73.84575285445322, 38.5733588129749],
239
- [74.19825648155071, 38.625225936216],
240
- [74.73465165940527, 38.39729684471283],
241
- [74.94429646804616, 37.74563365375093],
242
- [75.09730124153691, 37.34874288728962],
243
- [74.47556092367677, 37.22736548435755],
244
- [74.52571774786139, 37.04804932382365],
245
- [72.64281263069017, 36.9965169904729],
246
- [71.27151437563325, 36.14385342653641],
247
- [71.70051938813555, 35.31553980310994],
248
- [70.91367870839377, 34.02947262017156],
249
- [69.8657881549984, 33.97753268150575],
250
- [70.19479291508452, 33.38872790844742],
251
- [69.48427263502771, 32.94309627730759],
252
- [69.17043362955638, 31.802649394624297],
253
- [66.5660130962763, 31.1468844695182],
254
- [66.39058495939196, 29.902900359253024],
255
- [64.20728972399988, 29.470320322411112],
256
- [62.39830055544061, 29.433474533828033],
257
- [60.82809795436239, 29.876493049104326],
258
- [61.819412883544715, 28.5413645023537],
259
- [62.838210084807116, 28.1758941784838],
260
- [62.87712480493187, 26.710220153319582],
261
- [61.95649723937791, 26.202543172995433],
262
- [61.64164473778666, 25.062349569223997],
263
- [66.89889168301036, 22.98946421817959],
264
- ],
265
- ],
266
- [
267
- [
268
- [-79.49790751939359, 8.895517276865164],
269
- [-80.09116426661198, 9.489400626216977],
270
- [-71.5226805789838, 14.570830502555324],
271
- [-64.296660455746, 16.87497218957077],
272
- [-63.50670575144407, 19.468079078229948],
273
- [-46.04319359052067, 49.81687541607755],
274
- [-57.24573007399778, 67.81957009723368],
275
- [-74.74198803509906, 76.55978940288878],
276
- [-73.60375960527375, 78.39636019182609],
277
- [-67.92218140574312, 80.61698801540712],
278
- [-59.076220860081435, 82.41962573871615],
279
- [-68.9778162806643, 85.05112877980659],
280
- [-169.10721706859002, 69.87119013352208],
281
- [-168.82669211383998, 64.59846733544799],
282
- [-172.31141325730604, 63.991833108168834],
283
- [-192.1254235906623, 52.646873605362146],
284
- [-166.3003429543922, 12.967564352770154],
285
- [-79.6692367415715, 4.562414945897046],
286
- [-79.49790751939359, 8.895517276865164],
287
- ],
288
- ],
289
- ]);
290
-
291
- const japanConventionGeometry = turf.polygon([
292
- [
293
- [122.40443764161375, 24.25555191895947],
294
- [123.22422482046358, 22.664415921202675],
295
- [131.6668409404955, 27.1734104531445],
296
- [141.6724497786463, 33.41882632781292],
297
- [152.21247459573226, 45.19087135255526],
298
- [154.7040665173107, 48.05238412051253],
299
- [149.47388354609916, 49.86405083649407],
300
- [144.62198341555745, 55.122855332829886],
301
- [141.85000003174838, 54.453056889632535],
302
- [141.56865023975553, 53.237305271866575],
303
- [141.5658284519161, 52.12730212591498],
304
- [140.86177532698593, 47.83608043534858],
305
- [129.38176008175282, 34.88162789041118],
306
- [122.40443764161375, 24.25555191895947],
307
- ],
308
- ]);
309
-
310
- /**
311
- * Determines the run difficulty convention for a given geographic location.
312
- * Based on the center point of the geometry, returns the appropriate regional
313
- * convention for ski run difficulty ratings.
314
- *
315
- * @param geojson - GeoJSON geometry to determine the center location from
316
- * @returns The appropriate run difficulty convention for the location
317
- * @throws Error if the center of geometry cannot be determined
318
- */
319
- export function getRunDifficultyConvention(
320
- geojson: AllGeoJSON,
321
- ): RunDifficultyConvention {
322
- const point = turfCenter(geojson).geometry;
323
- if (!point) {
324
- throw "Cannot determine center of geometry";
325
- }
326
-
327
- if (booleanPointInPolygon(point, japanConventionGeometry)) {
328
- return RunDifficultyConvention.JAPAN;
329
- } else if (booleanPointInPolygon(point, northAmericanConventionGeometry)) {
330
- return RunDifficultyConvention.NORTH_AMERICA;
331
- } else {
332
- return RunDifficultyConvention.EUROPE;
333
- }
334
- }
335
-
package/src/SkiArea.ts DELETED
@@ -1,128 +0,0 @@
1
- import { FeatureType } from './FeatureType'
2
- import { LiftType } from './Lift'
3
- import { Place } from './Place'
4
- import { RunDifficulty } from './Run'
5
- import { RunDifficultyConvention } from './RunDifficultyConvention'
6
- import { SkiPassMembership } from './SkiPass'
7
- import { SnowCoverHistory } from './SnowCoverHistory'
8
- import { Source } from './Source'
9
- import { Status } from './Status'
10
- import { ViewportHint } from './ViewportHint'
11
-
12
- /**
13
- * A ski area feature is derived from several sources:
14
- * - OpenStreetMap site=piste relations (must contain at least one lift or run of any kind)
15
- * - OpenStreetMap landuse=winter_sports areas (must contain at least one downhill/nordic (non-backcountry) run or operational lift)
16
- * - Skimap.org ski areas
17
- *
18
- * The processor attempts to merge the data of all sources to create a single ski area feature.
19
- *
20
- * In some cases merging may fail and duplicate ski areas will be produced. This is likely due to ambiguous data.
21
- * Check:
22
- * - that a site=piste relation contains all the lifts/runs. If many lifts/runs are missing, merging will fail.
23
- * - that if there are multiple landuse=winter_sports areas representing a single ski area. In this case a multipolygon relation should be used.
24
- * - that if there are multiple Skimap.org ski areas representing a single ski area.
25
- *
26
- * General recommendation for ski area tagging in OpenStreetMap:
27
- * - start with a landuse=winter_sports area as it's easy to set up and maintain.
28
- * - if that's not explicit enough, add a site=piste relation as well.
29
- *
30
- * 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.
31
- */
32
- export type SkiAreaFeature = GeoJSON.Feature<SkiAreaGeometry, SkiAreaProperties>
33
-
34
- export type SkiAreaGeometry =
35
- | GeoJSON.Point
36
- | GeoJSON.Polygon
37
- | GeoJSON.MultiPolygon
38
-
39
- export type SkiAreaSummaryFeature = GeoJSON.Feature<
40
- SkiAreaGeometry,
41
- SkiAreaSummaryProperties
42
- >
43
-
44
- /**
45
- * @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 wikidataID property, or a source id.
46
- * @property {string | null} name - Name of the ski area.
47
- * @property {Source[]} sources - Data sources.
48
- * @property {SkiAreaActivity[]} activities - Activities available at this ski area, derived from presence of ski runs and Skimap.org data.
49
- * @property {SkiAreaStatistics} statistics - Statistics generated from associated runs / lifts.
50
- * @property {Status | null} status - Operational status. Derived from OpenStreetMap lifecycle tags and Skimap.org data.
51
- * @property {RunColorConvention} runConvention - Color convention used for runs at this ski area.
52
- * @property {string[]} websites - Official website(s) of the ski area. Derived from the OpenStreetMap website tag and Skimap.org data.
53
- * @property {string | null} wikidataID - Wikidata identifier. Derived from the OpenStreetMap wikidata tag.
54
- * @property {Place[]} places - Geographic places this ski area is within (e.g., city, region, country). Derived from reverse geocoding.
55
- * @property {SkiPassMembership[]} skiPasses - Multi-resort season passes this ski area is on. Empty if it is on none.
56
- */
57
- export type SkiAreaProperties = SkiAreaSummaryProperties & {
58
- sources: Source[]
59
- statistics?: SkiAreaStatistics
60
- runConvention: RunDifficultyConvention
61
- websites: string[]
62
- wikidataID: string | null
63
- places: Place[]
64
- viewportHint: ViewportHint
65
- skiPasses: SkiPassMembership[]
66
- }
67
-
68
- export type SkiAreaSummaryProperties = {
69
- type: FeatureType.SkiArea
70
- id: string
71
- name: string | null
72
- activities: SkiAreaActivity[]
73
- status: Status | null
74
- }
75
-
76
- export enum SkiAreaActivity {
77
- Downhill = 'downhill',
78
- Nordic = 'nordic',
79
- }
80
-
81
- export type SkiAreaStatistics = {
82
- runs: RunStatistics
83
- lifts: LiftStatistics
84
- minElevation?: number
85
- maxElevation?: number
86
- snowCover?: SkiAreaSnowCoverStatistics
87
- }
88
-
89
- /**
90
- * Aggregated snow cover data for a ski area's runs.
91
- */
92
- export type SkiAreaSnowCoverStatistics = {
93
- overall: SnowCoverHistory
94
- byActivity: { [key in SkiAreaActivity | 'other']?: SnowCoverHistory }
95
- }
96
-
97
- export type RunStatistics = {
98
- minElevation?: number
99
- maxElevation?: number
100
- byActivity: RunStatisticsByActivityAndDifficulty
101
- }
102
-
103
- export type RunStatisticsByActivityAndDifficulty = {
104
- [key in SkiAreaActivity | 'other']?: {
105
- byDifficulty: RunStatisticsByDifficulty
106
- }
107
- }
108
-
109
- export type RunStatisticsByDifficulty = {
110
- [key in RunDifficulty | 'other']?: {
111
- count: number
112
- lengthInKm: number
113
- snowmakingLengthInKm?: number
114
- snowfarmingLengthInKm?: number
115
- }
116
- }
117
-
118
- export type LiftStatistics = {
119
- minElevation?: number
120
- maxElevation?: number
121
- byType: LiftStatisticsByType
122
- }
123
-
124
- export type LiftStatisticsByTypeKey = LiftType | 'other'
125
-
126
- export type LiftStatisticsByType = {
127
- [key in LiftStatisticsByTypeKey]?: { count: number; lengthInKm: number }
128
- }
package/src/SkiPass.ts DELETED
@@ -1,89 +0,0 @@
1
- import { Source } from './Source'
2
-
3
- /** Stable identifier for a purchasable ski pass, e.g. "ikon-base". */
4
- export type SkiPassID = string
5
-
6
- /** Stable identifier for a family of related ski passes, e.g. "ikon". */
7
- export type SkiPassBrandID = string
8
-
9
- /**
10
- * A ski area's membership of one purchasable ski pass.
11
- *
12
- * @property {SkiPassID} passID - Identifier of the ski pass.
13
- * @property {string} passName - Display name of the ski pass.
14
- * @property {SkiPassBrandID | null} brandID - Identifier of the pass's brand, or null for a standalone pass.
15
- * @property {string | null} brandName - Display name of the pass's brand, or null for a standalone pass.
16
- * @property {string | null} access - Access code, copied verbatim from the source, e.g. "5, 26, 27" or "U". The source documents these per pass in free text, so they are not parsed.
17
- * @property {number | null} yearJoined - Year the ski area joined this pass, when the source records it.
18
- * @property {Source[]} sources - Data sources.
19
- */
20
- export type SkiPassMembership = {
21
- passID: SkiPassID
22
- passName: string
23
- brandID: SkiPassBrandID | null
24
- brandName: string | null
25
- access: string | null
26
- yearJoined: number | null
27
- sources: Source[]
28
- }
29
-
30
- /**
31
- * A family of related ski passes, used to group the purchasable passes in a catalogue.
32
- *
33
- * @property {SkiPassBrandID} id - Stable identifier for the brand.
34
- * @property {string} name - Display name of the brand.
35
- * @property {Source[]} sources - Data sources shared by the brand's passes.
36
- */
37
- export type SkiPassBrand = {
38
- type: 'skiPassBrand'
39
- id: SkiPassBrandID
40
- name: string
41
- sources: Source[]
42
- }
43
-
44
- /**
45
- * A multi-resort season pass.
46
- *
47
- * Unlike runs, lifts, ski areas and spots, a ski pass is not a geographic feature: it is a
48
- * commercial product that covers a set of ski areas. The ski areas it covers each carry a
49
- * matching `SkiPassMembership`.
50
- *
51
- * @property {SkiPassID} id - Unique identifier for the ski pass. Unlike a ski area ID, this is stable across runs.
52
- * @property {string} name - Name of the ski pass.
53
- * @property {SkiPassBrandID | null} brandID - Identifier of the pass's brand, or null for a standalone pass.
54
- * @property {string | null} brandName - Display name of the pass's brand, or null for a standalone pass.
55
- * @property {Source[]} sources - Data sources.
56
- * @property {number} skiAreaCount - Number of ski areas this pass covers. Equal to the length of skiAreaIDs.
57
- * @property {string[]} skiAreaIDs - IDs of the ski areas this pass covers, sorted, so that the order does not depend on anything outside this array.
58
- * @property {SkiPassUnresolvedRosterEntry[]} unresolvedRosterEntries - Ski areas the source lists on this pass that could not be resolved to a ski area feature.
59
- */
60
- export type SkiPass = {
61
- type: 'skiPass'
62
- id: SkiPassID
63
- name: string
64
- brandID: SkiPassBrandID | null
65
- brandName: string | null
66
- sources: Source[]
67
- skiAreaCount: number
68
- skiAreaIDs: string[]
69
- unresolvedRosterEntries: SkiPassUnresolvedRosterEntry[]
70
- }
71
-
72
- /** The complete non-geographic ski-pass dataset published alongside the ski-area data. */
73
- export type SkiPassCatalog = {
74
- brands: SkiPassBrand[]
75
- passes: SkiPass[]
76
- }
77
-
78
- /**
79
- * A ski area listed on a pass by the source, which has no corresponding ski area feature.
80
- *
81
- * @property {string} name - Ski area name as written by the source.
82
- * @property {string} location - Location as written by the source, e.g. "U.S. - Colorado".
83
- * @property {string} reason - Why the entry could not be resolved.
84
- */
85
- export type SkiPassUnresolvedRosterEntry = {
86
- name: string
87
- location: string
88
- reason: string
89
- }