@wemap/osm 11.0.0-alpha.7 → 11.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/assets/bureaux-wemap-montpellier-network.osm +2 -2
- package/assets/network-steps-same-level.osm +283 -0
- package/dist/index.js +66 -142
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -143
- package/dist/index.mjs.map +1 -1
- package/index.ts +2 -11
- package/package.json +4 -4
- package/src/OsmModel.ts +11 -1
- package/src/OsmNode.ts +2 -1
- package/src/OsmParser.ts +36 -1
- package/src/OsmRelation.ts +42 -0
- package/src/OsmWay.ts +2 -0
- package/src/graph/OsmGraphEdge.ts +0 -5
- package/src/graph/OsmGraphItinerary.ts +0 -13
- package/src/graph/OsmGraphNode.ts +0 -5
- package/src/graph/OsmGraphProjection.ts +0 -5
- package/src/graph/OsmGraphRouter.ts +0 -5
- package/src/graph/OsmGraphRouterOptions.ts +0 -5
- package/src/graph/OsmMapMatching.ts +0 -5
- package/src/graph/OsmNetwork.ts +0 -9
- package/src/graph/OsmNetworkUtils.spec.ts +0 -100
- package/src/graph/OsmNetworkUtils.ts +0 -194
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
<tag k='name' v='p21' />
|
|
76
76
|
</node>
|
|
77
77
|
<node id='-441273' action='modify' visible='true' lat='43.6095297' lon='3.8845039'>
|
|
78
|
-
<tag k='name' v='
|
|
78
|
+
<tag k='name' v='p26' />
|
|
79
79
|
</node>
|
|
80
80
|
<node id='-441286' action='modify' visible='true' lat='43.6095624' lon='3.8845134'>
|
|
81
|
-
<tag k='name' v='
|
|
81
|
+
<tag k='name' v='p27' />
|
|
82
82
|
</node>
|
|
83
83
|
<way id='-440499' action='modify' visible='true'>
|
|
84
84
|
<nd ref='-440476' />
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
|
2
|
+
<osm version='0.6' generator='JOSM'>
|
|
3
|
+
<node id='-442272' action='modify' visible='true' lat='43.60911942643' lon='3.88422017836'>
|
|
4
|
+
<tag k='name' v='end1' />
|
|
5
|
+
</node>
|
|
6
|
+
<node id='-442273' action='modify' visible='true' lat='43.609172167' lon='3.88423552813'>
|
|
7
|
+
<tag k='name' v='start1' />
|
|
8
|
+
</node>
|
|
9
|
+
<node id='-442274' action='modify' visible='true' lat='43.60916799079' lon='3.88423431239' />
|
|
10
|
+
<node id='-442275' action='modify' visible='true' lat='43.60912597257' lon='3.88422208353' />
|
|
11
|
+
<node id='-442276' action='modify' visible='true' lat='43.60916666184' lon='3.88425569572' />
|
|
12
|
+
<node id='-442277' action='modify' visible='true' lat='43.60911809748' lon='3.88424156169'>
|
|
13
|
+
<tag k='name' v='end2' />
|
|
14
|
+
</node>
|
|
15
|
+
<node id='-442278' action='modify' visible='true' lat='43.60912464361' lon='3.88424346686' />
|
|
16
|
+
<node id='-442279' action='modify' visible='true' lat='43.60917083805' lon='3.88425691146'>
|
|
17
|
+
<tag k='name' v='start2' />
|
|
18
|
+
</node>
|
|
19
|
+
<node id='-442280' action='modify' visible='true' lat='43.60916684981' lon='3.88427763193' />
|
|
20
|
+
<node id='-442281' action='modify' visible='true' lat='43.60911828545' lon='3.8842634979'>
|
|
21
|
+
<tag k='name' v='end3' />
|
|
22
|
+
</node>
|
|
23
|
+
<node id='-442282' action='modify' visible='true' lat='43.60912483158' lon='3.88426540307' />
|
|
24
|
+
<node id='-442283' action='modify' visible='true' lat='43.60917102602' lon='3.88427884767'>
|
|
25
|
+
<tag k='name' v='start3' />
|
|
26
|
+
</node>
|
|
27
|
+
<node id='-442284' action='modify' visible='true' lat='43.60916684981' lon='3.88430177474' />
|
|
28
|
+
<node id='-442285' action='modify' visible='true' lat='43.60911828545' lon='3.88428764071'>
|
|
29
|
+
<tag k='name' v='end4' />
|
|
30
|
+
</node>
|
|
31
|
+
<node id='-442286' action='modify' visible='true' lat='43.60912483158' lon='3.88428954588' />
|
|
32
|
+
<node id='-442287' action='modify' visible='true' lat='43.60917102602' lon='3.88430299048'>
|
|
33
|
+
<tag k='name' v='start4' />
|
|
34
|
+
</node>
|
|
35
|
+
<node id='-442288' action='modify' visible='true' lat='43.60916675582' lon='3.88432539836' />
|
|
36
|
+
<node id='-442289' action='modify' visible='true' lat='43.60911819146' lon='3.88431126433'>
|
|
37
|
+
<tag k='name' v='end5' />
|
|
38
|
+
</node>
|
|
39
|
+
<node id='-442290' action='modify' visible='true' lat='43.6091247376' lon='3.88431316949' />
|
|
40
|
+
<node id='-442291' action='modify' visible='true' lat='43.60917093203' lon='3.8843266141'>
|
|
41
|
+
<tag k='name' v='start5' />
|
|
42
|
+
</node>
|
|
43
|
+
<node id='-442292' action='modify' visible='true' lat='43.60916637989' lon='3.88434759417' />
|
|
44
|
+
<node id='-442293' action='modify' visible='true' lat='43.60911781553' lon='3.88433346014'>
|
|
45
|
+
<tag k='name' v='end6' />
|
|
46
|
+
</node>
|
|
47
|
+
<node id='-442294' action='modify' visible='true' lat='43.60912436166' lon='3.88433536531' />
|
|
48
|
+
<node id='-442295' action='modify' visible='true' lat='43.6091705561' lon='3.88434880991'>
|
|
49
|
+
<tag k='name' v='start6' />
|
|
50
|
+
</node>
|
|
51
|
+
<node id='-442296' action='modify' visible='true' lat='43.60916628591' lon='3.88436849198' />
|
|
52
|
+
<node id='-442297' action='modify' visible='true' lat='43.60911772155' lon='3.88435435795'>
|
|
53
|
+
<tag k='name' v='end7' />
|
|
54
|
+
</node>
|
|
55
|
+
<node id='-442298' action='modify' visible='true' lat='43.60912426768' lon='3.88435626312' />
|
|
56
|
+
<node id='-442299' action='modify' visible='true' lat='43.60917046212' lon='3.88436970772'>
|
|
57
|
+
<tag k='name' v='start7' />
|
|
58
|
+
</node>
|
|
59
|
+
<node id='-442300' action='modify' visible='true' lat='43.60916600396' lon='3.88439016859' />
|
|
60
|
+
<node id='-442301' action='modify' visible='true' lat='43.6091174396' lon='3.88437603456'>
|
|
61
|
+
<tag k='name' v='end8' />
|
|
62
|
+
</node>
|
|
63
|
+
<node id='-442302' action='modify' visible='true' lat='43.60912398573' lon='3.88437793973' />
|
|
64
|
+
<node id='-442303' action='modify' visible='true' lat='43.60917018017' lon='3.88439138433'>
|
|
65
|
+
<tag k='name' v='start8' />
|
|
66
|
+
</node>
|
|
67
|
+
<node id='-442304' action='modify' visible='true' lat='43.60914503663' lon='3.88438406632' />
|
|
68
|
+
<node id='-442305' action='modify' visible='true' lat='43.60912483158' lon='3.88439896734' />
|
|
69
|
+
<node id='-442306' action='modify' visible='true' lat='43.60917102602' lon='3.88441241194'>
|
|
70
|
+
<tag k='name' v='start9' />
|
|
71
|
+
</node>
|
|
72
|
+
<node id='-442307' action='modify' visible='true' lat='43.60916684981' lon='3.8844111962' />
|
|
73
|
+
<node id='-442308' action='modify' visible='true' lat='43.60911828545' lon='3.88439706217'>
|
|
74
|
+
<tag k='name' v='end9' />
|
|
75
|
+
</node>
|
|
76
|
+
<node id='-442309' action='modify' visible='true' lat='43.60914595351' lon='3.8844051146' />
|
|
77
|
+
<node id='-442310' action='modify' visible='true' lat='43.60912464361' lon='3.88442194195' />
|
|
78
|
+
<node id='-442311' action='modify' visible='true' lat='43.60917083805' lon='3.88443538655'>
|
|
79
|
+
<tag k='name' v='start10' />
|
|
80
|
+
</node>
|
|
81
|
+
<node id='-442312' action='modify' visible='true' lat='43.60916666184' lon='3.88443417081' />
|
|
82
|
+
<node id='-442313' action='modify' visible='true' lat='43.60911809748' lon='3.88442003678'>
|
|
83
|
+
<tag k='name' v='end10' />
|
|
84
|
+
</node>
|
|
85
|
+
<way id='-441825' action='modify' visible='true'>
|
|
86
|
+
<nd ref='-442273' />
|
|
87
|
+
<nd ref='-442274' />
|
|
88
|
+
<tag k='highway' v='footway' />
|
|
89
|
+
<tag k='name' v='w1' />
|
|
90
|
+
</way>
|
|
91
|
+
<way id='-441826' action='modify' visible='true'>
|
|
92
|
+
<nd ref='-442274' />
|
|
93
|
+
<nd ref='-442275' />
|
|
94
|
+
<tag k='highway' v='steps' />
|
|
95
|
+
<tag k='name' v='w1' />
|
|
96
|
+
</way>
|
|
97
|
+
<way id='-441827' action='modify' visible='true'>
|
|
98
|
+
<nd ref='-442275' />
|
|
99
|
+
<nd ref='-442272' />
|
|
100
|
+
<tag k='highway' v='footway' />
|
|
101
|
+
<tag k='name' v='w1' />
|
|
102
|
+
</way>
|
|
103
|
+
<way id='-441828' action='modify' visible='true'>
|
|
104
|
+
<nd ref='-442279' />
|
|
105
|
+
<nd ref='-442276' />
|
|
106
|
+
<tag k='highway' v='footway' />
|
|
107
|
+
<tag k='name' v='w2' />
|
|
108
|
+
</way>
|
|
109
|
+
<way id='-441829' action='modify' visible='true'>
|
|
110
|
+
<nd ref='-442276' />
|
|
111
|
+
<nd ref='-442278' />
|
|
112
|
+
<tag k='highway' v='steps' />
|
|
113
|
+
<tag k='name' v='w2' />
|
|
114
|
+
</way>
|
|
115
|
+
<way id='-441830' action='modify' visible='true'>
|
|
116
|
+
<nd ref='-442278' />
|
|
117
|
+
<nd ref='-442277' />
|
|
118
|
+
<tag k='highway' v='footway' />
|
|
119
|
+
<tag k='name' v='w2' />
|
|
120
|
+
</way>
|
|
121
|
+
<way id='-441831' action='modify' visible='true'>
|
|
122
|
+
<nd ref='-442283' />
|
|
123
|
+
<nd ref='-442280' />
|
|
124
|
+
<tag k='highway' v='footway' />
|
|
125
|
+
<tag k='name' v='w3' />
|
|
126
|
+
</way>
|
|
127
|
+
<way id='-441832' action='modify' visible='true'>
|
|
128
|
+
<nd ref='-442280' />
|
|
129
|
+
<nd ref='-442282' />
|
|
130
|
+
<tag k='highway' v='steps' />
|
|
131
|
+
<tag k='incline' v='up' />
|
|
132
|
+
<tag k='name' v='w3' />
|
|
133
|
+
</way>
|
|
134
|
+
<way id='-441833' action='modify' visible='true'>
|
|
135
|
+
<nd ref='-442282' />
|
|
136
|
+
<nd ref='-442281' />
|
|
137
|
+
<tag k='highway' v='footway' />
|
|
138
|
+
<tag k='name' v='w3' />
|
|
139
|
+
</way>
|
|
140
|
+
<way id='-441834' action='modify' visible='true'>
|
|
141
|
+
<nd ref='-442287' />
|
|
142
|
+
<nd ref='-442284' />
|
|
143
|
+
<tag k='highway' v='footway' />
|
|
144
|
+
<tag k='name' v='w4' />
|
|
145
|
+
</way>
|
|
146
|
+
<way id='-441835' action='modify' visible='true'>
|
|
147
|
+
<nd ref='-442284' />
|
|
148
|
+
<nd ref='-442286' />
|
|
149
|
+
<tag k='highway' v='steps' />
|
|
150
|
+
<tag k='incline' v='down' />
|
|
151
|
+
<tag k='name' v='w4' />
|
|
152
|
+
</way>
|
|
153
|
+
<way id='-441836' action='modify' visible='true'>
|
|
154
|
+
<nd ref='-442286' />
|
|
155
|
+
<nd ref='-442285' />
|
|
156
|
+
<tag k='highway' v='footway' />
|
|
157
|
+
<tag k='name' v='w4' />
|
|
158
|
+
</way>
|
|
159
|
+
<way id='-441837' action='modify' visible='true'>
|
|
160
|
+
<nd ref='-442291' />
|
|
161
|
+
<nd ref='-442288' />
|
|
162
|
+
<tag k='highway' v='footway' />
|
|
163
|
+
<tag k='name' v='w5' />
|
|
164
|
+
</way>
|
|
165
|
+
<way id='-441838' action='modify' visible='true'>
|
|
166
|
+
<nd ref='-442290' />
|
|
167
|
+
<nd ref='-442288' />
|
|
168
|
+
<tag k='highway' v='steps' />
|
|
169
|
+
<tag k='incline' v='up' />
|
|
170
|
+
<tag k='name' v='w5' />
|
|
171
|
+
</way>
|
|
172
|
+
<way id='-441839' action='modify' visible='true'>
|
|
173
|
+
<nd ref='-442290' />
|
|
174
|
+
<nd ref='-442289' />
|
|
175
|
+
<tag k='highway' v='footway' />
|
|
176
|
+
<tag k='name' v='w5' />
|
|
177
|
+
</way>
|
|
178
|
+
<way id='-441840' action='modify' visible='true'>
|
|
179
|
+
<nd ref='-442295' />
|
|
180
|
+
<nd ref='-442292' />
|
|
181
|
+
<tag k='highway' v='footway' />
|
|
182
|
+
<tag k='name' v='w6' />
|
|
183
|
+
</way>
|
|
184
|
+
<way id='-441841' action='modify' visible='true'>
|
|
185
|
+
<nd ref='-442294' />
|
|
186
|
+
<nd ref='-442292' />
|
|
187
|
+
<tag k='highway' v='steps' />
|
|
188
|
+
<tag k='incline' v='down' />
|
|
189
|
+
<tag k='name' v='w6' />
|
|
190
|
+
</way>
|
|
191
|
+
<way id='-441842' action='modify' visible='true'>
|
|
192
|
+
<nd ref='-442294' />
|
|
193
|
+
<nd ref='-442293' />
|
|
194
|
+
<tag k='highway' v='footway' />
|
|
195
|
+
<tag k='name' v='w6' />
|
|
196
|
+
</way>
|
|
197
|
+
<way id='-441843' action='modify' visible='true'>
|
|
198
|
+
<nd ref='-442299' />
|
|
199
|
+
<nd ref='-442296' />
|
|
200
|
+
<tag k='highway' v='footway' />
|
|
201
|
+
<tag k='level' v='-1' />
|
|
202
|
+
<tag k='name' v='w7' />
|
|
203
|
+
</way>
|
|
204
|
+
<way id='-441844' action='modify' visible='true'>
|
|
205
|
+
<nd ref='-442296' />
|
|
206
|
+
<nd ref='-442298' />
|
|
207
|
+
<tag k='highway' v='steps' />
|
|
208
|
+
<tag k='incline' v='up' />
|
|
209
|
+
<tag k='level' v='-1;0' />
|
|
210
|
+
<tag k='name' v='w7' />
|
|
211
|
+
</way>
|
|
212
|
+
<way id='-441845' action='modify' visible='true'>
|
|
213
|
+
<nd ref='-442298' />
|
|
214
|
+
<nd ref='-442297' />
|
|
215
|
+
<tag k='highway' v='footway' />
|
|
216
|
+
<tag k='level' v='0' />
|
|
217
|
+
<tag k='name' v='w7' />
|
|
218
|
+
</way>
|
|
219
|
+
<way id='-441846' action='modify' visible='true'>
|
|
220
|
+
<nd ref='-442303' />
|
|
221
|
+
<nd ref='-442300' />
|
|
222
|
+
<tag k='highway' v='footway' />
|
|
223
|
+
<tag k='name' v='w8' />
|
|
224
|
+
</way>
|
|
225
|
+
<way id='-441847' action='modify' visible='true'>
|
|
226
|
+
<nd ref='-442300' />
|
|
227
|
+
<nd ref='-442304' />
|
|
228
|
+
<nd ref='-442302' />
|
|
229
|
+
<tag k='highway' v='steps' />
|
|
230
|
+
<tag k='name' v='w8' />
|
|
231
|
+
</way>
|
|
232
|
+
<way id='-441848' action='modify' visible='true'>
|
|
233
|
+
<nd ref='-442302' />
|
|
234
|
+
<nd ref='-442301' />
|
|
235
|
+
<tag k='highway' v='footway' />
|
|
236
|
+
<tag k='name' v='w8' />
|
|
237
|
+
</way>
|
|
238
|
+
<way id='-441849' action='modify' visible='true'>
|
|
239
|
+
<nd ref='-442307' />
|
|
240
|
+
<nd ref='-442309' />
|
|
241
|
+
<nd ref='-442305' />
|
|
242
|
+
<tag k='highway' v='steps' />
|
|
243
|
+
<tag k='incline' v='up' />
|
|
244
|
+
<tag k='level' v='-1;0' />
|
|
245
|
+
<tag k='name' v='w9' />
|
|
246
|
+
</way>
|
|
247
|
+
<way id='-441850' action='modify' visible='true'>
|
|
248
|
+
<nd ref='-442306' />
|
|
249
|
+
<nd ref='-442307' />
|
|
250
|
+
<tag k='highway' v='footway' />
|
|
251
|
+
<tag k='level' v='-1' />
|
|
252
|
+
<tag k='name' v='w9' />
|
|
253
|
+
</way>
|
|
254
|
+
<way id='-441851' action='modify' visible='true'>
|
|
255
|
+
<nd ref='-442305' />
|
|
256
|
+
<nd ref='-442308' />
|
|
257
|
+
<tag k='highway' v='footway' />
|
|
258
|
+
<tag k='level' v='0' />
|
|
259
|
+
<tag k='name' v='w9' />
|
|
260
|
+
</way>
|
|
261
|
+
<way id='-441852' action='modify' visible='true'>
|
|
262
|
+
<nd ref='-442312' />
|
|
263
|
+
<nd ref='-442310' />
|
|
264
|
+
<tag k='highway' v='steps' />
|
|
265
|
+
<tag k='incline' v='down' />
|
|
266
|
+
<tag k='level' v='-1;0' />
|
|
267
|
+
<tag k='name' v='w10' />
|
|
268
|
+
</way>
|
|
269
|
+
<way id='-441853' action='modify' visible='true'>
|
|
270
|
+
<nd ref='-442311' />
|
|
271
|
+
<nd ref='-442312' />
|
|
272
|
+
<tag k='highway' v='footway' />
|
|
273
|
+
<tag k='level' v='-1' />
|
|
274
|
+
<tag k='name' v='w10' />
|
|
275
|
+
</way>
|
|
276
|
+
<way id='-441854' action='modify' visible='true'>
|
|
277
|
+
<nd ref='-442310' />
|
|
278
|
+
<nd ref='-442313' />
|
|
279
|
+
<tag k='highway' v='footway' />
|
|
280
|
+
<tag k='level' v='0' />
|
|
281
|
+
<tag k='name' v='w10' />
|
|
282
|
+
</way>
|
|
283
|
+
</osm>
|
package/dist/index.js
CHANGED
|
@@ -17,11 +17,13 @@ class OsmElement {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
class OsmModel {
|
|
20
|
-
constructor(nodes, ways) {
|
|
20
|
+
constructor(nodes, ways, relations) {
|
|
21
21
|
__publicField(this, "nodes");
|
|
22
22
|
__publicField(this, "ways");
|
|
23
|
+
__publicField(this, "relations");
|
|
23
24
|
this.nodes = nodes || [];
|
|
24
25
|
this.ways = ways || [];
|
|
26
|
+
this.relations = relations || [];
|
|
25
27
|
}
|
|
26
28
|
getNodeById(id) {
|
|
27
29
|
return this.nodes.find((node) => node.id === id) || null;
|
|
@@ -35,12 +37,19 @@ class OsmModel {
|
|
|
35
37
|
getWayByName(name) {
|
|
36
38
|
return this.ways.find((way) => way.tags.name === name) || null;
|
|
37
39
|
}
|
|
40
|
+
getRelationById(id) {
|
|
41
|
+
return this.relations.find((way) => way.id === id) || null;
|
|
42
|
+
}
|
|
43
|
+
getRelationByName(name) {
|
|
44
|
+
return this.relations.find((way) => way.tags.name === name) || null;
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
class OsmNode extends OsmElement {
|
|
40
48
|
constructor(id, coords, tags) {
|
|
41
49
|
super(id, tags);
|
|
42
50
|
__publicField(this, "coords");
|
|
43
51
|
__publicField(this, "ways", []);
|
|
52
|
+
__publicField(this, "relations", []);
|
|
44
53
|
this.coords = coords;
|
|
45
54
|
}
|
|
46
55
|
get isElevator() {
|
|
@@ -54,6 +63,7 @@ class OsmWay extends OsmElement {
|
|
|
54
63
|
constructor(id, tags, level = null) {
|
|
55
64
|
super(id, tags);
|
|
56
65
|
__publicField(this, "nodes", []);
|
|
66
|
+
__publicField(this, "relations", []);
|
|
57
67
|
__publicField(this, "level", null);
|
|
58
68
|
this.level = level;
|
|
59
69
|
}
|
|
@@ -76,6 +86,31 @@ class OsmWay extends OsmElement {
|
|
|
76
86
|
return this.nodes[0] === this.nodes[this.nodes.length - 1];
|
|
77
87
|
}
|
|
78
88
|
}
|
|
89
|
+
class OsmRelation extends OsmElement {
|
|
90
|
+
constructor(id, members = [], tags) {
|
|
91
|
+
super(id, tags);
|
|
92
|
+
__publicField(this, "relations", []);
|
|
93
|
+
this.members = members;
|
|
94
|
+
}
|
|
95
|
+
isMultipolygon() {
|
|
96
|
+
return this.tags.type === "multipolygon";
|
|
97
|
+
}
|
|
98
|
+
getGeoJsonPolygon() {
|
|
99
|
+
if (!this.isMultipolygon())
|
|
100
|
+
return null;
|
|
101
|
+
const outer = this.members.find((member) => member.ref instanceof OsmWay && member.role === "outer");
|
|
102
|
+
if (!outer)
|
|
103
|
+
return null;
|
|
104
|
+
const inners = this.members.filter((member) => member.ref instanceof OsmWay && member.role === "inner");
|
|
105
|
+
return {
|
|
106
|
+
type: "Polygon",
|
|
107
|
+
coordinates: [outer, ...inners].map((member) => {
|
|
108
|
+
const way = member.ref;
|
|
109
|
+
return way.nodes.map((node) => [node.coords.lng, node.coords.lat]);
|
|
110
|
+
})
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
79
114
|
class OsmParser {
|
|
80
115
|
static parseOsmXmlString(osmXmlString) {
|
|
81
116
|
const model = new OsmModel();
|
|
@@ -104,6 +139,16 @@ class OsmParser {
|
|
|
104
139
|
model.ways.push(osmWay);
|
|
105
140
|
break;
|
|
106
141
|
}
|
|
142
|
+
case "relation": {
|
|
143
|
+
if (isDeleted(node)) {
|
|
144
|
+
buffer = null;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
const osmRelation = this._parseRelation(node.attributes);
|
|
148
|
+
buffer = osmRelation;
|
|
149
|
+
model.relations.push(osmRelation);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
107
152
|
case "tag": {
|
|
108
153
|
if (!buffer) {
|
|
109
154
|
return;
|
|
@@ -128,6 +173,23 @@ class OsmParser {
|
|
|
128
173
|
refNode.ways.push(buffer);
|
|
129
174
|
break;
|
|
130
175
|
}
|
|
176
|
+
case "member": {
|
|
177
|
+
if (!buffer || !(buffer instanceof OsmRelation)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const memberId = Number(node.attributes.ref);
|
|
181
|
+
const memberType = node.attributes.type;
|
|
182
|
+
let refElement = null;
|
|
183
|
+
memberType === "node" && (refElement = model.getNodeById(memberId));
|
|
184
|
+
memberType === "way" && (refElement = model.getWayById(memberId));
|
|
185
|
+
memberType === "relation" && (refElement = model.getRelationById(memberId));
|
|
186
|
+
if (!refElement) {
|
|
187
|
+
throw Error("Member: " + memberId + " in relation " + buffer.id + " not found");
|
|
188
|
+
}
|
|
189
|
+
buffer.members.push({ ref: refElement, role: node.attributes.role });
|
|
190
|
+
refElement.relations.push(buffer);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
131
193
|
}
|
|
132
194
|
});
|
|
133
195
|
parser.write(osmXmlString);
|
|
@@ -148,152 +210,14 @@ class OsmParser {
|
|
|
148
210
|
static _parseWay(attr) {
|
|
149
211
|
return new OsmWay(Number(attr.id));
|
|
150
212
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
class OsmGraphNode extends geo.GraphEdge {
|
|
155
|
-
}
|
|
156
|
-
class OsmGraphItinerary extends geo.GraphItinerary {
|
|
157
|
-
static fromNetworkNodes(start, end, networkNodes, edgesWeights) {
|
|
158
|
-
return super.fromNetworkNodes(start, end, networkNodes, edgesWeights);
|
|
213
|
+
static _parseRelation(attr) {
|
|
214
|
+
return new OsmRelation(Number(attr.id));
|
|
159
215
|
}
|
|
160
216
|
}
|
|
161
|
-
class OsmNetwork extends geo.Network {
|
|
162
|
-
static fromCoordinates(segments) {
|
|
163
|
-
return super.fromCoordinates(segments);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
class OsmGraphProjection extends geo.GraphProjection {
|
|
167
|
-
}
|
|
168
|
-
class OsmGraphRouter extends geo.GraphRouter {
|
|
169
|
-
}
|
|
170
|
-
class OsmGraphRouterOptions extends geo.GraphRouterOptions {
|
|
171
|
-
}
|
|
172
|
-
class OsmMapMatching extends geo.MapMatching {
|
|
173
|
-
}
|
|
174
|
-
const HIGHWAYS_PEDESTRIANS = ["footway", "steps", "pedestrian", "living_street", "path", "track", "sidewalk", "elevator"];
|
|
175
|
-
const DEFAULT_WAY_SELECTOR = (way) => {
|
|
176
|
-
return HIGHWAYS_PEDESTRIANS.includes(way.tags.highway) || way.tags.footway === "sidewalk" || way.tags.public_transport === "platform" || way.tags.railway === "platform";
|
|
177
|
-
};
|
|
178
|
-
function getNodeByName(network, name) {
|
|
179
|
-
return network.nodes.find(({ builtFrom }) => (builtFrom == null ? void 0 : builtFrom.tags.name) === name);
|
|
180
|
-
}
|
|
181
|
-
function getEdgeByName(network, name) {
|
|
182
|
-
return network.edges.find(({ builtFrom }) => (builtFrom == null ? void 0 : builtFrom.tags.name) === name);
|
|
183
|
-
}
|
|
184
|
-
function manageOneWay(edge, way) {
|
|
185
|
-
const { highway, oneway, conveying } = way.tags;
|
|
186
|
-
edge.isOneway = Boolean(oneway === "yes" || oneway === "true" || oneway === "1" || conveying && highway && ["forward", "backward"].includes(conveying));
|
|
187
|
-
if (edge.isOneway && conveying === "backward") {
|
|
188
|
-
const tmpNode = edge.node1;
|
|
189
|
-
edge.node1 = edge.node2;
|
|
190
|
-
edge.node2 = tmpNode;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
function createNodesAndEdgesFromElevator(nodes, edges, elevatorNode) {
|
|
194
|
-
const createdNodes = [];
|
|
195
|
-
const getOrCreateLevelNode = (level, builtFrom) => {
|
|
196
|
-
let levelNode = createdNodes.find(({ coords }) => geo.Level.equals(level, coords.level));
|
|
197
|
-
if (!levelNode) {
|
|
198
|
-
levelNode = new OsmGraphNode$1(elevatorNode.coords.clone(), builtFrom);
|
|
199
|
-
levelNode.coords.level = level;
|
|
200
|
-
createdNodes.push(levelNode);
|
|
201
|
-
nodes.push(levelNode);
|
|
202
|
-
}
|
|
203
|
-
return levelNode;
|
|
204
|
-
};
|
|
205
|
-
elevatorNode.edges.forEach((edge) => {
|
|
206
|
-
if (geo.Level.isRange(edge.level)) {
|
|
207
|
-
throw new Error("Cannot handle this elevator edge due to ambiguity");
|
|
208
|
-
}
|
|
209
|
-
const levelNode = getOrCreateLevelNode(edge.level, elevatorNode.builtFrom);
|
|
210
|
-
if (edge.node1 === elevatorNode) {
|
|
211
|
-
edge.node1 = levelNode;
|
|
212
|
-
} else {
|
|
213
|
-
edge.node2 = levelNode;
|
|
214
|
-
}
|
|
215
|
-
levelNode.edges.push(edge);
|
|
216
|
-
});
|
|
217
|
-
for (let i = 0; i < createdNodes.length; i++) {
|
|
218
|
-
for (let j = i + 1; j < createdNodes.length; j++) {
|
|
219
|
-
const createdNode1 = createdNodes[i];
|
|
220
|
-
const createdNode2 = createdNodes[j];
|
|
221
|
-
if (createdNode1.coords.level === null || createdNode2.coords.level === null) {
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
const minLevel = Math.min(createdNode1.coords.level, createdNode2.coords.level);
|
|
225
|
-
const maxLevel = Math.max(createdNode1.coords.level, createdNode2.coords.level);
|
|
226
|
-
const newEdge = new OsmGraphNode(
|
|
227
|
-
createdNode1,
|
|
228
|
-
createdNode2,
|
|
229
|
-
[minLevel, maxLevel],
|
|
230
|
-
elevatorNode.builtFrom
|
|
231
|
-
);
|
|
232
|
-
edges.push(newEdge);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
const elevatorNodeIndex = nodes.indexOf(elevatorNode);
|
|
236
|
-
if (elevatorNodeIndex > -1) {
|
|
237
|
-
nodes.splice(elevatorNodeIndex, 1);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
function createNetworkFromOsmModel(osmModel, waySelectionFilter = DEFAULT_WAY_SELECTOR) {
|
|
241
|
-
const nodes = [];
|
|
242
|
-
const edges = [];
|
|
243
|
-
const nodesCreated = {};
|
|
244
|
-
const elevatorNodes = [];
|
|
245
|
-
const getOrCreateNode = (osmNode) => {
|
|
246
|
-
let node = nodesCreated[osmNode.id];
|
|
247
|
-
if (!node) {
|
|
248
|
-
node = new OsmGraphNode$1(osmNode.coords, osmNode);
|
|
249
|
-
nodesCreated[osmNode.id] = node;
|
|
250
|
-
nodes.push(node);
|
|
251
|
-
if (osmNode.tags.highway === "elevator") {
|
|
252
|
-
elevatorNodes.push(node);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return node;
|
|
256
|
-
};
|
|
257
|
-
osmModel.ways.forEach((way) => {
|
|
258
|
-
if (!waySelectionFilter(way)) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
let firstNode = getOrCreateNode(way.nodes[0]);
|
|
262
|
-
for (let i = 1; i < way.nodes.length; i++) {
|
|
263
|
-
const secondNode = getOrCreateNode(way.nodes[i]);
|
|
264
|
-
const edge = new OsmGraphNode(firstNode, secondNode, way.level, way);
|
|
265
|
-
manageOneWay(edge, way);
|
|
266
|
-
edges.push(edge);
|
|
267
|
-
firstNode = secondNode;
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
elevatorNodes.forEach((node) => {
|
|
271
|
-
createNodesAndEdgesFromElevator(nodes, edges, node);
|
|
272
|
-
});
|
|
273
|
-
const networkModel = new OsmNetwork(nodes, edges);
|
|
274
|
-
OsmGraphNode$1.generateNodesLevels(networkModel.nodes);
|
|
275
|
-
return networkModel;
|
|
276
|
-
}
|
|
277
|
-
const OsmNetworkUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
278
|
-
__proto__: null,
|
|
279
|
-
HIGHWAYS_PEDESTRIANS,
|
|
280
|
-
DEFAULT_WAY_SELECTOR,
|
|
281
|
-
getNodeByName,
|
|
282
|
-
getEdgeByName,
|
|
283
|
-
createNetworkFromOsmModel
|
|
284
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
285
217
|
exports.OsmElement = OsmElement;
|
|
286
|
-
exports.OsmGraphEdge = OsmGraphNode;
|
|
287
|
-
exports.OsmGraphItinerary = OsmGraphItinerary;
|
|
288
|
-
exports.OsmGraphNode = OsmGraphNode$1;
|
|
289
|
-
exports.OsmGraphProjection = OsmGraphProjection;
|
|
290
|
-
exports.OsmGraphRouter = OsmGraphRouter;
|
|
291
|
-
exports.OsmGraphRouterOptions = OsmGraphRouterOptions;
|
|
292
|
-
exports.OsmMapMatching = OsmMapMatching;
|
|
293
218
|
exports.OsmModel = OsmModel;
|
|
294
|
-
exports.OsmNetwork = OsmNetwork;
|
|
295
|
-
exports.OsmNetworkUtils = OsmNetworkUtils;
|
|
296
219
|
exports.OsmNode = OsmNode;
|
|
297
220
|
exports.OsmParser = OsmParser;
|
|
221
|
+
exports.OsmRelation = OsmRelation;
|
|
298
222
|
exports.OsmWay = OsmWay;
|
|
299
223
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/OsmElement.ts","../src/OsmModel.ts","../src/OsmNode.ts","../src/OsmWay.ts","../src/OsmParser.ts","../src/graph/OsmGraphNode.ts","../src/graph/OsmGraphEdge.ts","../src/graph/OsmGraphItinerary.ts","../src/graph/OsmNetwork.ts","../src/graph/OsmGraphProjection.ts","../src/graph/OsmGraphRouter.ts","../src/graph/OsmGraphRouterOptions.ts","../src/graph/OsmMapMatching.ts","../src/graph/OsmNetworkUtils.ts"],"sourcesContent":["\nexport type OsmTags = { [key: string]: string };\n\nclass OsmElement {\n\n id: number;\n tags: OsmTags;\n\n constructor(id: number, tags?: OsmTags) {\n this.id = id;\n this.tags = tags || {};\n }\n}\n\nexport default OsmElement;\n","import OsmNode from './OsmNode.js';\nimport OsmWay from './OsmWay.js';\n\nclass OsmModel {\n\n nodes: OsmNode[];\n ways: OsmWay[];\n\n constructor(nodes?: OsmNode[], ways?: OsmWay[]) {\n this.nodes = nodes || [];\n this.ways = ways || [];\n }\n\n getNodeById(id: number) {\n return this.nodes.find(node => node.id === id) || null;\n }\n\n getNodeByName(name: string) {\n return this.nodes.find(node => node.tags.name === name) || null;\n }\n\n getWayById(id: number) {\n return this.ways.find(way => way.id === id) || null;\n }\n\n getWayByName(name: string) {\n return this.ways.find(way => way.tags.name === name) || null;\n }\n\n}\n\nexport default OsmModel;\n","import { Coordinates } from '@wemap/geo';\n\nimport OsmElement, { OsmTags } from './OsmElement.js';\nimport OsmWay from './OsmWay.js';\n\nclass OsmNode extends OsmElement {\n\n coords : Coordinates;\n ways: OsmWay[] = [];\n\n\n constructor(id: number, coords: Coordinates, tags?: OsmTags) {\n super(id, tags);\n this.coords = coords;\n }\n\n get isElevator() {\n return this.tags.highway === 'elevator';\n }\n\n get isConveying() {\n return this.isElevator;\n }\n}\n\nexport default OsmNode;\n","import { Level_t } from '@wemap/geo';\nimport OsmElement, { OsmTags } from './OsmElement.js';\nimport OsmNode from './OsmNode.js';\n\nclass OsmWay extends OsmElement {\n\n nodes: OsmNode[] = [];\n level: Level_t = null;\n\n constructor(id: number, tags?: OsmTags, level: Level_t = null) {\n super(id, tags);\n this.level = level;\n }\n\n get areStairs() {\n return this.tags.highway === 'steps';\n }\n\n get isConveying() {\n return this.tags.hasOwnProperty('conveying');\n }\n\n get isEscalator() {\n return this.areStairs && this.isConveying;\n }\n\n get isMovingWalkway() {\n return !this.areStairs && this.isConveying;\n }\n\n get isElevator() {\n return this.tags.highway === 'elevator';\n }\n\n get isArea() {\n // That is not the real definition for OSM\n return this.nodes[0] === this.nodes[this.nodes.length - 1];\n }\n}\n\nexport default OsmWay;\n","/* eslint-disable max-statements */\nimport { SaxesParser } from 'saxes';\n\nimport {\n Level, Coordinates\n} from '@wemap/geo';\n\nimport OsmModel from './OsmModel.js';\nimport OsmNode from './OsmNode.js';\nimport OsmWay from './OsmWay.js';\n\ntype OsmXmlElement = { action?: 'delete' };\ntype OsmXmlNode = { id: string, lat: string, lon: string } & OsmXmlElement;\ntype OsmXmlWay = { id: string } & OsmXmlElement;\n\nclass OsmParser {\n\n static parseOsmXmlString(osmXmlString: string) {\n\n const model = new OsmModel();\n const parser = new SaxesParser();\n\n let buffer: OsmNode | OsmWay | null;\n\n const isDeleted = (element: { attributes: OsmXmlElement }) =>\n element.attributes.action && element.attributes.action === 'delete';\n\n parser.on('opentag', (node) => {\n\n switch (node.name) {\n case 'node': {\n if (isDeleted(node)) {\n buffer = null;\n break;\n }\n const osmNode = this._parseNode(node.attributes as OsmXmlNode);\n buffer = osmNode;\n model.nodes.push(osmNode);\n break;\n }\n case 'way': {\n if (isDeleted(node)) {\n buffer = null;\n break;\n }\n const osmWay = this._parseWay(node.attributes as OsmXmlWay);\n buffer = osmWay;\n model.ways.push(osmWay);\n break;\n }\n case 'tag': {\n if (!buffer) {\n return;\n }\n const {\n k, v\n } = node.attributes;\n buffer.tags[k] = v;\n break;\n }\n case 'nd': {\n if (!buffer || !(buffer instanceof OsmWay)) {\n return;\n }\n const nodeId = Number(node.attributes.ref);\n const refNode = model.getNodeById(nodeId);\n if (!refNode) {\n throw Error('Node: ' + nodeId + ' in way ' + buffer.id + ' not found');\n }\n\n buffer.nodes.push(refNode);\n refNode.ways.push(buffer);\n break;\n }\n }\n });\n\n parser.write(osmXmlString);\n\n for (let i = 0; i < model.ways.length; i++) {\n const way = model.ways[i];\n if (way.tags.level) {\n way.level = Level.fromString(way.tags.level);\n }\n }\n\n return model;\n }\n\n\n static _parseNode(attr: OsmXmlNode) {\n return new OsmNode(\n Number(attr.id),\n new Coordinates(Number(attr.lat), Number(attr.lon)));\n }\n\n static _parseWay(attr: { id: string }) {\n return new OsmWay(Number(attr.id));\n }\n}\n\nexport default OsmParser;\n","import { GraphNode } from \"@wemap/geo\";\nimport OsmNode from \"../OsmNode\";\nimport OsmWay from \"../OsmWay\";\n\nexport default class OsmGraphNode extends GraphNode<OsmNode, OsmNode | OsmWay>{ }","import { GraphEdge } from \"@wemap/geo\";\nimport OsmNode from \"../OsmNode\";\nimport OsmWay from \"../OsmWay\";\n\nexport default class OsmGraphNode extends GraphEdge<OsmNode | OsmWay, OsmNode>{ }","import { Coordinates, GraphItinerary, GraphNode } from '@wemap/geo';\n\nimport { N, E } from './OsmNetworkUtils.js';\n\nexport default class OsmGraphItinerary extends GraphItinerary<N, E>{ \n\n static fromNetworkNodes<A = N, B = E>(\n start: Coordinates, end: Coordinates,\n networkNodes: GraphNode<A, B>[], edgesWeights: number[]\n ) {\n return super.fromNetworkNodes(start, end, networkNodes, edgesWeights) as GraphItinerary<A, B>;\n }\n}\n","import { Coordinates, Network } from '@wemap/geo';\n\nimport { N, E } from './OsmNetworkUtils.js';\n\nexport default class OsmNetwork extends Network<N, E>{\n static fromCoordinates<A = N, B = E>(segments: Coordinates[][]) {\n return super.fromCoordinates<N, E>(segments) as Network<A, B>;\n }\n}","import { GraphProjection } from '@wemap/geo';\n\nimport { N, E } from './OsmNetworkUtils.js';\n\nexport default class OsmGraphProjection extends GraphProjection<N, E>{ }\n","import { GraphRouter } from '@wemap/geo';\n\nimport { N, E } from './OsmNetworkUtils.js';\n\nexport default class OsmGraphRouter extends GraphRouter<N, E>{ }\n","import { GraphRouterOptions } from '@wemap/geo';\n\nimport { N, E } from './OsmNetworkUtils.js';\n\nexport default class OsmGraphRouterOptions extends GraphRouterOptions<N, E>{ }\n","import { MapMatching } from '@wemap/geo';\n\nimport { N, E } from './OsmNetworkUtils.js';\n\nexport default class OsmMapMatching extends MapMatching<N, E>{ }\n","import { Level } from '@wemap/geo';\nimport OsmGraphNode from './OsmGraphNode';\nimport OsmGraphEdge from './OsmGraphEdge';\nimport OsmModel from '../OsmModel';\nimport OsmNode from '../OsmNode';\nimport OsmWay from '../OsmWay';\nimport OsmNetwork from './OsmNetwork';\n\nexport type N = OsmNode;\nexport type E = OsmNode | OsmWay;\n\nexport const HIGHWAYS_PEDESTRIANS = ['footway', 'steps', 'pedestrian', 'living_street', 'path', 'track', 'sidewalk', 'elevator'];\n\nexport const DEFAULT_WAY_SELECTOR = (way: OsmWay) => {\n return HIGHWAYS_PEDESTRIANS.includes(way.tags.highway)\n || way.tags.footway === 'sidewalk'\n || way.tags.public_transport === 'platform'\n || way.tags.railway === 'platform';\n};\n\nexport function getNodeByName(network: OsmNetwork, name: string) {\n return network.nodes.find(({ builtFrom }) => builtFrom?.tags.name === name);\n}\n\nexport function getEdgeByName(network: OsmNetwork, name: string) {\n return network.edges.find(({ builtFrom }) => builtFrom?.tags.name === name);\n}\n\nfunction manageOneWay(edge: OsmGraphEdge, way: OsmWay) {\n\n const { highway, oneway, conveying } = way.tags;\n\n edge.isOneway = Boolean((oneway === 'yes' || oneway === 'true' || oneway === '1')\n || (conveying && highway && ['forward', 'backward'].includes(conveying)));\n\n if (edge.isOneway && conveying === 'backward') {\n const tmpNode = edge.node1;\n edge.node1 = edge.node2;\n edge.node2 = tmpNode;\n }\n}\n\n\nfunction createNodesAndEdgesFromElevator(\n nodes: OsmGraphNode[],\n edges: OsmGraphEdge[],\n elevatorNode: OsmGraphNode\n) {\n\n const createdNodes: OsmGraphNode[] = [];\n const getOrCreateLevelNode = (level: number | null, builtFrom: N | null) => {\n let levelNode = createdNodes.find(({ coords }) => Level.equals(level, coords.level));\n if (!levelNode) {\n levelNode = new OsmGraphNode(elevatorNode.coords.clone(), builtFrom);\n levelNode.coords.level = level;\n createdNodes.push(levelNode);\n nodes.push(levelNode);\n }\n return levelNode;\n };\n\n // Create nodes from node.edges\n elevatorNode.edges.forEach(edge => {\n if (Level.isRange(edge.level)) {\n throw new Error('Cannot handle this elevator edge due to ambiguity');\n }\n\n const levelNode = getOrCreateLevelNode(edge.level, elevatorNode.builtFrom);\n if (edge.node1 === elevatorNode) {\n edge.node1 = levelNode;\n } else {\n edge.node2 = levelNode;\n }\n levelNode.edges.push(edge);\n });\n\n // Create edges from createdNodes\n for (let i = 0; i < createdNodes.length; i++) {\n for (let j = i + 1; j < createdNodes.length; j++) {\n\n const createdNode1 = createdNodes[i];\n const createdNode2 = createdNodes[j];\n\n if (createdNode1.coords.level === null || createdNode2.coords.level === null) {\n // TODO: not the best approach... but cannot do better with [number, number] range for levels\n continue;\n }\n\n const minLevel = Math.min(createdNode1.coords.level as number, createdNode2.coords.level as number);\n const maxLevel = Math.max(createdNode1.coords.level as number, createdNode2.coords.level as number);\n\n const newEdge = new OsmGraphEdge(\n createdNode1,\n createdNode2,\n [minLevel, maxLevel],\n elevatorNode.builtFrom\n );\n edges.push(newEdge);\n }\n }\n\n // Remove the historical elevator node from the network\n const elevatorNodeIndex = nodes.indexOf(elevatorNode);\n if (elevatorNodeIndex > -1) {\n nodes.splice(elevatorNodeIndex, 1);\n }\n}\n\nexport function createNetworkFromOsmModel(\n osmModel: OsmModel,\n waySelectionFilter = DEFAULT_WAY_SELECTOR\n) {\n\n const nodes: OsmGraphNode[] = [];\n const edges: OsmGraphEdge[] = [];\n\n const nodesCreated: { [key: number]: OsmGraphNode } = {};\n const elevatorNodes: OsmGraphNode[] = [];\n\n const getOrCreateNode = (osmNode: OsmNode) => {\n let node = nodesCreated[osmNode.id];\n if (!node) {\n node = new OsmGraphNode(osmNode.coords, osmNode);\n nodesCreated[osmNode.id] = node;\n nodes.push(node);\n\n if (osmNode.tags.highway === 'elevator') {\n elevatorNodes.push(node);\n }\n }\n return node;\n };\n\n osmModel.ways.forEach(way => {\n if (!waySelectionFilter(way)) {\n return;\n }\n\n let firstNode = getOrCreateNode(way.nodes[0]);\n for (let i = 1; i < way.nodes.length; i++) {\n const secondNode = getOrCreateNode(way.nodes[i]);\n\n const edge = new OsmGraphEdge(firstNode, secondNode, way.level, way);\n manageOneWay(edge, way);\n edges.push(edge);\n firstNode = secondNode;\n }\n\n });\n\n elevatorNodes.forEach(node => {\n // We have to clone this node for each connected edge\n createNodesAndEdgesFromElevator(nodes, edges, node);\n });\n\n const networkModel = new OsmNetwork(nodes, edges);\n\n OsmGraphNode.generateNodesLevels(networkModel.nodes);\n\n return networkModel;\n}\n\n\n// /**\n// * @param {GraphNode} node\n// * @param {object} tags\n// */\n// static _applyNodePropertiesFromTags(node, tags) {\n// node.name = tags.name || null;\n// node.subwayEntrance = tags.railway === 'subway_entrance';\n// if (node.subwayEntrance && tags.ref) {\n// node.subwayEntranceRef = tags.ref;\n// }\n// }\n\n// /**\n// * @param {GraphEdge} edge\n// * @param {object} tags\n// */\n// static _applyEdgePropertiesFromTags(edge, tags) {\n// const { highway, oneway, conveying, name } = tags;\n// edge.name = name || null;\n// edge.isStairs = highway === 'steps';\n// edge.isConveying = 'conveying' in tags;\n// edge.isOneway = Boolean((oneway === 'yes' || oneway === 'true' || oneway === '1')\n// || (conveying && highway && ['yes', 'forward', 'backward'].includes(conveying)));\n\n// if (conveying === 'backward') {\n// const tmpNode = edge.node1;\n// edge.node1 = edge.node2;\n// edge.node2 = tmpNode;\n// }\n\n// }\n"],"names":["SaxesParser","Level","Coordinates","OsmGraphNode","GraphNode","GraphEdge","GraphItinerary","Network","GraphProjection","GraphRouter","GraphRouterOptions","MapMatching","OsmGraphEdge"],"mappings":";;;;;;;;;;AAGA,MAAM,WAAW;AAAA,EAKb,YAAY,IAAY,MAAgB;AAHxC;AACA;AAGI,SAAK,KAAK;AACL,SAAA,OAAO,QAAQ;EACxB;AACJ;ACTA,MAAM,SAAS;AAAA,EAKX,YAAY,OAAmB,MAAiB;AAHhD;AACA;AAGS,SAAA,QAAQ,SAAS;AACjB,SAAA,OAAO,QAAQ;EACxB;AAAA,EAEA,YAAY,IAAY;AACpB,WAAO,KAAK,MAAM,KAAK,UAAQ,KAAK,OAAO,EAAE,KAAK;AAAA,EACtD;AAAA,EAEA,cAAc,MAAc;AACjB,WA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,MAAM,QAAQ,KAAK;AACvC,YAAM,aAAa,gBAAgB,IAAI,MAAM,EAAE;AAE/C,YAAM,OAAO,IAAIS,aAAa,WAAW,YAAY,IAAI,OAAO,GAAG;AACnE,mBAAa,MAAM,GAAG;AACtB,YAAM,KAAK,IAAI;AACH,kBAAA;AAAA,IAChB;AAAA,EAAA,CAEH;AAED,gBAAc,QAAQ,CAAQ,SAAA;AAEM,oCAAA,OAAO,OAAO,IAAI;AAAA,EAAA,CACrD;AAED,QAAM,eAAe,IAAI,WAAW,OAAO,KAAK;AAEnCT,iBAAA,oBAAoB,aAAa,KAAK;AAE5C,SAAA;AACX;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/OsmElement.ts","../src/OsmModel.ts","../src/OsmNode.ts","../src/OsmWay.ts","../src/OsmRelation.ts","../src/OsmParser.ts"],"sourcesContent":["\nexport type OsmTags = { [key: string]: string };\n\nclass OsmElement {\n\n id: number;\n tags: OsmTags;\n\n constructor(id: number, tags?: OsmTags) {\n this.id = id;\n this.tags = tags || {};\n }\n}\n\nexport default OsmElement;\n","import OsmNode from './OsmNode.js';\nimport OsmRelation from './OsmRelation.js';\nimport OsmWay from './OsmWay.js';\n\nclass OsmModel {\n\n nodes: OsmNode[];\n ways: OsmWay[];\n relations: OsmRelation[];\n\n constructor(nodes?: OsmNode[], ways?: OsmWay[], relations?: OsmRelation[]) {\n this.nodes = nodes || [];\n this.ways = ways || [];\n this.relations = relations || [];\n }\n\n getNodeById(id: number) {\n return this.nodes.find(node => node.id === id) || null;\n }\n\n getNodeByName(name: string) {\n return this.nodes.find(node => node.tags.name === name) || null;\n }\n\n getWayById(id: number) {\n return this.ways.find(way => way.id === id) || null;\n }\n\n getWayByName(name: string) {\n return this.ways.find(way => way.tags.name === name) || null;\n }\n\n getRelationById(id: number) {\n return this.relations.find(way => way.id === id) || null;\n }\n\n getRelationByName(name: string) {\n return this.relations.find(way => way.tags.name === name) || null;\n }\n}\n\nexport default OsmModel;\n","import { Coordinates } from '@wemap/geo';\n\nimport OsmElement, { OsmTags } from './OsmElement.js';\nimport OsmRelation from './OsmRelation.js';\nimport OsmWay from './OsmWay.js';\n\nclass OsmNode extends OsmElement {\n\n coords : Coordinates;\n ways: OsmWay[] = [];\n relations: OsmRelation[] = [];\n\n constructor(id: number, coords: Coordinates, tags?: OsmTags) {\n super(id, tags);\n this.coords = coords;\n }\n\n get isElevator() {\n return this.tags.highway === 'elevator';\n }\n\n get isConveying() {\n return this.isElevator;\n }\n}\n\nexport default OsmNode;\n","import { Level_t } from '@wemap/geo';\nimport OsmElement, { OsmTags } from './OsmElement.js';\nimport OsmNode from './OsmNode.js';\nimport OsmRelation from './OsmRelation.js';\n\nclass OsmWay extends OsmElement {\n\n nodes: OsmNode[] = [];\n relations: OsmRelation[] = [];\n level: Level_t = null;\n\n constructor(id: number, tags?: OsmTags, level: Level_t = null) {\n super(id, tags);\n this.level = level;\n }\n\n get areStairs() {\n return this.tags.highway === 'steps';\n }\n\n get isConveying() {\n return this.tags.hasOwnProperty('conveying');\n }\n\n get isEscalator() {\n return this.areStairs && this.isConveying;\n }\n\n get isMovingWalkway() {\n return !this.areStairs && this.isConveying;\n }\n\n get isElevator() {\n return this.tags.highway === 'elevator';\n }\n\n get isArea() {\n // That is not the real definition for OSM\n return this.nodes[0] === this.nodes[this.nodes.length - 1];\n }\n}\n\nexport default OsmWay;\n","import OsmElement, { OsmTags } from './OsmElement.js';\nimport OsmNode from './OsmNode.js';\nimport OsmWay from './OsmWay.js';\nimport type { Position, Polygon } from 'geojson';\n\nexport type OsmRelationMember = {\n ref: OsmRelation | OsmWay | OsmNode,\n role: string\n}\n\nclass OsmRelation extends OsmElement {\n\n relations: OsmRelation[] = [];\n\n constructor(\n id: number,\n public members: OsmRelationMember[] = [],\n tags?: OsmTags\n ) {\n super(id, tags);\n }\n\n isMultipolygon() {\n return this.tags.type === 'multipolygon';\n }\n\n getGeoJsonPolygon(): Polygon | null {\n if (!this.isMultipolygon()) return null;\n const outer = this.members.find(member => member.ref instanceof OsmWay && member.role === 'outer');\n if (!outer) return null;\n const inners = this.members.filter(member => member.ref instanceof OsmWay && member.role === 'inner');\n return {\n type: \"Polygon\",\n coordinates: [outer, ...inners].map(member => {\n const way = member.ref as OsmWay;\n return way.nodes.map(node => [node.coords.lng, node.coords.lat] as Position);\n })\n }\n }\n}\n\nexport default OsmRelation;\n","/* eslint-disable max-statements */\nimport { SaxesParser } from 'saxes';\n\nimport {\n Level, Coordinates\n} from '@wemap/geo';\n\nimport OsmModel from './OsmModel.js';\nimport OsmNode from './OsmNode.js';\nimport OsmWay from './OsmWay.js';\nimport OsmRelation from './OsmRelation.js';\n\ntype OsmXmlElement = { action?: 'delete' };\ntype OsmXmlNode = { id: string, lat: string, lon: string } & OsmXmlElement;\ntype OsmXmlWay = { id: string } & OsmXmlElement;\ntype OsmXmlRelation = { id: string } & OsmXmlElement;\n\nclass OsmParser {\n\n static parseOsmXmlString(osmXmlString: string) {\n\n const model = new OsmModel();\n const parser = new SaxesParser();\n\n let buffer: OsmNode | OsmWay | OsmRelation | null;\n\n const isDeleted = (element: { attributes: OsmXmlElement }) =>\n element.attributes.action && element.attributes.action === 'delete';\n\n parser.on('opentag', (node) => {\n\n switch (node.name) {\n case 'node': {\n if (isDeleted(node)) {\n buffer = null;\n break;\n }\n const osmNode = this._parseNode(node.attributes as OsmXmlNode);\n buffer = osmNode;\n model.nodes.push(osmNode);\n break;\n }\n case 'way': {\n if (isDeleted(node)) {\n buffer = null;\n break;\n }\n const osmWay = this._parseWay(node.attributes as OsmXmlWay);\n buffer = osmWay;\n model.ways.push(osmWay);\n break;\n }\n case 'relation': {\n if (isDeleted(node)) {\n buffer = null;\n break;\n }\n const osmRelation = this._parseRelation(node.attributes as OsmXmlRelation);\n buffer = osmRelation;\n model.relations.push(osmRelation);\n break;\n }\n case 'tag': {\n if (!buffer) {\n return;\n }\n const {\n k, v\n } = node.attributes;\n buffer.tags[k] = v;\n break;\n }\n case 'nd': {\n if (!buffer || !(buffer instanceof OsmWay)) {\n return;\n }\n const nodeId = Number(node.attributes.ref);\n const refNode = model.getNodeById(nodeId);\n if (!refNode) {\n throw Error('Node: ' + nodeId + ' in way ' + buffer.id + ' not found');\n }\n\n buffer.nodes.push(refNode);\n refNode.ways.push(buffer);\n break;\n }\n case 'member': {\n if (!buffer || !(buffer instanceof OsmRelation)) {\n return;\n }\n const memberId = Number(node.attributes.ref);\n const memberType = node.attributes.type;\n let refElement: OsmNode | OsmWay | OsmRelation | null = null;\n memberType === 'node' && (refElement = model.getNodeById(memberId));\n memberType === 'way' && (refElement = model.getWayById(memberId));\n memberType === 'relation' && (refElement = model.getRelationById(memberId));\n\n if (!refElement) {\n throw Error('Member: ' + memberId + ' in relation ' + buffer.id + ' not found');\n }\n\n buffer.members.push({ ref: refElement, role: node.attributes.role });\n refElement.relations.push(buffer);\n break;\n }\n }\n });\n\n parser.write(osmXmlString);\n\n for (let i = 0; i < model.ways.length; i++) {\n const way = model.ways[i];\n if (way.tags.level) {\n way.level = Level.fromString(way.tags.level);\n }\n }\n\n return model;\n }\n\n\n static _parseNode(attr: OsmXmlNode) {\n return new OsmNode(\n Number(attr.id),\n new Coordinates(Number(attr.lat), Number(attr.lon)));\n }\n\n static _parseWay(attr: { id: string }) {\n return new OsmWay(Number(attr.id));\n }\n\n static _parseRelation(attr: { id: string }) {\n return new OsmRelation(Number(attr.id));\n }\n}\n\nexport default OsmParser;\n"],"names":["SaxesParser","Level","Coordinates"],"mappings":";;;;;;;;;;AAGA,MAAM,WAAW;AAAA,EAKb,YAAY,IAAY,MAAgB;AAHxC;AACA;AAGI,SAAK,KAAK;AACL,SAAA,OAAO,QAAQ;EACxB;AACJ;ACRA,MAAM,SAAS;AAAA,EAMX,YAAY,OAAmB,MAAiB,WAA2B;AAJ3E;AACA;AACA;AAGS,SAAA,QAAQ,SAAS;AACjB,SAAA,OAAO,QAAQ;AACf,SAAA,YAAY,aAAa;EAClC;AAAA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