@wemap/osm 0.3.1 → 0.3.3
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.
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
|
2
|
+
<osm version='0.6' generator='JOSM'>
|
|
3
|
+
<node id='-517853' action='modify' visible='true' lat='48.8446160213' lon='2.37196210021'>
|
|
4
|
+
<tag k='name' v='p5' />
|
|
5
|
+
</node>
|
|
6
|
+
<node id='-517854' action='modify' visible='true' lat='48.84459094139' lon='2.37200629832'>
|
|
7
|
+
<tag k='name' v='p13' />
|
|
8
|
+
</node>
|
|
9
|
+
<node id='-517855' action='modify' visible='true' lat='48.84484076717' lon='2.37172454529'>
|
|
10
|
+
<tag k='name' v='p14' />
|
|
11
|
+
</node>
|
|
12
|
+
<node id='-517856' action='modify' visible='true' lat='48.84482514548' lon='2.37169289522'>
|
|
13
|
+
<tag k='name' v='p15' />
|
|
14
|
+
</node>
|
|
15
|
+
<node id='-517857' action='modify' visible='true' lat='48.84447272937' lon='2.37213961713'>
|
|
16
|
+
<tag k='name' v='p17' />
|
|
17
|
+
</node>
|
|
18
|
+
<node id='-517858' action='modify' visible='true' lat='48.8445706698' lon='2.3719601573'>
|
|
19
|
+
<tag k='name' v='p12' />
|
|
20
|
+
</node>
|
|
21
|
+
<node id='-517859' action='modify' visible='true' lat='48.84420529552' lon='2.37269348149'>
|
|
22
|
+
<tag k='name' v='p20' />
|
|
23
|
+
</node>
|
|
24
|
+
<node id='-517860' action='modify' visible='true' lat='48.84458797362' lon='2.37234072564'>
|
|
25
|
+
<tag k='name' v='p18' />
|
|
26
|
+
</node>
|
|
27
|
+
<node id='-517861' action='modify' visible='true' lat='48.8448156136' lon='2.37167358331'>
|
|
28
|
+
<tag k='name' v='p16' />
|
|
29
|
+
</node>
|
|
30
|
+
<node id='-517862' action='modify' visible='true' lat='48.84417263969' lon='2.37257222525'>
|
|
31
|
+
<tag k='name' v='p19' />
|
|
32
|
+
</node>
|
|
33
|
+
<node id='-517863' action='modify' visible='true' lat='48.84466201501' lon='2.37186006326'>
|
|
34
|
+
<tag k='name' v='p4' />
|
|
35
|
+
</node>
|
|
36
|
+
<node id='-517864' action='modify' visible='true' lat='48.84456231196' lon='2.37194113366'>
|
|
37
|
+
<tag k='name' v='p11' />
|
|
38
|
+
</node>
|
|
39
|
+
<node id='-517865' action='modify' visible='true' lat='48.84445412307' lon='2.37216128192'>
|
|
40
|
+
<tag k='name' v='p6' />
|
|
41
|
+
</node>
|
|
42
|
+
<node id='1395307661' action='modify' timestamp='2019-09-19T15:44:48Z' uid='439947' user='StephaneP' visible='true' version='11' changeset='74681133' lat='48.8444657' lon='2.3720493'>
|
|
43
|
+
<tag k='access:RATP' v='yes' />
|
|
44
|
+
<tag k='level' v='-1' />
|
|
45
|
+
<tag k='name' v='p7' />
|
|
46
|
+
<tag k='railway' v='subway_entrance' />
|
|
47
|
+
<tag k='ref' v='13' />
|
|
48
|
+
<tag k='source' v='cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' />
|
|
49
|
+
<tag k='wheelchair' v='no' />
|
|
50
|
+
</node>
|
|
51
|
+
<node id='1395307662' action='modify' timestamp='2019-09-19T15:44:48Z' uid='439947' user='StephaneP' visible='true' version='3' changeset='74681133' lat='48.8445534' lon='2.3719505'>
|
|
52
|
+
<tag k='name' v='p10' />
|
|
53
|
+
</node>
|
|
54
|
+
<node id='1395307663' action='modify' timestamp='2019-09-19T16:18:40Z' uid='439947' user='StephaneP' visible='true' version='12' changeset='74683089' lat='48.8446992' lon='2.3718257'>
|
|
55
|
+
<tag k='level' v='-1' />
|
|
56
|
+
<tag k='name' v='p3' />
|
|
57
|
+
<tag k='railway' v='subway_entrance' />
|
|
58
|
+
<tag k='ref' v='13' />
|
|
59
|
+
<tag k='source' v='cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' />
|
|
60
|
+
<tag k='wheelchair' v='no' />
|
|
61
|
+
</node>
|
|
62
|
+
<node id='1395307664' action='modify' timestamp='2019-09-19T15:44:48Z' uid='439947' user='StephaneP' visible='true' version='3' changeset='74681133' lat='48.8448098' lon='2.3717096'>
|
|
63
|
+
<tag k='name' v='p2' />
|
|
64
|
+
</node>
|
|
65
|
+
<node id='4086374112' action='modify' timestamp='2019-09-19T16:18:40Z' uid='439947' user='StephaneP' visible='true' version='3' changeset='74683089' lat='48.8444961' lon='2.3720441'>
|
|
66
|
+
<tag k='access:RATP' v='yes' />
|
|
67
|
+
<tag k='level' v='-1' />
|
|
68
|
+
<tag k='name' v='p8' />
|
|
69
|
+
<tag k='railway' v='subway_entrance' />
|
|
70
|
+
<tag k='ref' v='13' />
|
|
71
|
+
<tag k='source' v='cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' />
|
|
72
|
+
<tag k='wheelchair' v='no' />
|
|
73
|
+
</node>
|
|
74
|
+
<node id='4086374115' action='modify' timestamp='2019-09-19T15:44:48Z' uid='439947' user='StephaneP' visible='true' version='2' changeset='74681133' lat='48.844562' lon='2.3719702'>
|
|
75
|
+
<tag k='name' v='p9' />
|
|
76
|
+
</node>
|
|
77
|
+
<node id='4086374120' action='modify' timestamp='2019-09-19T16:18:40Z' uid='439947' user='StephaneP' visible='true' version='3' changeset='74683089' lat='48.8446803' lon='2.3718155'>
|
|
78
|
+
<tag k='level' v='-1' />
|
|
79
|
+
<tag k='name' v='p1' />
|
|
80
|
+
<tag k='railway' v='subway_entrance' />
|
|
81
|
+
<tag k='ref' v='13' />
|
|
82
|
+
<tag k='source' v='cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' />
|
|
83
|
+
<tag k='wheelchair' v='no' />
|
|
84
|
+
</node>
|
|
85
|
+
<node id='4086374122' action='modify' timestamp='2019-09-19T15:44:48Z' uid='439947' user='StephaneP' visible='true' version='2' changeset='74681133' lat='48.8448048' lon='2.3716859'>
|
|
86
|
+
<tag k='name' v='p0' />
|
|
87
|
+
</node>
|
|
88
|
+
<way id='-517866' action='modify' visible='true'>
|
|
89
|
+
<nd ref='-517856' />
|
|
90
|
+
<nd ref='1395307664' />
|
|
91
|
+
<tag k='highway' v='footway' />
|
|
92
|
+
<tag k='level' v='0' />
|
|
93
|
+
</way>
|
|
94
|
+
<way id='-517867' action='modify' visible='true'>
|
|
95
|
+
<nd ref='-517863' />
|
|
96
|
+
<nd ref='1395307663' />
|
|
97
|
+
<tag k='highway' v='footway' />
|
|
98
|
+
<tag k='level' v='-1' />
|
|
99
|
+
</way>
|
|
100
|
+
<way id='-517868' action='modify' visible='true'>
|
|
101
|
+
<nd ref='4086374122' />
|
|
102
|
+
<nd ref='-517861' />
|
|
103
|
+
<nd ref='-517856' />
|
|
104
|
+
<nd ref='-517855' />
|
|
105
|
+
<nd ref='-517854' />
|
|
106
|
+
<nd ref='-517857' />
|
|
107
|
+
<nd ref='-517860' />
|
|
108
|
+
<tag k='highway' v='footway' />
|
|
109
|
+
<tag k='level' v='0' />
|
|
110
|
+
</way>
|
|
111
|
+
<way id='-517869' action='modify' visible='true'>
|
|
112
|
+
<nd ref='4086374120' />
|
|
113
|
+
<nd ref='-517863' />
|
|
114
|
+
<nd ref='-517853' />
|
|
115
|
+
<nd ref='-517865' />
|
|
116
|
+
<nd ref='4086374112' />
|
|
117
|
+
<tag k='highway' v='footway' />
|
|
118
|
+
<tag k='level' v='-1' />
|
|
119
|
+
</way>
|
|
120
|
+
<way id='-517870' action='modify' visible='true'>
|
|
121
|
+
<nd ref='1395307661' />
|
|
122
|
+
<nd ref='-517865' />
|
|
123
|
+
<nd ref='-517862' />
|
|
124
|
+
<nd ref='-517859' />
|
|
125
|
+
<tag k='highway' v='footway' />
|
|
126
|
+
<tag k='level' v='-1' />
|
|
127
|
+
</way>
|
|
128
|
+
<way id='-517871' action='modify' visible='true'>
|
|
129
|
+
<nd ref='-517858' />
|
|
130
|
+
<nd ref='4086374115' />
|
|
131
|
+
<tag k='highway' v='footway' />
|
|
132
|
+
<tag k='level' v='0' />
|
|
133
|
+
</way>
|
|
134
|
+
<way id='-517872' action='modify' visible='true'>
|
|
135
|
+
<nd ref='1395307662' />
|
|
136
|
+
<nd ref='-517864' />
|
|
137
|
+
<nd ref='-517858' />
|
|
138
|
+
<nd ref='-517854' />
|
|
139
|
+
<tag k='highway' v='footway' />
|
|
140
|
+
<tag k='level' v='0' />
|
|
141
|
+
</way>
|
|
142
|
+
<way id='125679471' action='modify' timestamp='2016-04-15T07:37:33Z' uid='1908665' user='naomap' visible='true' version='4' changeset='38579747'>
|
|
143
|
+
<nd ref='1395307661' />
|
|
144
|
+
<nd ref='1395307662' />
|
|
145
|
+
<tag k='conveying' v='yes' />
|
|
146
|
+
<tag k='highway' v='steps' />
|
|
147
|
+
<tag k='incline' v='up' />
|
|
148
|
+
<tag k='level' v='-1;0' />
|
|
149
|
+
<tag k='source' v='cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' />
|
|
150
|
+
</way>
|
|
151
|
+
<way id='125679474' action='modify' timestamp='2019-09-19T15:44:48Z' uid='439947' user='StephaneP' visible='true' version='6' changeset='74681133'>
|
|
152
|
+
<nd ref='1395307663' />
|
|
153
|
+
<nd ref='1395307664' />
|
|
154
|
+
<tag k='highway' v='steps' />
|
|
155
|
+
<tag k='incline' v='up' />
|
|
156
|
+
<tag k='level' v='-1;0' />
|
|
157
|
+
<tag k='source' v='cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2011' />
|
|
158
|
+
</way>
|
|
159
|
+
<way id='406582305' action='modify' timestamp='2016-04-15T07:37:40Z' uid='1908665' user='naomap' visible='true' version='2' changeset='38579747'>
|
|
160
|
+
<nd ref='4086374112' />
|
|
161
|
+
<nd ref='4086374115' />
|
|
162
|
+
<tag k='highway' v='steps' />
|
|
163
|
+
<tag k='incline' v='up' />
|
|
164
|
+
<tag k='level' v='-1;0' />
|
|
165
|
+
</way>
|
|
166
|
+
<way id='406582306' action='modify' timestamp='2019-09-19T15:44:48Z' uid='439947' user='StephaneP' visible='true' version='3' changeset='74681133'>
|
|
167
|
+
<nd ref='4086374120' />
|
|
168
|
+
<nd ref='4086374122' />
|
|
169
|
+
<tag k='conveying' v='forward' />
|
|
170
|
+
<tag k='highway' v='steps' />
|
|
171
|
+
<tag k='incline' v='up' />
|
|
172
|
+
<tag k='level' v='-1;0' />
|
|
173
|
+
</way>
|
|
174
|
+
</osm>
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/osm"
|
|
12
12
|
},
|
|
13
13
|
"name": "@wemap/osm",
|
|
14
|
-
"version": "0.3.
|
|
14
|
+
"version": "0.3.3",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/wemap/wemap-utils-js/issues"
|
|
17
17
|
},
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@wemap/geo": "^1.0.
|
|
29
|
+
"@wemap/geo": "^1.0.1",
|
|
30
|
+
"@wemap/graph": "^1.0.1",
|
|
30
31
|
"@wemap/logger": "^0.1.6",
|
|
31
32
|
"lodash.isnumber": "^3.0.3",
|
|
32
33
|
"sax": "^1.2.4"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "f4d8fe98fff281533d884e0479894662c4dec9fe"
|
|
35
36
|
}
|
package/src/model/OsmParser.js
CHANGED
|
@@ -77,35 +77,6 @@ class OsmParser {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
for (let i = 0; i < model.nodes.length; i++) {
|
|
81
|
-
const node = model.nodes[i];
|
|
82
|
-
if (node.ways.length === 0) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (node.tags.level) {
|
|
87
|
-
node.coords.level = Level.fromString(node.tags.level);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Get node level from ways connected to this node.
|
|
92
|
-
// Node level is intersection of all levels of connected ways.
|
|
93
|
-
let tmpLevel = node.coords.level;
|
|
94
|
-
node.ways.forEach(way => {
|
|
95
|
-
if (way.level) {
|
|
96
|
-
if (!tmpLevel) {
|
|
97
|
-
tmpLevel = way.level.clone();
|
|
98
|
-
} else {
|
|
99
|
-
tmpLevel = tmpLevel.intersect(way.level);
|
|
100
|
-
if (!tmpLevel) {
|
|
101
|
-
Logger.error('Error: Something bad happend during parsing: We cannot retrieve node level from adjacent ways: ' + node.coords);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
node.coords.level = tmpLevel;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
80
|
return model;
|
|
110
81
|
}
|
|
111
82
|
|
|
@@ -47,17 +47,14 @@ class OsmNetwork extends Network {
|
|
|
47
47
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (node.data.tags.highway === 'elevator'
|
|
53
|
-
&& node.coords.level
|
|
54
|
-
&& node.coords.level.isRange) {
|
|
55
|
-
|
|
50
|
+
networkModel.nodes.forEach(node => {
|
|
51
|
+
if (node.data.tags.highway === 'elevator') {
|
|
56
52
|
// We have to clone this node for each connected edge
|
|
57
53
|
OsmNetwork.createNodesAndEdgesFromElevator(networkModel, node);
|
|
54
|
+
} else {
|
|
55
|
+
node.generateLevelFromEdges();
|
|
58
56
|
}
|
|
59
|
-
|
|
60
|
-
}
|
|
57
|
+
});
|
|
61
58
|
|
|
62
59
|
return networkModel;
|
|
63
60
|
}
|
|
@@ -111,3 +111,30 @@ describe('OsmRouter - One Way itinerary', () => {
|
|
|
111
111
|
verifyNodesOrder(itineraryOtherWay.nodes, ['p3', 'p2', 'p5', 'p4', 'p1', 'p0']);
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
describe('OsmRouter - Conveying', () => {
|
|
117
|
+
|
|
118
|
+
const filePath = path.resolve(__dirname, '../../assets/gare-de-lyon-extract.osm');
|
|
119
|
+
const osmXmlString = fs.readFileSync(filePath, 'utf8');
|
|
120
|
+
|
|
121
|
+
const osmModel = OsmParser.parseOsmXmlString(osmXmlString);
|
|
122
|
+
const networkModel = OsmNetwork.fromOsmModel(osmModel);
|
|
123
|
+
const router = new OsmRouter(networkModel);
|
|
124
|
+
|
|
125
|
+
it('do not use oneway conveying', () => {
|
|
126
|
+
|
|
127
|
+
const start = new WGS84(48.8445715, 2.3718927, null, new Level(0));
|
|
128
|
+
const end = new WGS84(48.84443728652394, 2.3721685669363524, null, new Level(-1));
|
|
129
|
+
|
|
130
|
+
const itinerary = router.getShortestPath(start, end);
|
|
131
|
+
expect(itinerary).is.not.undefined;
|
|
132
|
+
verifyNodesOrder(itinerary.nodes, ['p11', 'p12', 'p9', 'p8', 'p6', null]);
|
|
133
|
+
|
|
134
|
+
const itineraryOtherWay = router.getShortestPath(end, start);
|
|
135
|
+
expect(itineraryOtherWay).is.not.undefined;
|
|
136
|
+
verifyNodesOrder(itineraryOtherWay.nodes, [null, 'p6', 'p7', 'p10', 'p11']);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
|