@wemap/geo 11.3.3 → 11.7.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/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "directory": "packages/geo"
14
14
  },
15
15
  "name": "@wemap/geo",
16
- "version": "11.3.3",
16
+ "version": "11.7.0",
17
17
  "bugs": {
18
18
  "url": "https://github.com/wemap/wemap-modules-js/issues"
19
19
  },
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@wemap/logger": "^11.0.1",
35
35
  "@wemap/maths": "^11.0.1",
36
- "@wemap/utils": "^11.3.3"
36
+ "@wemap/utils": "^11.5.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "jsdom-global": "^3.0.2"
@@ -45,5 +45,5 @@
45
45
  },
46
46
  "./tests/*": "./tests/*"
47
47
  },
48
- "gitHead": "e53e577cf8a7f4e9bd1e1be6639d2ebc68319bcc"
48
+ "gitHead": "e06f16f4114b6e8da0c0f6bbda65c1ad1a3f45ce"
49
49
  }
@@ -21,7 +21,7 @@ describe('GeoGraph', () => {
21
21
 
22
22
  });
23
23
 
24
- it('getNodeByCoords', () => {
24
+ it('getVertexByCoords', () => {
25
25
 
26
26
  let vertex = graph.getVertexByCoords(vertices[2].coords.clone());
27
27
  expect(vertex).not.undefined;
@@ -31,7 +31,7 @@ describe('GeoGraph', () => {
31
31
  expect(vertex).is.undefined;
32
32
  });
33
33
 
34
- it('getEdgeByNodes', () => {
34
+ it('getEdgeByVertices', () => {
35
35
 
36
36
  let edge = graph.getEdgeByVertices(vertices[1], vertices[2]);
37
37
  expect(edge).not.null;
@@ -70,8 +70,8 @@ describe('GeoGraph', () => {
70
70
  const networkJson = graph.toCompressedJson();
71
71
  const networkBis = GeoGraph.fromCompressedJson(networkJson);
72
72
 
73
- networkBis.vertices.forEach((node, i) => {
74
- expect(node.coords.equals(graph.vertices[i].coords)).is.true;
73
+ networkBis.vertices.forEach((vertex, i) => {
74
+ expect(vertex.coords.equals(graph.vertices[i].coords)).is.true;
75
75
  });
76
76
 
77
77
  networkBis.edges.forEach((edge, i) => {
@@ -84,7 +84,7 @@ describe('GeoGraph', () => {
84
84
 
85
85
  it('getEdgesAtLevel', () => {
86
86
 
87
- const _nodes = [
87
+ const _vertices = [
88
88
  new GeoGraphVertex(new Coordinates(43.6091194, 3.884099, null, 0), { name: 'p0' }),
89
89
  new GeoGraphVertex(new Coordinates(43.6093629, 3.8842777, null, 0), { name: 'p1' }),
90
90
  new GeoGraphVertex(new Coordinates(43.6094654, 3.8842167, null, [0, 1]), { name: 'p2' }),
@@ -96,16 +96,16 @@ describe('GeoGraph', () => {
96
96
  ];
97
97
 
98
98
  const _edges = [
99
- new GeoGraphEdge(_nodes[0], _nodes[1], { name: 'e0', level: 0 }),
100
- new GeoGraphEdge(_nodes[1], _nodes[2], { name: 'e1', level: [0, 1] }),
101
- new GeoGraphEdge(_nodes[2], _nodes[3], { name: 'e2', level: [0, 1] }),
102
- new GeoGraphEdge(_nodes[3], _nodes[4], { name: 'e3', level: 1 }),
103
- new GeoGraphEdge(_nodes[4], _nodes[5], { name: 'e4', level: [1, 2] }),
104
- new GeoGraphEdge(_nodes[5], _nodes[6], { name: 'e5', level: [1, 2] }),
105
- new GeoGraphEdge(_nodes[6], _nodes[7], { name: 'e6', level: 1 })
99
+ new GeoGraphEdge(_vertices[0], _vertices[1], { name: 'e0', level: 0 }),
100
+ new GeoGraphEdge(_vertices[1], _vertices[2], { name: 'e1', level: [0, 1] }),
101
+ new GeoGraphEdge(_vertices[2], _vertices[3], { name: 'e2', level: [0, 1] }),
102
+ new GeoGraphEdge(_vertices[3], _vertices[4], { name: 'e3', level: 1 }),
103
+ new GeoGraphEdge(_vertices[4], _vertices[5], { name: 'e4', level: [1, 2] }),
104
+ new GeoGraphEdge(_vertices[5], _vertices[6], { name: 'e5', level: [1, 2] }),
105
+ new GeoGraphEdge(_vertices[6], _vertices[7], { name: 'e6', level: 1 })
106
106
  ];
107
107
 
108
- const _network = new GeoGraph(_nodes, _edges);
108
+ const _network = new GeoGraph(_vertices, _edges);
109
109
 
110
110
  const edgesAtLevel0 = _network.getEdgesAtLevel(0, false);
111
111
  expect(edgesAtLevel0.length).equals(1);
@@ -3,7 +3,7 @@ import { Graph } from '@wemap/utils';
3
3
  import BoundingBox from '../coordinates/BoundingBox.js';
4
4
  import Coordinates from '../coordinates/Coordinates.js';
5
5
  import Level from '../coordinates/Level.js';
6
- import { Level_t, GeoGraphJson } from '../types.js';
6
+ import { Level_t, GeoGraphJson, GeoGraphEdgeExtras } from '../types.js';
7
7
 
8
8
  import GeoGraphEdge from './GeoGraphEdge.js';
9
9
  import GeoGraphVertex from './GeoGraphVertex.js';
@@ -50,13 +50,21 @@ class GeoGraph<VertexData = unknown, EdgeData = unknown> extends Graph<VertexDat
50
50
 
51
51
 
52
52
  toCompressedJson(): GeoGraphJson {
53
+
54
+ const createEdgeExtras = (edge: GeoGraphEdge) => {
55
+ const extras: GeoGraphEdgeExtras = {};
56
+ if (edge.isOneway) { extras.oneway = true }
57
+ return extras;
58
+ }
59
+
53
60
  return {
54
61
  vertices: this.vertices.map(vertex => vertex.toJson()),
55
62
  edges: this.edges.map(edge => {
56
63
  const vertex1Idx = this.vertices.indexOf(edge.vertex1);
57
64
  const vertex2Idx = this.vertices.indexOf(edge.vertex2);
58
- if (edge.isOneway) {
59
- return [vertex1Idx, vertex2Idx, edge.level, true];
65
+ const edgeExtras = createEdgeExtras(edge);
66
+ if (Object.keys(edgeExtras).length > 0) {
67
+ return [vertex1Idx, vertex2Idx, edge.level, edgeExtras];
60
68
  }
61
69
  if (edge.level !== null) {
62
70
  return [vertex1Idx, vertex2Idx, edge.level];
@@ -79,8 +87,9 @@ class GeoGraph<VertexData = unknown, EdgeData = unknown> extends Graph<VertexDat
79
87
  geograph.vertices[jsonEdge[1]],
80
88
  { level: jsonEdge.length > 2 ? jsonEdge[2] : null }
81
89
  );
82
- if (jsonEdge.length > 3 && jsonEdge[3]) {
83
- edge.isOneway = true;
90
+ const extras: GeoGraphEdgeExtras = jsonEdge.length > 3 ? jsonEdge[3]! : {}
91
+ if (typeof extras.oneway !== 'undefined') {
92
+ edge.isOneway = extras.oneway;
84
93
  }
85
94
  return edge;
86
95
  });
@@ -3,7 +3,7 @@ import chai from 'chai';
3
3
  import Logger from '@wemap/logger';
4
4
 
5
5
  import Coordinates from '../coordinates/Coordinates.js';
6
- import GraphNode from './GeoGraphVertex.js';
6
+ import GeoGraphVertex from './GeoGraphVertex.js';
7
7
  import GeoGraphEdge from './GeoGraphEdge.js';
8
8
 
9
9
  const { expect } = chai;
@@ -18,26 +18,26 @@ describe('GeoGraphEdge', () => {
18
18
  Logger.enable(true);
19
19
  })
20
20
 
21
- const node1 = new GraphNode(new Coordinates(45, 5));
22
- const node2 = new GraphNode(new Coordinates(46, 5));
21
+ const vertex1 = new GeoGraphVertex(new Coordinates(45, 5));
22
+ const vertex2 = new GeoGraphVertex(new Coordinates(46, 5));
23
23
 
24
24
  it('creation', () => {
25
25
 
26
- expect(() => new GeoGraphEdge(node1, node2)).not.throw(Error);
27
- expect(() => new GeoGraphEdge(node1, node2, {})).not.throw(Error);
28
- expect(() => new GeoGraphEdge(node1, node2, { level: 1 })).not.throw(Error);
26
+ expect(() => new GeoGraphEdge(vertex1, vertex2)).not.throw(Error);
27
+ expect(() => new GeoGraphEdge(vertex1, vertex2, {})).not.throw(Error);
28
+ expect(() => new GeoGraphEdge(vertex1, vertex2, { level: 1 })).not.throw(Error);
29
29
 
30
30
  });
31
31
 
32
32
 
33
33
  it('distanceTo / bearingTo', () => {
34
- let newEdge = new GeoGraphEdge(node1, node2);
35
- expect(newEdge.length).equals(node1.distanceTo(node2));
36
- expect(newEdge.bearing).equals(node1.bearingTo(node2));
34
+ let newEdge = new GeoGraphEdge(vertex1, vertex2);
35
+ expect(newEdge.length).equals(vertex1.distanceTo(vertex2));
36
+ expect(newEdge.bearing).equals(vertex1.bearingTo(vertex2));
37
37
 
38
- newEdge = new GeoGraphEdge(node1, node2);
39
- expect(newEdge.bearing).equals(node1.bearingTo(node2));
40
- expect(newEdge.length).equals(node1.distanceTo(node2));
38
+ newEdge = new GeoGraphEdge(vertex1, vertex2);
39
+ expect(newEdge.bearing).equals(vertex1.bearingTo(vertex2));
40
+ expect(newEdge.length).equals(vertex1.distanceTo(vertex2));
41
41
  });
42
42
 
43
43
 
@@ -5,9 +5,9 @@ const { expect } = chai;
5
5
 
6
6
  export function isReadable(itinerary: GraphItinerary) {
7
7
  for (let i = 0; i < itinerary.vertices.length; i++) {
8
- const node = itinerary.vertices[i];
8
+ const vertex = itinerary.vertices[i];
9
9
  if (i !== itinerary.vertices.length - 1) {
10
- expect(itinerary.edges[i].vertex1).equal(node);
10
+ expect(itinerary.edges[i].vertex1).equal(vertex);
11
11
  expect(itinerary.edges[i].vertex2).equal(itinerary.vertices[i + 1]);
12
12
  }
13
13
  }
@@ -58,20 +58,20 @@ const expectProjection = (projectionResult: GeoGraphProjection | null, condition
58
58
 
59
59
  describe('GeoGraphProjectionHandler', () => {
60
60
 
61
- const nodes = [
61
+ const vertices = [
62
62
  new GeoGraphVertex(new Coordinates(43.6091194, 3.884099), { name: 'p0' }),
63
63
  new GeoGraphVertex(new Coordinates(43.6093629, 3.8842777), { name: 'p1' }),
64
64
  new GeoGraphVertex(new Coordinates(43.6092785, 3.8845052), { name: 'p2' })
65
65
  ];
66
66
 
67
67
  const edges = [
68
- new GeoGraphEdge(nodes[0], nodes[1], { name: 'e0' }),
69
- new GeoGraphEdge(nodes[1], nodes[2], { name: 'e1' })
68
+ new GeoGraphEdge(vertices[0], vertices[1], { name: 'e0' }),
69
+ new GeoGraphEdge(vertices[1], vertices[2], { name: 'e1' })
70
70
  ];
71
71
 
72
72
  let mapMatching: GeoGraphProjectionHandler;
73
73
  it('creation', () => {
74
- const owNetwork = new GeoGraph(nodes, edges);
74
+ const owNetwork = new GeoGraph(vertices, edges);
75
75
  expect(() => (mapMatching = new GeoGraphProjectionHandler(owNetwork))).not.throw(Error);
76
76
  });
77
77
 
@@ -102,12 +102,12 @@ describe('GeoGraphProjectionHandler', () => {
102
102
  projection = mapMatching.getProjection(location);
103
103
  expectProjection(projection, { name: 'e0', coords: expected, nearestElementType: 'edge' });
104
104
 
105
- const owNodes = [
105
+ const owVertices = [
106
106
  new GeoGraphVertex(new Coordinates(43.6091194, 3.884099, 5)),
107
107
  new GeoGraphVertex(new Coordinates(43.6093629, 3.8842777, 10))
108
108
  ];
109
- const owNetwork = new GeoGraph(owNodes, [
110
- new GeoGraphEdge(owNodes[0], owNodes[1])
109
+ const owNetwork = new GeoGraph(owVertices, [
110
+ new GeoGraphEdge(owVertices[0], owVertices[1])
111
111
  ]);
112
112
  const owGeoGraphProjectionHandler = new GeoGraphProjectionHandler(owNetwork);
113
113
  projection = owGeoGraphProjectionHandler.getProjection(new Coordinates(43.6092086, 3.8842598, 10));
@@ -127,19 +127,19 @@ describe('GeoGraphProjectionHandler', () => {
127
127
 
128
128
  let pointToTest;
129
129
 
130
- pointToTest = nodes[0].coords.destinationPoint(0.0001, nodes[0].bearingTo(nodes[1]));
130
+ pointToTest = vertices[0].coords.destinationPoint(0.0001, vertices[0].bearingTo(vertices[1]));
131
131
  projection = mapMatching.getProjection(pointToTest);
132
132
  expectProjection(projection, { name: 'p0', nearestElementType: 'vertex' });
133
133
 
134
- pointToTest = nodes[1].coords.destinationPoint(0.0001, nodes[1].bearingTo(nodes[0]));
134
+ pointToTest = vertices[1].coords.destinationPoint(0.0001, vertices[1].bearingTo(vertices[0]));
135
135
  projection = mapMatching.getProjection(pointToTest);
136
136
  expectProjection(projection, { name: 'p1', nearestElementType: 'vertex' });
137
137
 
138
- pointToTest = nodes[0].coords.destinationPoint(0.005, nodes[0].bearingTo(nodes[1]));
138
+ pointToTest = vertices[0].coords.destinationPoint(0.005, vertices[0].bearingTo(vertices[1]));
139
139
  projection = mapMatching.getProjection(pointToTest);
140
140
  expectProjection(projection, { name: 'e0', nearestElementType: 'edge', coords: pointToTest });
141
141
 
142
- pointToTest = nodes[1].coords.destinationPoint(0.005, nodes[1].bearingTo(nodes[0]));
142
+ pointToTest = vertices[1].coords.destinationPoint(0.005, vertices[1].bearingTo(vertices[0]));
143
143
  projection = mapMatching.getProjection(pointToTest);
144
144
  expectProjection(projection, { name: 'e0', nearestElementType: 'edge', coords: pointToTest });
145
145
  });
@@ -166,7 +166,7 @@ describe('GeoGraphProjectionHandler - multilevels', () => {
166
166
  expectProjection(projection, { coords: expected });
167
167
  });
168
168
 
169
- it('matching node levels', () => {
169
+ it('matching vertex levels', () => {
170
170
  let currentPosition;
171
171
 
172
172
  currentPosition = new Coordinates(43.6091773, 3.8842584, null, -1);
@@ -207,7 +207,7 @@ describe('GeoGraphProjectionHandler - multilevels', () => {
207
207
 
208
208
  });
209
209
 
210
- it('matching stairs nodes levels', () => {
210
+ it('matching stairs vertices levels', () => {
211
211
  let currentPosition;
212
212
 
213
213
  currentPosition = new Coordinates(43.6093691, 3.8842057, null, -1);
@@ -250,7 +250,7 @@ describe('GeoGraphProjectionHandler - multilevels', () => {
250
250
  it('useMultiLevelSegments = false', () => {
251
251
  let currentPosition;
252
252
 
253
- // On Nodes
253
+ // On Vertices
254
254
 
255
255
  currentPosition = new Coordinates(43.6093381, 3.8841926, null, -1);
256
256
  projection = mapMatching.getProjection(currentPosition, true, false, false);
@@ -304,7 +304,7 @@ describe('GeoGraphProjectionHandler - multilevels', () => {
304
304
  });
305
305
 
306
306
 
307
- it('matching exact node position with eps', () => {
307
+ it('matching exact vertex position with eps', () => {
308
308
  let currentPosition;
309
309
 
310
310
  currentPosition = new Coordinates(43.60936289383032, 3.884212691390017, null, -1);
@@ -39,12 +39,12 @@ class GeoGraphProjectionHandler<VertexData = unknown, EdgeData = unknown> {
39
39
 
40
40
 
41
41
  /**
42
- * Check if the specified edge and its nodes can be used for projection
42
+ * Check if the specified edge and its vertices can be used for projection
43
43
  * @returns an array of two elements.
44
44
  * First is true if projection will be used on the specified edge, false otherwise.
45
- * Second is true if projection will be used on the nodes of the specified edge, false otherwise.
45
+ * Second is true if projection will be used on the vertices of the specified edge, false otherwise.
46
46
  */
47
- _shouldProjectOnEdgeAndNodes(
47
+ _shouldProjectOnEdgeAndVertices(
48
48
  edge: GeoGraphEdge<VertexData, EdgeData>,
49
49
  location: Coordinates | UserPosition,
50
50
  useBearing: boolean,
@@ -58,18 +58,18 @@ class GeoGraphProjectionHandler<VertexData = unknown, EdgeData = unknown> {
58
58
 
59
59
  // First, check if levels intersects
60
60
  let checkEdge = Level.intersect(location.level, edge.level);
61
- let checkNode1 = Level.intersect(location.level, edge.vertex1.coords.level);
62
- let checkNode2 = Level.intersect(location.level, edge.vertex2.coords.level);
61
+ let checkVertex1 = Level.intersect(location.level, edge.vertex1.coords.level);
62
+ let checkVertex2 = Level.intersect(location.level, edge.vertex2.coords.level);
63
63
 
64
- // Second, in case of IO nodes, accept matching if location's level is null
65
- checkNode1 = checkNode1 || edge.vertex1.io && location.level === null;
66
- checkNode2 = checkNode2 || edge.vertex2.io && location.level === null;
64
+ // Second, in case of IO vertices, accept matching if location's level is null
65
+ checkVertex1 = checkVertex1 || edge.vertex1.io && location.level === null;
66
+ checkVertex2 = checkVertex2 || edge.vertex2.io && location.level === null;
67
67
 
68
68
  // Third, check if level is a range if useMultiLevelSegments is false
69
69
  if (!useMultiLevelSegments) {
70
70
  checkEdge = checkEdge && !Level.isRange(edge.level);
71
- checkNode1 = checkNode1 && !Level.isRange(edge.vertex1.coords.level);
72
- checkNode2 = checkNode2 && !Level.isRange(edge.vertex2.coords.level);
71
+ checkVertex1 = checkVertex1 && !Level.isRange(edge.vertex1.coords.level);
72
+ checkVertex2 = checkVertex2 && !Level.isRange(edge.vertex2.coords.level);
73
73
  }
74
74
 
75
75
  // Finally, check edges bearing if option is used
@@ -82,12 +82,12 @@ class GeoGraphProjectionHandler<VertexData = unknown, EdgeData = unknown> {
82
82
  checkEdge = false;
83
83
  }
84
84
  }
85
- // if mapmatching bearing is enabled do not use nodes matching
86
- checkNode1 = false;
87
- checkNode2 = false;
85
+ // if mapmatching bearing is enabled do not use vertices matching
86
+ checkVertex1 = false;
87
+ checkVertex2 = false;
88
88
  }
89
89
 
90
- return [checkEdge, checkNode1, checkNode2];
90
+ return [checkEdge, checkVertex1, checkVertex2];
91
91
  }
92
92
 
93
93
 
@@ -98,12 +98,12 @@ class GeoGraphProjectionHandler<VertexData = unknown, EdgeData = unknown> {
98
98
  }
99
99
 
100
100
  /**
101
- * IO Nodes are typical because they have a non-null level but projection car works on them.
102
- * This function handles the case where the projection is on an IO node and a location with
101
+ * IO Vertices are typical because they have a non-null level but projection car works on them.
102
+ * This function handles the case where the projection is on an IO vertex and a location with
103
103
  * a null level is required.
104
104
  */
105
- static _handleLevelsWithIONodes(projection: Coordinates, location: Coordinates, projectionNode: GeoGraphVertex) {
106
- if (location.level === null && projectionNode.io) {
105
+ static _handleLevelsWithIOVertices(projection: Coordinates, location: Coordinates, projectionVertex: GeoGraphVertex) {
106
+ if (location.level === null && projectionVertex.io) {
107
107
  projection.level = null;
108
108
  }
109
109
  }
@@ -149,36 +149,36 @@ class GeoGraphProjectionHandler<VertexData = unknown, EdgeData = unknown> {
149
149
  // the current projection is replaced
150
150
  for (const edge of this.graph.edges) {
151
151
 
152
- // Check if the specified edge and its nodes can be used for projection. See the
152
+ // Check if the specified edge and its vertices can be used for projection. See the
153
153
  // documentation of the corresponding function for more information.
154
- const [checkEdge, checkNode1, checkNode2] = this._shouldProjectOnEdgeAndNodes(
154
+ const [checkEdge, checkVertex1, checkVertex2] = this._shouldProjectOnEdgeAndVertices(
155
155
  edge, location, useBearing, useMultiLevelSegments, acceptEdgeFn);
156
156
 
157
- if (checkNode1) {
157
+ if (checkVertex1) {
158
158
 
159
- const distNode1 = location.distanceTo(edge.vertex1.coords);
160
- if (isProjectionBetter(distNode1) || distNode1 <= EPS_MM) {
161
- distanceFromNearestElement = distNode1;
159
+ const distVertex1 = location.distanceTo(edge.vertex1.coords);
160
+ if (isProjectionBetter(distVertex1) || distVertex1 <= EPS_MM) {
161
+ distanceFromNearestElement = distVertex1;
162
162
  nearestElement = edge.vertex1 as typeof this.graph.vertices[0];
163
163
  GeoGraphProjectionHandler._assignLatLngLevel(edge.vertex1.coords, projection as Coordinates);
164
- GeoGraphProjectionHandler._handleLevelsWithIONodes(projection as Coordinates, location, edge.vertex1);
164
+ GeoGraphProjectionHandler._handleLevelsWithIOVertices(projection as Coordinates, location, edge.vertex1);
165
165
 
166
- if (distNode1 <= EPS_MM) {
166
+ if (distVertex1 <= EPS_MM) {
167
167
  break;
168
168
  }
169
169
  }
170
170
  }
171
171
 
172
- if (checkNode2) {
172
+ if (checkVertex2) {
173
173
 
174
- const distNode2 = location.distanceTo(edge.vertex2.coords);
175
- if (isProjectionBetter(distNode2) || distNode2 <= EPS_MM) {
176
- distanceFromNearestElement = distNode2;
174
+ const distVertex2 = location.distanceTo(edge.vertex2.coords);
175
+ if (isProjectionBetter(distVertex2) || distVertex2 <= EPS_MM) {
176
+ distanceFromNearestElement = distVertex2;
177
177
  nearestElement = edge.vertex2 as typeof this.graph.vertices[0];
178
178
  GeoGraphProjectionHandler._assignLatLngLevel(edge.vertex2.coords, projection as Coordinates);
179
- GeoGraphProjectionHandler._handleLevelsWithIONodes(projection as Coordinates, location, edge.vertex2);
179
+ GeoGraphProjectionHandler._handleLevelsWithIOVertices(projection as Coordinates, location, edge.vertex2);
180
180
 
181
- if (distNode2 <= EPS_MM) {
181
+ if (distVertex2 <= EPS_MM) {
182
182
  break;
183
183
  }
184
184
  }
@@ -11,7 +11,7 @@ class NoRouteFoundError extends Error {
11
11
 
12
12
  get startStr() {
13
13
  if (this.start instanceof GeoGraphVertex) {
14
- return `GraphNode ${this.start.coords.toString()}`;
14
+ return `GeoGraphVertex ${this.start.coords.toString()}`;
15
15
  }
16
16
 
17
17
  // if (this.start instanceof Coordinates) {
@@ -20,7 +20,7 @@ class NoRouteFoundError extends Error {
20
20
 
21
21
  get endStr() {
22
22
  if (this.end instanceof GeoGraphVertex) {
23
- return `GraphNode ${this.end.coords.toString()}`;
23
+ return `GeoGraphVertex ${this.end.coords.toString()}`;
24
24
  }
25
25
 
26
26
  // if (this.end instanceof Coordinates) {
package/src/types.ts CHANGED
@@ -38,13 +38,14 @@ export type UserPositionJson = CoordinatesJson & {
38
38
  };
39
39
 
40
40
  export type GraphVertexJson = CoordinatesCompressedJson;
41
+ export type GeoGraphEdgeExtras = { oneway?: boolean }
41
42
 
42
43
  export type GeoGraphJson = {
43
44
  vertices: GraphVertexJson[],
44
45
  edges: (
45
46
  [number, number] |
46
- [number, number, number | [number, number]] |
47
- [number, number, Level_t, true]
47
+ [number, number, Level_t] |
48
+ [number, number, Level_t, GeoGraphEdgeExtras]
48
49
  )[]
49
50
  };
50
51