@wemap/osm 1.0.0 → 1.0.2

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
@@ -7,15 +7,15 @@
7
7
  "main": "index.js",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/wemap/wemap-utils-js.git",
10
+ "url": "git+https://github.com/wemap/wemap-modules-js.git",
11
11
  "directory": "packages/osm"
12
12
  },
13
13
  "name": "@wemap/osm",
14
- "version": "1.0.0",
14
+ "version": "1.0.2",
15
15
  "bugs": {
16
- "url": "https://github.com/wemap/wemap-utils-js/issues"
16
+ "url": "https://github.com/wemap/wemap-modules-js/issues"
17
17
  },
18
- "homepage": "https://github.com/wemap/wemap-utils-js#readme",
18
+ "homepage": "https://github.com/wemap/wemap-modules-js#readme",
19
19
  "scripts": {
20
20
  "test": "mocha -r esm \"src/**/*.spec.js\""
21
21
  },
@@ -26,11 +26,11 @@
26
26
  ],
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
- "@wemap/geo": "^1.0.4",
30
- "@wemap/graph": "^1.0.5",
31
- "@wemap/logger": "^0.1.7",
29
+ "@wemap/geo": "^1.0.5",
30
+ "@wemap/graph": "^1.0.6",
31
+ "@wemap/logger": "^0.1.8",
32
32
  "lodash.isnumber": "^3.0.3",
33
33
  "sax": "^1.2.4"
34
34
  },
35
- "gitHead": "cab48c01923850987968f072a8f7075a34b3cc32"
35
+ "gitHead": "80a8bdd92acfffd6ca612ec56e882ad54aa115e1"
36
36
  }
@@ -151,14 +151,14 @@ class OsrmUtils {
151
151
  /**
152
152
  * Generate Itinerary from OSRM JSON, start and end.
153
153
  * @param {Object} json JSON file provided by OSRM.
154
- * @param {Array} start Array of <lng, lat[, level]>
155
- * @param {Array} end Array of <lng, lat[, level]>
154
+ * @param {WGS84} start itinerary start
155
+ * @param {WGS84} end itinerary end
156
156
  */
157
157
  static createItineraryFromJson(json, start, end) {
158
158
  const itinerary = new Itinerary();
159
159
 
160
- itinerary.start = OsrmUtils.jsonToWgs84(start);
161
- itinerary.end = OsrmUtils.jsonToWgs84(end);
160
+ itinerary.start = start;
161
+ itinerary.end = end;
162
162
 
163
163
  const {
164
164
  legs, geometry
@@ -26,8 +26,8 @@ describe('OsrmUtils', () => {
26
26
 
27
27
  const json = JSON.parse(fileString);
28
28
 
29
- const start = [3.8757218000000004, 43.6007871];
30
- const end = [3.873866, 43.598877];
29
+ const start = new WGS84(43.6007871, 3.8757218000000004);
30
+ const end = new WGS84(43.598877, 3.873866);
31
31
 
32
32
  const itinerary = OsrmUtils.createItineraryFromJson(json, start, end);
33
33
 
@@ -142,14 +142,14 @@ describe('OsrmUtils', () => {
142
142
 
143
143
  let expectedType;
144
144
  switch (i) {
145
- case 0:
146
- expectedType = 'depart';
147
- break;
148
- case steps.length - 1:
149
- expectedType = 'arrive';
150
- break;
151
- default:
152
- expectedType = 'turn';
145
+ case 0:
146
+ expectedType = 'depart';
147
+ break;
148
+ case steps.length - 1:
149
+ expectedType = 'arrive';
150
+ break;
151
+ default:
152
+ expectedType = 'turn';
153
153
  }
154
154
  expect(type).equals(expectedType);
155
155
  }
@@ -202,10 +202,7 @@ describe('OsrmUtils', () => {
202
202
 
203
203
  const json = osrmWemapJson;
204
204
 
205
- const start = OsrmUtils.wgs84ToJson(itineraryStart);
206
- const end = OsrmUtils.wgs84ToJson(itineraryEnd);
207
-
208
- const itinerary = OsrmUtils.createItineraryFromJson(json, start, end);
205
+ const itinerary = OsrmUtils.createItineraryFromJson(json, itineraryStart, itineraryEnd);
209
206
 
210
207
  expect(itinerary.nodes.length).equal(wemapItinerary.nodes.length);
211
208
  for (let i = 0; i < itinerary.nodes.length; i++) {