@transportme/load-ptv-gtfs 1.2.4 → 1.2.6

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.
@@ -18,7 +18,7 @@ export class GTFSStop {
18
18
 
19
19
  constructor({ stopGTFSID, stopName, stopLat, stopLon }, suburbs) {
20
20
  this.stopGTFSID = stopGTFSID
21
- this.originalName = stopName
21
+ this.originalName = stopName.replace(/ \(\w+\.\.\. #/, ' #').replace(/ +/g, ' ').trim()
22
22
  this.location = {
23
23
  type: 'Point',
24
24
  coordinates: [parseFloat(stopLon), parseFloat(stopLat)]
@@ -144,7 +144,7 @@ export class GTFSStop {
144
144
  }
145
145
  }
146
146
 
147
- return { stopNumber: null, stopName: stopName }
147
+ return { stopNumber: null, stopName }
148
148
  }
149
149
 
150
150
  #setStopNumber() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -318,6 +318,6 @@ describe('The GTFS Stops Loader', () => {
318
318
  await (new StopsLoader(unionWithSpaces, suburbs, TRANSIT_MODES.bus, database)).loadStops()
319
319
 
320
320
  expect(await stops.countDocuments({})).to.equal(1)
321
- expect((await stops.findDocument({ 'bays.stopGTFSID': '26535' })).bays.length).to.equal(4) // Piangil
321
+ expect((await stops.findDocument({ 'bays.stopGTFSID': '26535' })).bays.length).to.equal(4) // Union Station
322
322
  })
323
323
  })
@@ -31,5 +31,37 @@ describe('The GTFS Loaders with the new Tram data', () => {
31
31
  expect(stop).to.not.be.null
32
32
  expect(stop.bays[0].stopNumber).to.equal('45')
33
33
  })
34
+
35
+ it('Should clean up extra spaces', async () => {
36
+ let database = new LokiDatabaseConnection('test-db')
37
+ let stops = await database.createCollection('stops')
38
+
39
+ let loader = new StopsLoader(stopsFile, suburbs, TRANSIT_MODES.tram, database)
40
+ await loader.loadStops()
41
+
42
+ let stop = await stops.findDocument({
43
+ 'stopName': 'Glen Huntly Railway Station/Glen Huntly Road'
44
+ })
45
+
46
+ expect(stop).to.not.be.null
47
+ expect(stop.bays[0].stopNumber).to.equal('61')
48
+ expect(stop.bays[0].originalName).to.equal('Glen Huntly Railway Station/Glen Huntly Rd #61')
49
+ })
50
+
51
+ it('Should remove half suburbs in the name', async () => {
52
+ let database = new LokiDatabaseConnection('test-db')
53
+ let stops = await database.createCollection('stops')
54
+
55
+ let loader = new StopsLoader(stopsFile, suburbs, TRANSIT_MODES.tram, database)
56
+ await loader.loadStops()
57
+
58
+ let stop = await stops.findDocument({
59
+ 'stopName': 'Royal Melbourne Hospital-Parkville Railway Station/Royal Parade'
60
+ })
61
+
62
+ expect(stop).to.not.be.null
63
+ expect(stop.bays[0].stopNumber).to.equal('10')
64
+ expect(stop.bays[0].originalName).to.equal('Royal Melbourne Hospital-Parkville Station/Royal Pde #10')
65
+ })
34
66
  })
35
67
  })
@@ -2,4 +2,7 @@ stop_id,stop_name,stop_lat,stop_lon
2
2
  "10311","Glenferrie Rd/Wattletree Rd #45","-37.86245520","145.02850849"
3
3
  "10371","Duncraig Ave/Wattletree Rd #44","-37.86206934","145.02538150"
4
4
  "1083","Clyde St/Raleigh Rd #42","-37.76969864","144.89884126"
5
- "11285","Egerton Rd/Wattletree Rd #43","-37.86170982","145.02275399"
5
+ "11285","Egerton Rd/Wattletree Rd #43","-37.86170982","145.02275399"
6
+ "18404","Glen Huntly Railway Station/Glen Huntly Rd #61","-37.88954800","145.04275047","","","0","Level 0
7
+ "17867","Royal Melbourne Hospital-Parkville Station/Royal Pde (Melbo... #10","-37.79992871","144.95750800","","","0","Level 0"
8
+ "17868","Royal Melbourne Hospital-Parkville Station/Royal Pde (Parkv... #10","-37.79954277","144.95759813","","","0","Level 0"