@wemap/osm 0.2.1 → 0.2.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.
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/osm"
12
12
  },
13
13
  "name": "@wemap/osm",
14
- "version": "0.2.1",
14
+ "version": "0.2.3",
15
15
  "bugs": {
16
16
  "url": "https://github.com/wemap/wemap-utils-js/issues"
17
17
  },
@@ -26,10 +26,10 @@
26
26
  ],
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
- "@wemap/geo": "^0.3.1",
30
- "@wemap/logger": "^0.1.5",
29
+ "@wemap/geo": "^0.3.2",
30
+ "@wemap/logger": "^0.1.6",
31
31
  "lodash.isnumber": "^3.0.3",
32
32
  "sax": "^1.2.4"
33
33
  },
34
- "gitHead": "7b84c9d55646761f75f19235a15be8a1b73b3dbf"
34
+ "gitHead": "90192565937f17f5638b8b3dce9ae2bc78879b9e"
35
35
  }
@@ -60,6 +60,13 @@ class OsmNetwork extends Network {
60
60
  return this.edges.find(edge => edge.data.id === id);
61
61
  }
62
62
 
63
+ toString() {
64
+ return super.toString(
65
+ node => node.data.tags.name,
66
+ edge => edge.data.id
67
+ );
68
+ }
69
+
63
70
  }
64
71
 
65
72
  export default OsmNetwork;
@@ -10,7 +10,7 @@ class OsmRouter extends GraphRouter {
10
10
 
11
11
  const edgeSelectionFilter = edge => {
12
12
 
13
- return options.useStairs
13
+ return options.useStairs || !edge.data || !edge.data.tags
14
14
  || (
15
15
  edge.data.tags.stairs !== 'yes'
16
16
  && edge.data.tags.highway !== 'steps'
@@ -3,7 +3,9 @@ import { expect } from 'chai';
3
3
  import fs from 'fs';
4
4
  import path from 'path';
5
5
 
6
- import { Node } from '@wemap/geo';
6
+ import {
7
+ Node, WGS84, Level
8
+ } from '@wemap/geo';
7
9
 
8
10
  import OsmParser from '../model/OsmParser';
9
11
  import OsmRouter from './OsmRouter';
@@ -61,6 +63,17 @@ describe('OsmRouter - Multi-level itinerary', () => {
61
63
  });
62
64
 
63
65
 
66
+ it('router returns shortest path 2', () => {
67
+
68
+ const start = new WGS84(43.609219, 3.8841743, null, new Level(2));
69
+ const end = new WGS84(43.6091722, 3.8842355, null, new Level(2));
70
+ const itinerary2 = router.getShortestPath(start, end);
71
+
72
+ expect(itinerary2.nodes.length).equal(3);
73
+ expect(itinerary2.nodes[1].data.tags.name).equal('p6');
74
+ expect(itinerary2.nodes[2].data.tags.name).equal('p5');
75
+ });
76
+
64
77
  it('No route itinerary', () => {
65
78
  const itineraryWithoutStairs = router.getShortestPath(itineraryStart, itineraryEnd, { useStairs: false });
66
79
  expect(itineraryWithoutStairs).is.undefined;
@@ -14,7 +14,7 @@ import {
14
14
  itineraryStart, itineraryEnd
15
15
  } from '../../../geo/tests/CommonTest';
16
16
 
17
- describe('OsmRouter - Multi-level itinerary', () => {
17
+ describe('OsrmUtils', () => {
18
18
 
19
19
 
20
20
  it('OSRM JSON to Itinerary', () => {