openskidata-format 13.0.0 → 15.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 +1 -0
- package/dist/ElevationProfile.d.ts.map +1 -0
- package/dist/ElevationProfile.js +15 -24
- package/dist/ElevationProfile.js.map +1 -1
- package/dist/FeatureType.d.ts +1 -0
- package/dist/FeatureType.d.ts.map +1 -0
- package/dist/FeatureType.js +2 -5
- package/dist/FeatureType.js.map +1 -1
- package/dist/Lift.d.ts +10 -8
- package/dist/Lift.d.ts.map +1 -0
- package/dist/Lift.js +22 -29
- package/dist/Lift.js.map +1 -1
- package/dist/LiftNameFormatter.d.ts +2 -1
- package/dist/LiftNameFormatter.d.ts.map +1 -0
- package/dist/LiftNameFormatter.js +11 -14
- package/dist/LiftNameFormatter.js.map +1 -1
- package/dist/Place.d.ts +1 -0
- package/dist/Place.d.ts.map +1 -0
- package/dist/Place.js +1 -2
- package/dist/Run.d.ts +10 -9
- package/dist/Run.d.ts.map +1 -0
- package/dist/Run.js +23 -30
- package/dist/Run.js.map +1 -1
- package/dist/RunDifficultyConvention.d.ts +2 -1
- package/dist/RunDifficultyConvention.d.ts.map +1 -0
- package/dist/RunDifficultyConvention.js +10 -15
- package/dist/RunDifficultyConvention.js.map +1 -1
- package/dist/SkiArea.d.ts +12 -10
- package/dist/SkiArea.d.ts.map +1 -0
- package/dist/SkiArea.js +2 -5
- package/dist/SkiArea.js.map +1 -1
- package/dist/SkiPass.d.ts +32 -7
- package/dist/SkiPass.d.ts.map +1 -0
- package/dist/SkiPass.js +1 -2
- package/dist/SlopeGradingScale.d.ts +3 -2
- package/dist/SlopeGradingScale.d.ts.map +1 -0
- package/dist/SlopeGradingScale.js +21 -26
- package/dist/SlopeGradingScale.js.map +1 -1
- package/dist/SnowCoverHistory.d.ts +1 -0
- package/dist/SnowCoverHistory.d.ts.map +1 -0
- package/dist/SnowCoverHistory.js +9 -8
- package/dist/SnowCoverHistory.js.map +1 -1
- package/dist/Source.d.ts +1 -0
- package/dist/Source.d.ts.map +1 -0
- package/dist/Source.js +11 -17
- package/dist/Source.js.map +1 -1
- package/dist/Spot.d.ts +6 -5
- package/dist/Spot.d.ts.map +1 -0
- package/dist/Spot.js +6 -9
- package/dist/Spot.js.map +1 -1
- package/dist/Status.d.ts +1 -0
- package/dist/Status.d.ts.map +1 -0
- package/dist/Status.js +2 -5
- package/dist/Status.js.map +1 -1
- package/dist/ViewportHint.d.ts +1 -0
- package/dist/ViewportHint.d.ts.map +1 -0
- package/dist/ViewportHint.js +4 -10
- package/dist/ViewportHint.js.map +1 -1
- package/dist/index.d.ts +16 -15
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -18
- package/dist/index.js.map +1 -1
- package/dist/util/exhaustiveMatchingGuard.d.ts +1 -0
- package/dist/util/exhaustiveMatchingGuard.d.ts.map +1 -0
- package/dist/util/exhaustiveMatchingGuard.js +1 -5
- package/dist/util/exhaustiveMatchingGuard.js.map +1 -1
- package/package.json +35 -23
- package/dist/testUtils.d.ts +0 -2
- package/dist/testUtils.js +0 -7
- package/dist/testUtils.js.map +0 -1
- package/src/ElevationProfile.test.ts +0 -738
- package/src/ElevationProfile.ts +0 -452
- package/src/FeatureType.ts +0 -6
- package/src/Lift.test.ts +0 -195
- package/src/Lift.ts +0 -219
- package/src/LiftNameFormatter.ts +0 -116
- package/src/Place.ts +0 -11
- package/src/Run.ts +0 -242
- package/src/RunDifficultyConvention.test.ts +0 -79
- package/src/RunDifficultyConvention.ts +0 -335
- package/src/SkiArea.ts +0 -128
- package/src/SkiPass.ts +0 -62
- package/src/SlopeGradingScale.test.ts +0 -151
- package/src/SlopeGradingScale.ts +0 -96
- package/src/SnowCoverHistory.test.ts +0 -103
- package/src/SnowCoverHistory.ts +0 -107
- package/src/Source.test.ts +0 -50
- package/src/Source.ts +0 -72
- package/src/Spot.ts +0 -140
- package/src/Status.ts +0 -20
- package/src/ViewportHint.ts +0 -208
- package/src/index.ts +0 -15
- package/src/testUtils.ts +0 -5
- 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,62 +0,0 @@
|
|
|
1
|
-
import { Source } from './Source'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Stable identifier for a ski pass, e.g. "ikon".
|
|
5
|
-
*/
|
|
6
|
-
export type SkiPassID = string
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A ski area's membership of one tier of one ski pass.
|
|
10
|
-
*
|
|
11
|
-
* @property {SkiPassID} passID - Identifier of the ski pass.
|
|
12
|
-
* @property {string} passName - Display name of the ski pass.
|
|
13
|
-
* @property {string | null} tier - Tier within the pass, e.g. "base" or "session". Null for the pass's standard tier.
|
|
14
|
-
* @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.
|
|
15
|
-
* @property {number | null} yearJoined - Year the ski area joined this pass, when the source records it.
|
|
16
|
-
* @property {Source[]} sources - Data sources.
|
|
17
|
-
*/
|
|
18
|
-
export type SkiPassMembership = {
|
|
19
|
-
passID: SkiPassID
|
|
20
|
-
passName: string
|
|
21
|
-
tier: string | null
|
|
22
|
-
access: string | null
|
|
23
|
-
yearJoined: number | null
|
|
24
|
-
sources: Source[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A multi-resort season pass.
|
|
29
|
-
*
|
|
30
|
-
* Unlike runs, lifts, ski areas and spots, a ski pass is not a geographic feature: it is a
|
|
31
|
-
* commercial product that covers a set of ski areas. The ski areas it covers each carry a
|
|
32
|
-
* matching `SkiPassMembership`.
|
|
33
|
-
*
|
|
34
|
-
* @property {SkiPassID} id - Unique identifier for the ski pass. Unlike a ski area ID, this is stable across runs.
|
|
35
|
-
* @property {string} name - Name of the ski pass.
|
|
36
|
-
* @property {Source[]} sources - Data sources.
|
|
37
|
-
* @property {number} skiAreaCount - Number of ski areas this pass covers. Equal to the length of skiAreaIDs.
|
|
38
|
-
* @property {string[]} skiAreaIDs - IDs of the ski areas this pass covers, sorted, so that the order does not depend on anything outside this array.
|
|
39
|
-
* @property {SkiPassUnresolvedRosterEntry[]} unresolvedRosterEntries - Ski areas the source lists on this pass that could not be resolved to a ski area feature.
|
|
40
|
-
*/
|
|
41
|
-
export type SkiPass = {
|
|
42
|
-
type: 'skiPass'
|
|
43
|
-
id: SkiPassID
|
|
44
|
-
name: string
|
|
45
|
-
sources: Source[]
|
|
46
|
-
skiAreaCount: number
|
|
47
|
-
skiAreaIDs: string[]
|
|
48
|
-
unresolvedRosterEntries: SkiPassUnresolvedRosterEntry[]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* A ski area listed on a pass by the source, which has no corresponding ski area feature.
|
|
53
|
-
*
|
|
54
|
-
* @property {string} name - Ski area name as written by the source.
|
|
55
|
-
* @property {string} location - Location as written by the source, e.g. "U.S. - Colorado".
|
|
56
|
-
* @property {string} reason - Why the entry could not be resolved.
|
|
57
|
-
*/
|
|
58
|
-
export type SkiPassUnresolvedRosterEntry = {
|
|
59
|
-
name: string
|
|
60
|
-
location: string
|
|
61
|
-
reason: string
|
|
62
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { RunDifficulty, RunUse } from "./Run";
|
|
2
|
-
import { getEstimatedRunDifficulty, getSlopeGradingScale } from "./SlopeGradingScale";
|
|
3
|
-
import { mockViewportHint } from "./testUtils";
|
|
4
|
-
|
|
5
|
-
describe("getEstimatedRunDifficulty", () => {
|
|
6
|
-
it("should return null for steepness below minimum threshold", () => {
|
|
7
|
-
const downhillScale = getSlopeGradingScale({
|
|
8
|
-
type: "Feature",
|
|
9
|
-
geometry: { type: "LineString", coordinates: [] },
|
|
10
|
-
properties: {
|
|
11
|
-
type: "Run" as any,
|
|
12
|
-
uses: [RunUse.Downhill],
|
|
13
|
-
id: "test",
|
|
14
|
-
name: null,
|
|
15
|
-
ref: null,
|
|
16
|
-
status: "operating" as any,
|
|
17
|
-
description: null,
|
|
18
|
-
difficulty: null,
|
|
19
|
-
difficultyConvention: "europe" as any,
|
|
20
|
-
oneway: null,
|
|
21
|
-
lit: null,
|
|
22
|
-
gladed: null,
|
|
23
|
-
patrolled: null,
|
|
24
|
-
snowmaking: null,
|
|
25
|
-
snowfarming: null,
|
|
26
|
-
grooming: null,
|
|
27
|
-
skiAreas: [],
|
|
28
|
-
elevationProfile: null,
|
|
29
|
-
sources: [],
|
|
30
|
-
websites: [],
|
|
31
|
-
wikidataID: null,
|
|
32
|
-
tunnel: null,
|
|
33
|
-
places: [],
|
|
34
|
-
viewportHint: mockViewportHint(),
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
expect(getEstimatedRunDifficulty(0.03, downhillScale)).toBeNull(); // 3% steepness
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("should return correct difficulty for downhill slopes", () => {
|
|
42
|
-
const downhillScale = getSlopeGradingScale({
|
|
43
|
-
type: "Feature",
|
|
44
|
-
geometry: { type: "LineString", coordinates: [] },
|
|
45
|
-
properties: {
|
|
46
|
-
type: "Run" as any,
|
|
47
|
-
uses: [RunUse.Downhill],
|
|
48
|
-
id: "test",
|
|
49
|
-
name: null,
|
|
50
|
-
ref: null,
|
|
51
|
-
status: "operating" as any,
|
|
52
|
-
description: null,
|
|
53
|
-
difficulty: null,
|
|
54
|
-
difficultyConvention: "europe" as any,
|
|
55
|
-
oneway: null,
|
|
56
|
-
lit: null,
|
|
57
|
-
gladed: null,
|
|
58
|
-
patrolled: null,
|
|
59
|
-
snowmaking: null,
|
|
60
|
-
snowfarming: null,
|
|
61
|
-
grooming: null,
|
|
62
|
-
skiAreas: [],
|
|
63
|
-
elevationProfile: null,
|
|
64
|
-
sources: [],
|
|
65
|
-
websites: [],
|
|
66
|
-
wikidataID: null,
|
|
67
|
-
tunnel: null,
|
|
68
|
-
places: [],
|
|
69
|
-
viewportHint: mockViewportHint(),
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
expect(getEstimatedRunDifficulty(0.1, downhillScale)).toBe(RunDifficulty.EASY); // 10%
|
|
74
|
-
expect(getEstimatedRunDifficulty(0.3, downhillScale)).toBe(RunDifficulty.INTERMEDIATE); // 30%
|
|
75
|
-
expect(getEstimatedRunDifficulty(0.6, downhillScale)).toBe(RunDifficulty.ADVANCED); // 60%
|
|
76
|
-
expect(getEstimatedRunDifficulty(0.9, downhillScale)).toBe(RunDifficulty.EXPERT); // 90%
|
|
77
|
-
expect(getEstimatedRunDifficulty(1.0, downhillScale)).toBe(RunDifficulty.FREERIDE); // 100%
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("should return correct difficulty for nordic slopes", () => {
|
|
81
|
-
const nordicScale = getSlopeGradingScale({
|
|
82
|
-
type: "Feature",
|
|
83
|
-
geometry: { type: "LineString", coordinates: [] },
|
|
84
|
-
properties: {
|
|
85
|
-
type: "Run" as any,
|
|
86
|
-
uses: [RunUse.Nordic],
|
|
87
|
-
id: "test",
|
|
88
|
-
name: null,
|
|
89
|
-
ref: null,
|
|
90
|
-
status: "operating" as any,
|
|
91
|
-
description: null,
|
|
92
|
-
difficulty: null,
|
|
93
|
-
difficultyConvention: "europe" as any,
|
|
94
|
-
oneway: null,
|
|
95
|
-
lit: null,
|
|
96
|
-
gladed: null,
|
|
97
|
-
patrolled: null,
|
|
98
|
-
snowmaking: null,
|
|
99
|
-
snowfarming: null,
|
|
100
|
-
grooming: null,
|
|
101
|
-
skiAreas: [],
|
|
102
|
-
elevationProfile: null,
|
|
103
|
-
sources: [],
|
|
104
|
-
websites: [],
|
|
105
|
-
wikidataID: null,
|
|
106
|
-
tunnel: null,
|
|
107
|
-
places: [],
|
|
108
|
-
viewportHint: mockViewportHint(),
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
expect(getEstimatedRunDifficulty(0.05, nordicScale)).toBe(RunDifficulty.EASY); // 5%
|
|
113
|
-
expect(getEstimatedRunDifficulty(0.12, nordicScale)).toBe(RunDifficulty.INTERMEDIATE); // 12%
|
|
114
|
-
expect(getEstimatedRunDifficulty(0.25, nordicScale)).toBe(RunDifficulty.ADVANCED); // 25%
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it("should handle negative steepness (uphill)", () => {
|
|
118
|
-
const downhillScale = getSlopeGradingScale({
|
|
119
|
-
type: "Feature",
|
|
120
|
-
geometry: { type: "LineString", coordinates: [] },
|
|
121
|
-
properties: {
|
|
122
|
-
type: "Run" as any,
|
|
123
|
-
uses: [RunUse.Downhill],
|
|
124
|
-
id: "test",
|
|
125
|
-
name: null,
|
|
126
|
-
ref: null,
|
|
127
|
-
status: "operating" as any,
|
|
128
|
-
description: null,
|
|
129
|
-
difficulty: null,
|
|
130
|
-
difficultyConvention: "europe" as any,
|
|
131
|
-
oneway: null,
|
|
132
|
-
lit: null,
|
|
133
|
-
gladed: null,
|
|
134
|
-
patrolled: null,
|
|
135
|
-
snowmaking: null,
|
|
136
|
-
snowfarming: null,
|
|
137
|
-
grooming: null,
|
|
138
|
-
skiAreas: [],
|
|
139
|
-
elevationProfile: null,
|
|
140
|
-
sources: [],
|
|
141
|
-
websites: [],
|
|
142
|
-
wikidataID: null,
|
|
143
|
-
tunnel: null,
|
|
144
|
-
places: [],
|
|
145
|
-
viewportHint: mockViewportHint(),
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
expect(getEstimatedRunDifficulty(-0.1, downhillScale)).toBe(RunDifficulty.EASY); // -10%
|
|
150
|
-
});
|
|
151
|
-
});
|