From e110c800289f45fd017f7990958cf0fd7448b9f2 Mon Sep 17 00:00:00 2001 From: mimimi1968 <32305687+mimimi1968@users.noreply.github.com> Date: Wed, 27 Sep 2017 14:52:19 +0000 Subject: [PATCH 1/6] Call coordinate conversion with explicit data type The conversion is done by calling function in 'proj4'. This function complains about arguments not being finite, when called without explicit cast to Number(). After applying this fix all tests run OK. --- lib/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index ea9e32d..0035c57 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -6,11 +6,11 @@ var proj4 = require('proj4'); proj4.defs("GK4", "+proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m"); utils.WGS84toGK4 = function WGS84toGK4(lat, lng) { - return proj4("WGS84", "GK4", [lng, lat]).map(Math.round); + return proj4("WGS84", "GK4", [Number(lng), Number(lat)]).map(Math.round); }; utils.GK4toWGS84 = function GK4toWGS84(lat, lng) { - return proj4("GK4", "WGS84", [lng, lat]).reverse(); + return proj4("GK4", "WGS84", [Number(lng), Number(lat)]).reverse(); }; utils.stripSpaces = function stripSpaces(s) { From f61acc658be210ea6bd7b8e7a4adf791d5388873 Mon Sep 17 00:00:00 2001 From: mimimi1968 <32305687+mimimi1968@users.noreply.github.com> Date: Thu, 5 Oct 2017 19:50:29 +0000 Subject: [PATCH 2/6] Fix for whitespace in front of direction For some unknown reason the server sometimes delivers a whitespace in front of the direction: ' Hauptbahnhof' for an example. This was discovered, as some connection was not showing up on a magic mirror when the directions where filtered for a stop. --- lib/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/monitor.js b/lib/monitor.js index 93600e0..6cfd7a1 100644 --- a/lib/monitor.js +++ b/lib/monitor.js @@ -38,7 +38,7 @@ function depatureMonitor(stopid, offset, amount) { return { line: d.LineName, - direction: d.Direction, + direction: d.Direction.trim(), platform: d.Platform ? { name: d.Platform.Name, type: d.Platform.Type } : undefined, arrivalTime: arrivalTime, arrivalTimeRelative: Math.round((arrivalTime - now) / 1000 / 60), From b3a34b9955a6c4a3b2a43d77006a0970789e9d02 Mon Sep 17 00:00:00 2001 From: Andreas Hippler Date: Mon, 16 Oct 2017 08:56:01 +0200 Subject: [PATCH 3/6] remove route, update dependencies --- .travis.yml | 6 +- index.js | 1 - lib/route.js | 123 ----------------------- package.json | 11 +- test/data/route-pragerstr-postplatz.json | 1 - test/test.js | 91 ----------------- 6 files changed, 12 insertions(+), 221 deletions(-) delete mode 100644 lib/route.js delete mode 100644 test/data/route-pragerstr-postplatz.json diff --git a/.travis.yml b/.travis.yml index 8022c39..af51416 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ branches: - master node_js: - - "0.12" - - "lts/*" + - "lts/argon" + - "lts/boron" - "node" notifications: @@ -14,4 +14,4 @@ notifications: script: npm run coverage -after_success: 'npm run coveralls' \ No newline at end of file +after_success: 'npm run coveralls' diff --git a/index.js b/index.js index 9830b2b..a44a242 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ var dvb = { find: require('./lib/find'), - route: require('./lib/route'), monitor: require('./lib/monitor'), pins: require('./lib/pins'), address: require('./lib/address'), diff --git a/lib/route.js b/lib/route.js deleted file mode 100644 index c9126fc..0000000 --- a/lib/route.js +++ /dev/null @@ -1,123 +0,0 @@ -'use strict'; - -var requestP = require('request-promise'); -var utils = require('./utils'); - -var url = process.env.EDUROAM != undefined ? 'http://efa.faplino.de/dvb/XML_TRIP_REQUEST2' : 'http://efa.vvo-online.de:8080/dvb/XML_TRIP_REQUEST2'; - -var route = function route(origin, destination, time, deparr, callback) { - origin = utils.stripSpaces(origin); - destination = utils.stripSpaces(destination); - - var year = time.getFullYear(); - var month = time.getMonth() + 1; - var day = time.getDate(); - var hour = time.getHours(); - var minute = time.getMinutes(); - - if (month < 10) { - month = '0' + month; - } - - if (deparr !== route.DEPARTURE && deparr !== route.ARRIVAL) { - deparr = route.ARRIVAL; - } - - // API docs: http://data.linz.gv.at/katalog/linz_ag/linz_ag_linien/fahrplan/LINZ_LINIEN_Schnittstelle_EFA_V1.pdf - // found here -> http://www.nise81.com/archives/2674 - var options = { - url: url, - qs: { - sessionID: '0', - requestID: '0', - language: 'de', - execInst: 'normal', - command: '', - ptOptionsActive: '-1', - itOptionsActive: '', - itDateDay: day, - itDateMonth: month, - itDateYear: year, - place_origin: 'Dresden', - placeState_origin: 'empty', - type_origin: 'stop', - name_origin: origin, - nameState_origin: 'empty', - place_destination: 'Dresden', - placeState_destination: 'empty', - type_destination: 'stop', - name_destination: destination, - nameState_destination: 'empty', - itdTripDateTimeDepArr: deparr, - itdTimeHour: hour, - idtTimeMinute: minute, - outputFormat: 'JSON', - coordOutputFormat: 'WGS84[DD.ddddd]', - coordOutputFormatTail: 9 - } - }; - - return requestP(options) - .then(function (data) { - // fixes json error - data = data.replace(/,(\s+),/g, ','); - return JSON.parse(data); - }) - .then(function (data) { - if (!data.trips) { - return null; - } - - return { - origin: data.origin.points.point.name, - destination: data.destination.points.point.name, - trips: data.trips.map(extractTrip) - }; - }).nodeify(callback); -}; - -function extractTrip(trip) { - var departure = trip.legs[0].points[0].dateTime.time; - var arrival = trip.legs[trip.legs.length - 1].points[trip.legs[trip.legs.length - 1].points.length - 1].dateTime.time; - var duration = trip.duration; - var interchange = parseInt(trip.interchange); - - return { - departure: departure, - arrival: arrival, - duration: duration, - interchange: interchange, - nodes: trip.legs.map(function (leg) { - var mode = leg.mode.product; - var line = leg.mode.number; - var direction = leg.mode.destination; - var path = leg.path ? leg.path.split(' ').map(utils.convertCoordinates) : []; - - var departure = { - stop: leg.points[0].nameWO, - time: leg.points[0].dateTime.time, - coords: utils.convertCoordinates(leg.points[0].ref.coords) - }; - - var arrival = { - stop: leg.points[1].nameWO, - time: leg.points[1].dateTime.time, - coords: utils.convertCoordinates(leg.points[1].ref.coords) - }; - - return { - mode: mode, - line: line, - direction: direction, - departure: departure, - arrival: arrival, - path: path - }; - }) - }; -} - -route.DEPARTURE = 'dep'; -route.ARRIVAL = 'arr'; - -module.exports = route; diff --git a/package.json b/package.json index 5f0ba27..bcda27a 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "lib/", "index.js" ], + "engines": { + "node": ">=4.2" + }, "scripts": { "test": "NODE_ENV=test mocha", "test-live": "NODE_ENV=test_live mocha", @@ -50,6 +53,10 @@ "name": "Jens Maus", "email": "mail@jens-maus.de", "url": "https://github.com/jens-maus" + }, + { + "name": "mimimi1968", + "url": "https://github.com/mimimi1968" } ], "license": "MIT", @@ -64,9 +71,9 @@ }, "devDependencies": { "bluebird": "^3.4.7", - "coveralls": "^2.11.16", + "coveralls": "^3.0.0", "istanbul": "^0.4.5", - "mocha": "^3.2.0", + "mocha": "^4.0.1", "mockery": "^2.0.0" } } diff --git a/test/data/route-pragerstr-postplatz.json b/test/data/route-pragerstr-postplatz.json deleted file mode 100644 index 589bafd..0000000 --- a/test/data/route-pragerstr-postplatz.json +++ /dev/null @@ -1 +0,0 @@ -{ "parameters": [ { "name":"serverID", "value":"efa.vvo-online.de:8080" }, { "name":"requestID", "value":"1" }, { "name":"sessionID", "value":"4110450266" } ], "itdMessageList": [ ], "origin": { "input": { "input":"pragerstrasse" }, "points": { "point": { "usage":"origin", "type":"stop", "name":"Dresden, Prager Straße", "stateless":"33000003", "ref": { "id":"33000003", "omc":"14612000", "placeID":"1", "place":"Dresden", "coords":"13.737825553,51.047148078" }, "infos": null } } }, "destination": { "input": { "input":"postplatz" }, "points": { "point": { "usage":"destination", "type":"stop", "name":"Dresden, Postplatz", "stateless":"33000037", "ref": { "id":"33000037", "omc":"14612000", "placeID":"1", "place":"Dresden", "coords":"13.733513736,51.050834998" }, "infos": null } } }, "via": { "input": { "input":"" }, "points": null }, "dateTime": { "deparr":"dep", "ttpFrom":"20161211", "ttpTo":"20171209", "year":"2017", "month":"2", "day":"17", "hour":"3", "minute":"45" }, "dateRange": [ { "day":"17", "month":"02", "year":"2017", "weekday":"6" }, { "day":"18", "month":"02", "year":"2017", "weekday":"7" }, { "day":"19", "month":"02", "year":"2017", "weekday":"1" }, { "day":"20", "month":"02", "year":"2017", "weekday":"2" }, { "day":"21", "month":"02", "year":"2017", "weekday":"3" }, { "day":"22", "month":"02", "year":"2017", "weekday":"4" }, { "day":"23", "month":"02", "year":"2017", "weekday":"5" }, { "day":"24", "month":"02", "year":"2017", "weekday":"6" }, { "day":"25", "month":"02", "year":"2017", "weekday":"7" }, { "day":"26", "month":"02", "year":"2017", "weekday":"1" }, { "day":"27", "month":"02", "year":"2017", "weekday":"2" }, { "day":"28", "month":"02", "year":"2017", "weekday":"3" }, { "day":"01", "month":"03", "year":"2017", "weekday":"4" }, { "day":"02", "month":"03", "year":"2017", "weekday":"5" }, { "day":"03", "month":"03", "year":"2017", "weekday":"6" } ], "option": { "ptOption": { "active":"1", "maxChanges":"9", "maxTime":"360", "maxWait":"120", "routeType":"LEASTTIME", "changeSpeed":"normal", "lineRestriction":"400", "useProxFootSearch":"0", "useProxFootSearchOrigin":"0", "useProxFootSearchDestination":"0", "bike":"0", "plane":"0", "noCrowded":"0", "noSolidStairs":"0", "noEscalators":"0", "noElevators":"0", "lowPlatformVhcl":"0", "wheelchair":"0", "needElevatedPlt":"0", "assistance":"0", "SOSAvail":"0", "noLonelyTransfer":"0", "illumTransfer":"0", "noInsecurePlaces":"0", "privateTransport":"0", "excludedMeans": [ { "means":"Zug", "value":"0", "selected":"0" }, { "means":"S-Bahn", "value":"1", "selected":"0" }, { "means":"U-Bahn", "value":"2", "selected":"0" }, { "means":"Stadtbahn", "value":"3", "selected":"0" }, { "means":"Straßen-/Trambahn", "value":"4", "selected":"0" }, { "means":"Stadtbus", "value":"5", "selected":"0" }, { "means":"Regionalbus", "value":"6", "selected":"0" }, { "means":"Schnellbus", "value":"7", "selected":"0" }, { "means":"Seil-/Zahnradbahn", "value":"8", "selected":"0" }, { "means":"Schiff", "value":"9", "selected":"0" }, { "means":"AST/Rufbus", "value":"10", "selected":"0" }, { "means":"Sonstige", "value":"11", "selected":"0" }, { "means":"Flugzeug", "value":"12", "selected":"0" }, { "means":"Zug (Nahverkehr)", "value":"13", "selected":"0" }, { "means":"Zug (Fernverkehr)", "value":"14", "selected":"0" }, { "means":"Zug (Fernverkehr mit", "value":"15", "selected":"0" }, { "means":"Zug (Fernverkehr mit", "value":"16", "selected":"0" }, { "means":"Schienenersatzverkeh", "value":"17", "selected":"0" }, { "means":"Zug Shuttle", "value":"18", "selected":"0" }, { "means":"Bürgerbus", "value":"19", "selected":"0" } ], "activeImp":"-1", "activeCom":"-1", "activeSec":"-1" }, "itOption": { "active":"1", "itRouter": { "logASCII":"0", "logSVG":"0" }, "pedestrian": { "computeMonomodalTrip":"0", "computationType":"PT_AND_IT", "useElevation":"0", "speedFactor":"100", "speedFactor":"0", "distanceFactor":"50", "traveltimeFactor":"50", "noTunnel":"0", "noBridge":"0", "noFerry":"0", "maxTime":"30", "minTime":"0", "maxLength":"2147483647", "minLength":"0", "ignoreRestrictions":"0", "computeAlternativeRoutes":"0", "level":"connection" }, "itBicycle": { "computeMonomodalTrip":"0", "computationType":"PT_AND_IT", "useElevation":"0", "speedFactor":"100", "speedFactor":"0", "distanceFactor":"50", "traveltimeFactor":"50", "noTunnel":"0", "noBridge":"0", "noFerry":"0", "maxTime":"120", "minTime":"0", "maxLength":"2147483647", "minLength":"0", "ignoreRestrictions":"0", "computeAlternativeRoutes":"0", "level":"unknown" }, "mitCar": { "computeMonomodalTrip":"0", "computationType":"PT_AND_IT", "useElevation":"0", "speedFactor":"100", "speedFactor":"0", "distanceFactor":"10", "traveltimeFactor":"90", "noTunnel":"0", "noBridge":"0", "noFerry":"0", "maxTime":"120", "minTime":"0", "maxLength":"2147483647", "minLength":"0", "ignoreRestrictions":"0", "computeAlternativeRoutes":"0", "level":"unknown", "mitProfileData":"0", "mitIncidentData":"0", "mitOnlineData":"0", "noHighway":"0", "noTollRoad":"0", "prefSerSt":"0" }, "mitTaxi": { "computeMonomodalTrip":"0", "computationType":"PT_AND_IT", "useElevation":"0", "speedFactor":"100", "speedFactor":"0", "distanceFactor":"10", "traveltimeFactor":"90", "noTunnel":"0", "noBridge":"0", "noFerry":"0", "maxTime":"5", "minTime":"0", "maxLength":"2147483647", "minLength":"0", "ignoreRestrictions":"0", "computeAlternativeRoutes":"0", "level":"unknown", "mitProfileData":"0", "mitIncidentData":"0", "mitOnlineData":"0", "noHighway":"0", "noTollRoad":"0", "prefSerSt":"0" } }, "departureTransport": { "meansCode":"100", "value":"15", "speed":"normal" }, "arrivalTransport": { "meansCode":"100", "value":"15", "speed":"normal" } }, "trips": [ { "distance":"0", "duration":"00:02", "interchange":"0", "desc":"1", "optValue":"0", "legs": [ { "timeMinute":"2", "points": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Prager Straße", "usage":"departure", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"03:30", "rtDate":"17.02.2017", "rtTime":"03:30" }, "stamp": { "date":"20170217", "time":"330", "rtDate":"20170217", "rtTime":"330" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD3.pdf" } ], "ref": { "id":"33000003", "area":"1", "platform":"1", "gid":"de:14612:3", "pointGid":"de:14612:3:1:1", "NaPTANID":"", "attrs": [ ], "coords":"13.737355192,51.047155075" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Postplatz", "usage":"arrival", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"03:32", "rtDate":"17.02.2017", "rtTime":"03:32" }, "stamp": { "date":"20170217", "time":"332", "rtDate":"20170217", "rtTime":"332" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD4.pdf" } ], "ref": { "id":"33000037", "area":"3", "platform":"4", "gid":"de:14612:37", "pointGid":"de:14612:37:3:4", "NaPTANID":"", "attrs": [ ], "coords":"13.733560349,51.050555626" } } ], "mode": { "name":"Straßenbahn 11", "number":"11", "symbol":"11", "product":"Straßenbahn", "type":"4", "code":"4", "destination":" \"Bühlau\"", "destID":"-1", "desc":"Zschertnitz Münzmeisterstr. - Kongresszentrum / Haus der Presse", "timetablePeriod":"", "realtime":"0", "diva": { "branch":"11", "line":"11011", "supplement":" ", "dir":"R", "project":"j17", "network":"voe", "stateless":"voe:11011: :R:j17", "tripCode":"254", "operator":"DVB", "opPublicCode":"DVB", "opCode":"16", "isSTT":"1", "attrs": [ ] } }, "hints": null, "stopSeq": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000003", "area":"1", "platform":"1", "gid":"de:14612:3", "pointGid":"de:14612:3:1:1", "attrs": [ ], "coords":"13.737355192,51.047155075", "depDateTime":"20170217 03:30", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000037", "area":"3", "platform":"4", "gid":"de:14612:37", "pointGid":"de:14612:37:3:4", "attrs": [ ], "coords":"13.733560349,51.050555626", "arrDateTime":"20170217 03:32", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } } ], "infos": { "info": { "paramList": [ ], "infoLinkText":"Testmeldung DELFIplus", "infoLinkURL":"http://192.168.150.204:8081/ics/XSLT_CM_SHOWADDINFO_REQUEST?infoID=74_VVO&seqID=1", "infoText": { "content":"Testmeldung für DELFIplus - alle Straßenbahnen in Dresden sind Niederflurstraßenbahnen", "subtitle":"Testmeldung DELFIplus", "subject":"Testmeldung", "additionalText":"" } } }, "format":"x,y", "path":"13.737354183,51.047128121 13.736854978,51.047126556 13.735942425,51.047131132 13.735628178,51.047117823 13.735170390,51.047079676 13.735056363,51.047081370 13.734971514,51.047100609 13.734859166,51.047147227 13.734803496,51.047184012 13.734775661,51.047202405 13.734735251,51.047265933 13.734695513,51.047347431 13.734631634,51.047546153 13.734437642,51.048079426 13.734308535,51.048440931 13.733920532,51.049507475 13.733660958,51.050194545 13.733557328,51.050474763 13.733531504,51.050547064", "attrs": [ { "name":"PlanWheelChairAccess", "value":"1" } ] } ], "itdFare": { "fares": { "fare": { "net":"voe", "toPR":"0", "fromPR":"0", "currency":"EUR", "unitName":"Preisstufe", "fareAdult":"2.30", "fareChild":"1.60", "unitsAdult":"1", "unitsChild":"1", "fareBikeAdult":"", "fareBikeChild":"", "unitsBikeAdult":"", "unitsBikeChild":"", "levelAdult":"", "levelChild":"", "idChild":"", "note":"" } }, "tickets": { "ticket": { "net":"voe", "toPR":"0", "fromPR":"0", "currency":"Euro", "weekAdult":"", "weekChild":"", "monthAdult":"", "monthChild":"", "weekEducation":"", "monthEducation":"", "yearAdults":"", "yearChildren":"", "yearStudents":"", "dayAdults":"", "dayChildren":"", "dayStudents":"", "levelAdult":"1", "levelChild":"1", "genericTickets": null } }, "tariffZones": { "tariffZone": { "net":"voe", "toPR":"0", "fromPR":"0", "neutralZone":"", "zones": { "zone": { "zoneElems": { "zoneElem": { "zone":"10" } } } } } }, "specialTickets": null }, "attrs": [ { "name":"JourneyDeparture", "value":"elapsed" } ] }, { "distance":"0", "duration":"00:08", "interchange":"0", "desc":"0", "optValue":"0", "legs": [ { "timeMinute":"6", "points": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Prager Straße", "usage":"departure", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:03", "rtDate":"17.02.2017", "rtTime":"04:03" }, "stamp": { "date":"20170217", "time":"403", "rtDate":"20170217", "rtTime":"403" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD6.pdf" } ], "ref": { "id":"33000003", "area":"1", "platform":"", "gid":"de:14612:3", "pointGid":"de:14612:3:1", "NaPTANID":"", "attrs": [ ], "coords":"13.737968087,51.047145957" } }, { "name":"Dresden Altmarkt", "nameWO":"Altmarkt", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Altmarkt", "usage":"arrival", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:09", "rtDate":"17.02.2017", "rtTime":"04:09" }, "stamp": { "date":"20170217", "time":"409", "rtDate":"20170217", "rtTime":"409" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD7.pdf" } ], "ref": { "id":"33000004", "area":"1", "platform":"2", "gid":"de:14612:4", "pointGid":"de:14612:4:1:2", "NaPTANID":"", "attrs": [ ], "coords":"13.738199891,51.050288903" } } ], "mode": { "name":"", "number":"", "symbol":"", "product":"Fussweg", "type":"99", "code":"-1", "destination":"", "destID":"0", "desc":"", "timetablePeriod":"", "realtime":"0", "diva": { "branch":"", "line":"", "supplement":" ", "dir":" ", "project":"", "network":"", "stateless":":: : :", "operator":"", "opCode":"", "attrs": [ ] } }, "hints": null, "stopSeq": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000003", "area":"1", "platform":"", "gid":"de:14612:3", "pointGid":"de:14612:3:1", "attrs": [ ], "coords":"13.737968087,51.047145957", "depDateTime":"20170217 04:03", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } }, { "name":"Dresden Altmarkt", "nameWO":"Altmarkt", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000004", "area":"1", "platform":"2", "gid":"de:14612:4", "pointGid":"de:14612:4:1:2", "attrs": [ ], "coords":"13.738199891,51.050288903", "arrDateTime":"20170217 04:09", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } } ], "footpath": [ { "position":"IDEST", "duration":"6", "footpathElem": [ { "description":"", "type":"LEVEL", "level":"LEVEL", "orig": { "stopID":"33000003", "area":"1", "platform":"", "x":"13.737968087", "y":"51.047145957", "mapName":"WGS84[DD.ddddd]", "georef":"2002600288:78:NAV4:100" }, "dest": { "stopID":"33000004", "area":"1", "x":"13.738082114", "y":"51.047144261", "mapName":"WGS84[DD.ddddd]", "georef":"2002600070:68:NAV4:100" } } ] } ], "infos": null, "format":"x,y", "path":"13.737968087,51.047145957 13.737967751,51.047136973 13.736854978,51.047126556 13.736831515,51.047261750 13.736827012,51.047522518 13.736829029,51.047576427 13.736809937,51.047828422 13.736927067,51.048671712 13.737032431,51.049200537 13.737164160,51.050052600 13.737216677,51.050312520 13.737249222,51.050419912 13.738199554,51.050279918 13.738199891,51.050288903" }, { "timeMinute":"2", "points": [ { "name":"Dresden Altmarkt", "nameWO":"Altmarkt", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Altmarkt", "usage":"departure", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:09", "rtDate":"17.02.2017", "rtTime":"04:09" }, "stamp": { "date":"20170217", "time":"409", "rtDate":"20170217", "rtTime":"409" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD7.pdf" } ], "ref": { "id":"33000004", "area":"1", "platform":"2", "gid":"de:14612:4", "pointGid":"de:14612:4:1:2", "NaPTANID":"", "attrs": [ ], "coords":"13.738199891,51.050288903" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Postplatz", "usage":"arrival", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:11", "rtDate":"17.02.2017", "rtTime":"04:11" }, "stamp": { "date":"20170217", "time":"411", "rtDate":"20170217", "rtTime":"411" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD8.pdf" } ], "ref": { "id":"33000037", "area":"1", "platform":"2", "gid":"de:14612:37", "pointGid":"de:14612:37:1:2", "NaPTANID":"", "attrs": [ ], "coords":"13.733955291,51.050819454" } } ], "mode": { "name":"Straßenbahn 2", "number":"2", "symbol":"2", "product":"Straßenbahn", "type":"4", "code":"4", "destination":" \"Gorbitz\"", "destID":"-1", "desc":"Kleinzschachwitz Freystraße - Betriebshof Gorbitz", "timetablePeriod":"", "realtime":"0", "diva": { "branch":"11", "line":"11002", "supplement":" ", "dir":"H", "project":"j17", "network":"voe", "stateless":"voe:11002: :H:j17", "tripCode":"2", "operator":"DVB", "opPublicCode":"DVB", "opCode":"16", "isSTT":"1", "attrs": [ ] } }, "hints": null, "stopSeq": [ { "name":"Dresden Altmarkt", "nameWO":"Altmarkt", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000004", "area":"1", "platform":"2", "gid":"de:14612:4", "pointGid":"de:14612:4:1:2", "attrs": [ ], "coords":"13.738199891,51.050288903", "depDateTime":"20170217 04:09", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000037", "area":"1", "platform":"2", "gid":"de:14612:37", "pointGid":"de:14612:37:1:2", "attrs": [ ], "coords":"13.733955291,51.050819454", "arrDateTime":"20170217 04:11", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } } ], "infos": { "info": { "paramList": [ ], "infoLinkText":"Testmeldung DELFIplus", "infoLinkURL":"http://192.168.150.204:8081/ics/XSLT_CM_SHOWADDINFO_REQUEST?infoID=74_VVO&seqID=1", "infoText": { "content":"Testmeldung für DELFIplus - alle Straßenbahnen in Dresden sind Niederflurstraßenbahnen", "subtitle":"Testmeldung DELFIplus", "subject":"Testmeldung", "additionalText":"" } } }, "format":"x,y", "path":"13.738199554,51.050279918 13.737249222,51.050419912 13.735857331,51.050575451 13.734607305,51.050710887 13.733954619,51.050801485", "attrs": [ { "name":"PlanWheelChairAccess", "value":"1" } ] } ], "itdFare": { "fares": { "fare": { "net":"voe", "toPR":"1", "fromPR":"0", "currency":"EUR", "unitName":"Preisstufe", "fareAdult":"2.30", "fareChild":"1.60", "unitsAdult":"1", "unitsChild":"1", "fareBikeAdult":"", "fareBikeChild":"", "unitsBikeAdult":"", "unitsBikeChild":"", "levelAdult":"", "levelChild":"", "idChild":"", "note":"" } }, "tickets": { "ticket": { "net":"voe", "toPR":"1", "fromPR":"0", "currency":"Euro", "weekAdult":"", "weekChild":"", "monthAdult":"", "monthChild":"", "weekEducation":"", "monthEducation":"", "yearAdults":"", "yearChildren":"", "yearStudents":"", "dayAdults":"", "dayChildren":"", "dayStudents":"", "levelAdult":"1", "levelChild":"1", "genericTickets": null } }, "tariffZones": { "tariffZone": { "net":"voe", "toPR":"1", "fromPR":"0", "neutralZone":"", "zones": { "zone": { "zoneElems": { "zoneElem": { "zone":"10" } } } } } }, "specialTickets": null }, "attrs": [ ] }, { "distance":"0", "duration":"00:02", "interchange":"0", "desc":"1", "optValue":"0", "legs": [ { "timeMinute":"2", "points": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Prager Straße", "usage":"departure", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:10", "rtDate":"17.02.2017", "rtTime":"04:10" }, "stamp": { "date":"20170217", "time":"410", "rtDate":"20170217", "rtTime":"410" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD3.pdf" } ], "ref": { "id":"33000003", "area":"1", "platform":"1", "gid":"de:14612:3", "pointGid":"de:14612:3:1:1", "NaPTANID":"", "attrs": [ ], "coords":"13.737355192,51.047155075" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Postplatz", "usage":"arrival", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:12", "rtDate":"17.02.2017", "rtTime":"04:12" }, "stamp": { "date":"20170217", "time":"412", "rtDate":"20170217", "rtTime":"412" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD4.pdf" } ], "ref": { "id":"33000037", "area":"3", "platform":"4", "gid":"de:14612:37", "pointGid":"de:14612:37:3:4", "NaPTANID":"", "attrs": [ ], "coords":"13.733560349,51.050555626" } } ], "mode": { "name":"Straßenbahn 11", "number":"11", "symbol":"11", "product":"Straßenbahn", "type":"4", "code":"4", "destination":" \"Bühlau\"", "destID":"-1", "desc":"Zschertnitz Münzmeisterstr. - Kongresszentrum / Haus der Presse", "timetablePeriod":"", "realtime":"0", "diva": { "branch":"11", "line":"11011", "supplement":" ", "dir":"R", "project":"j17", "network":"voe", "stateless":"voe:11011: :R:j17", "tripCode":"21", "operator":"DVB", "opPublicCode":"DVB", "opCode":"16", "isSTT":"1", "attrs": [ ] } }, "hints": null, "stopSeq": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000003", "area":"1", "platform":"1", "gid":"de:14612:3", "pointGid":"de:14612:3:1:1", "attrs": [ ], "coords":"13.737355192,51.047155075", "depDateTime":"20170217 04:10", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000037", "area":"3", "platform":"4", "gid":"de:14612:37", "pointGid":"de:14612:37:3:4", "attrs": [ ], "coords":"13.733560349,51.050555626", "arrDateTime":"20170217 04:12", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } } ], "infos": { "info": { "paramList": [ ], "infoLinkText":"Testmeldung DELFIplus", "infoLinkURL":"http://192.168.150.204:8081/ics/XSLT_CM_SHOWADDINFO_REQUEST?infoID=74_VVO&seqID=1", "infoText": { "content":"Testmeldung für DELFIplus - alle Straßenbahnen in Dresden sind Niederflurstraßenbahnen", "subtitle":"Testmeldung DELFIplus", "subject":"Testmeldung", "additionalText":"" } } }, "format":"x,y", "path":"13.737354183,51.047128121 13.736854978,51.047126556 13.735942425,51.047131132 13.735628178,51.047117823 13.735170390,51.047079676 13.735056363,51.047081370 13.734971514,51.047100609 13.734859166,51.047147227 13.734803496,51.047184012 13.734775661,51.047202405 13.734735251,51.047265933 13.734695513,51.047347431 13.734631634,51.047546153 13.734437642,51.048079426 13.734308535,51.048440931 13.733920532,51.049507475 13.733660958,51.050194545 13.733557328,51.050474763 13.733531504,51.050547064", "attrs": [ { "name":"PlanWheelChairAccess", "value":"1" } ] } ], "itdFare": { "fares": { "fare": { "net":"voe", "toPR":"0", "fromPR":"0", "currency":"EUR", "unitName":"Preisstufe", "fareAdult":"2.30", "fareChild":"1.60", "unitsAdult":"1", "unitsChild":"1", "fareBikeAdult":"", "fareBikeChild":"", "unitsBikeAdult":"", "unitsBikeChild":"", "levelAdult":"", "levelChild":"", "idChild":"", "note":"" } }, "tickets": { "ticket": { "net":"voe", "toPR":"0", "fromPR":"0", "currency":"Euro", "weekAdult":"", "weekChild":"", "monthAdult":"", "monthChild":"", "weekEducation":"", "monthEducation":"", "yearAdults":"", "yearChildren":"", "yearStudents":"", "dayAdults":"", "dayChildren":"", "dayStudents":"", "levelAdult":"1", "levelChild":"1", "genericTickets": null } }, "tariffZones": { "tariffZone": { "net":"voe", "toPR":"0", "fromPR":"0", "neutralZone":"", "zones": { "zone": { "zoneElems": { "zoneElem": { "zone":"10" } } } } } }, "specialTickets": null }, "attrs": [ ] }, { "distance":"0", "duration":"00:02", "interchange":"0", "desc":"1", "optValue":"0", "legs": [ { "timeMinute":"2", "points": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Prager Straße", "usage":"departure", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:23", "rtDate":"17.02.2017", "rtTime":"04:23" }, "stamp": { "date":"20170217", "time":"423", "rtDate":"20170217", "rtTime":"423" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BDA.pdf" } ], "ref": { "id":"33000003", "area":"1", "platform":"1", "gid":"de:14612:3", "pointGid":"de:14612:3:1:1", "NaPTANID":"", "attrs": [ ], "coords":"13.737355192,51.047155075" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden Postplatz", "usage":"arrival", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"04:25", "rtDate":"17.02.2017", "rtTime":"04:25" }, "stamp": { "date":"20170217", "time":"425", "rtDate":"20170217", "rtTime":"425" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BDB.pdf" } ], "ref": { "id":"33000037", "area":"7", "platform":"5", "gid":"de:14612:37", "pointGid":"de:14612:37:7:5", "NaPTANID":"", "attrs": [ ], "coords":"13.732338489,51.050681630" } } ], "mode": { "name":"Stadtbus 62", "number":"62", "symbol":"62", "product":"Stadtbus", "type":"3", "code":"5", "destination":" \"Dienstfahrt\"", "destID":"-1", "desc":"%Kretschmerstraße%85 - Postplatz (DVB-Service)", "timetablePeriod":"", "realtime":"0", "diva": { "branch":"21", "line":"21062", "supplement":" ", "dir":"H", "project":"j17", "network":"voe", "stateless":"voe:21062: :H:j17", "tripCode":"505", "operator":"DVB", "opPublicCode":"DVB", "opCode":"16", "isSTT":"1", "attrs": [ ] } }, "hints": null, "stopSeq": [ { "name":"Dresden Prager Straße", "nameWO":"Prager Straße", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000003", "area":"1", "platform":"1", "gid":"de:14612:3", "pointGid":"de:14612:3:1:1", "attrs": [ ], "coords":"13.737355192,51.047155075", "depDateTime":"20170217 04:23", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } }, { "name":"Dresden Postplatz", "nameWO":"Postplatz", "place":"Dresden", "nameWithPlace":"", "omc":"14612000", "placeID":"1", "platformName":"", "desc":"", "ref": { "id":"33000037", "area":"7", "platform":"5", "gid":"de:14612:37", "pointGid":"de:14612:37:7:5", "attrs": [ ], "coords":"13.732338489,51.050681630", "arrDateTime":"20170217 04:25", "arrDelay":"-1", "arrValid":"0", "depDelay":"-1", "depValid":"0" } } ], "infos": null, "format":"x,y", "path":"13.737354183,51.047128121 13.736854978,51.047126556 13.735942425,51.047131132 13.735628178,51.047117823 13.735170390,51.047079676 13.735056363,51.047081370 13.734971514,51.047100609 13.734859166,51.047147227 13.734803496,51.047184012 13.734827973,51.047075772 13.734324740,51.046966380 13.733550360,51.046852020 13.733604866,51.047165850 13.733527400,51.047382752 13.733396274,51.047690348 13.733227084,51.048124364 13.733084384,51.048504049 13.732758566,51.049326945 13.732614182,51.049661705 13.732483715,51.049987270 13.732444642,51.050086736 13.732316856,51.050484177 13.732352744,51.050681418", "attrs": [ { "name":"PlanWheelChairAccess", "value":"1" } ] } ], "itdFare": { "fares": { "fare": { "net":"voe", "toPR":"0", "fromPR":"0", "currency":"EUR", "unitName":"Preisstufe", "fareAdult":"2.30", "fareChild":"1.60", "unitsAdult":"1", "unitsChild":"1", "fareBikeAdult":"", "fareBikeChild":"", "unitsBikeAdult":"", "unitsBikeChild":"", "levelAdult":"", "levelChild":"", "idChild":"", "note":"" } }, "tickets": { "ticket": { "net":"voe", "toPR":"0", "fromPR":"0", "currency":"Euro", "weekAdult":"", "weekChild":"", "monthAdult":"", "monthChild":"", "weekEducation":"", "monthEducation":"", "yearAdults":"", "yearChildren":"", "yearStudents":"", "dayAdults":"", "dayChildren":"", "dayStudents":"", "levelAdult":"1", "levelChild":"1", "genericTickets": null } }, "tariffZones": { "tariffZone": { "net":"voe", "toPR":"0", "fromPR":"0", "neutralZone":"", "zones": { "zone": { "zoneElems": { "zoneElem": { "zone":"10" } } } } } }, "specialTickets": null }, "attrs": [ ] }, { "distance":"461", "duration":"00:07", "interchange":"0", "desc":"-1", "legs": [ { "timeMinute":"7", "points": [ { "name":"Dresden, Prager Straße", "nameWO":"Prager Straße", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden, Prager Straße", "usage":"departure", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"03:45", "rtDate":"17.02.2017", "rtTime":"03:45" }, "stamp": { "date":"20170217", "time":"345", "rtDate":"20170217", "rtTime":"345" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD1.pdf" } ], "ref": { "id":"33000003", "area":"", "platform":"", "NaPTANID":"", "attrs": [ ], "coords":"13.737203112,51.047283193" } }, { "name":"Dresden, Postplatz", "nameWO":"Postplatz", "platformName":"", "place":"Dresden", "nameWithPlace":"Dresden, Postplatz", "usage":"arrival", "omc":"14612000", "placeID":"1", "desc":"", "dateTime": { "date":"17.02.2017", "time":"03:52", "rtDate":"17.02.2017", "rtTime":"03:52" }, "stamp": { "date":"20170217", "time":"352", "rtDate":"20170217", "rtTime":"352" }, "links": [ { "type":"RM", "href":"FILELOAD?Filename=vvo_58A663BD1.pdf" } ], "ref": { "id":"33000037", "area":"", "platform":"", "NaPTANID":"", "attrs": [ ], "coords":"13.733690452,51.049456952" } } ], "mode": { "name":"", "number":"", "symbol":"", "product":"Fussweg", "type":"100", "code":"-1", "destination":"", "destID":"-1", "desc":"", "timetablePeriod":"", "realtime":"0", "diva": { "branch":"", "line":"", "supplement":" ", "dir":" ", "project":"", "network":"", "stateless":":: : :", "operator":"", "opCode":"", "attrs": [ ] } }, "hints": null, "infos": null, "format":"x,y", "path":"13.737203112,51.047283193 13.737203112,51.047283193 13.737074495,51.047276116 13.736831515,51.047261750 13.736145669,51.047226998 13.736058330,51.047560915 13.734743311,51.047481566 13.734705252,51.047607987 13.734446708,51.048322013 13.734315586,51.048629610 13.734136847,51.049189624 13.734020982,51.049523963 13.733920532,51.049507475 13.733690787,51.049465937 13.733690452,51.049456952", "turnInst": [ { "dir":"STRAIGHT", "manoeuvre":"ORIGIN", "name":"Dr.-Külz-Ring", "dirHint":"", "place":"", "skyDir":"84", "tTime":"66", "ctTime":"66", "dis":"74", "cDis":"74", "fPLIdx":"0", "tPLIdx":"2", "fPCIdx":"0", "tPCIdx":"3", "attrs": [ ], "coords":"13.737203112,51.047283193" }, { "dir":"RIGHT", "manoeuvre":"TURN", "name":"Webergasse", "dirHint":"", "place":"", "skyDir":"169", "tTime":"33", "ctTime":"99", "dis":"38", "cDis":"112", "fPLIdx":"3", "tPLIdx":"3", "fPCIdx":"3", "tPCIdx":"4", "attrs": [ ], "coords":"13.736145669,51.047226998" }, { "dir":"LEFT", "manoeuvre":"TURN", "name":"Dr.-Külz-Ring", "dirHint":"", "place":"", "skyDir":"83", "tTime":"82", "ctTime":"181", "dis":"93", "cDis":"205", "fPLIdx":"4", "tPLIdx":"4", "fPCIdx":"4", "tPCIdx":"5", "attrs": [ ], "coords":"13.736058330,51.047560915" }, { "dir":"RIGHT", "manoeuvre":"TURN", "name":"Wallstraße", "dirHint":"", "place":"", "skyDir":"168", "tTime":"206", "ctTime":"387", "dis":"232", "cDis":"437", "fPLIdx":"5", "tPLIdx":"9", "fPCIdx":"5", "tPCIdx":"10", "attrs": [ ], "coords":"13.734743311,51.047481566" }, { "dir":"LEFT", "manoeuvre":"DESTINATION", "name":"Antonsplatz", "dirHint":"", "place":"", "skyDir":"74", "tTime":"21", "ctTime":"408", "dis":"24", "cDis":"461", "fPLIdx":"10", "tPLIdx":"11", "fPCIdx":"10", "tPCIdx":"12", "attrs": [ ], "coords":"13.734020982,51.049523963" } ] } ], "itdFare": { "fares": null, "tickets": null, "tariffZones": null, "specialTickets": null }, "attrs": [ ] } ] } diff --git a/test/test.js b/test/test.js index 343c953..670e5a5 100644 --- a/test/test.js +++ b/test/test.js @@ -151,97 +151,6 @@ describe('dvb.monitor', function () { }) }); -describe('dvb.route', function () { - describe('dvb.route "Prager Straße -> Postplatz"', function () { - mockRequest('route-pragerstr-postplatz.json'); - - function assertTrip(trip) { - assert(trip.departure); - assert(trip.arrival); - assert(trip.duration); - assert.strictEqual('number', typeof trip.interchange); - - assert(Array.isArray(trip.nodes)); - trip.nodes.forEach(assertNode); - } - - function assertNode(node) { - assert(node.mode); - assert(node.line || node.line === ''); - assert(node.direction || node.direction === ''); - - assert.strictEqual('object', typeof node.departure); - assert(node.departure.stop); - assert(node.departure.time); - - assert(Array.isArray(node.departure.coords)); - assert.strictEqual(2, node.departure.coords.length); - - assert.strictEqual('object', typeof node.arrival); - assert(node.arrival.stop); - assert(node.arrival.time); - - assert(Array.isArray(node.arrival.coords)); - assert.strictEqual(2, node.arrival.coords.length); - - assert(Array.isArray(node.path)); - node.path.forEach(function (path) { - assert(Array.isArray(path)); - assert.strictEqual(2, path.length); - assert.strictEqual(51, Math.floor(path[0])); - assert.strictEqual(13, Math.floor(path[1])); - }); - } - - it('should return the correct origin and destination', function (done) { - dvb.route('pragerstrasse', 'postplatz', new Date(), dvb.route.DEPARTURE) - .then(function (data) { - assert.strictEqual('Dresden, Prager Straße', data.origin); - assert.strictEqual('Dresden, Postplatz', data.destination); - done(); - }) - .catch(function (err) { - done(err); - }); - }); - - it('should return an array of trips', function (done) { - dvb.route('pragerstrasse', 'postplatz', new Date(), dvb.route.DEPARTURE) - .then(function (data) { - assert(Array.isArray(data.trips)); - assert(data.trips.length > 0); - data.trips.forEach(assertTrip); - done(); - }) - .catch(function (err) { - done(err); - }); - }); - - it('should return a Promise but still accept a callback', function (done) { - dvb.route('pragerstrasse', 'postplatz', new Date(), dvb.route.DEPARTURE, function (err, data) { - assert(data); - done(); - }).then(assert); - }); - }); - - describe('dvb.route "0 -> 0"', function () { - mockRequest('empty.json'); - - it('should return null', function (done) { - dvb.route('0', '0', new Date(), 'foo') - .then(function (data) { - assert.equal(null, data); - done(); - }) - .catch(function (err) { - done(err); - }); - }); - }); -}); - describe('dvb.find', function () { describe('dvb.find "Postplatz"', function () { mockRequest('find-Postpl.json'); From a40c3de8e79abd1bee441fe80134ce4677acc37e Mon Sep 17 00:00:00 2001 From: Andreas Hippler Date: Mon, 16 Oct 2017 08:57:21 +0200 Subject: [PATCH 4/6] 4.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bcda27a..30cd70f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dvbjs", - "version": "4.3.5", + "version": "4.3.6", "description": "query Dresden's public transport system for current bus- and tramstop data", "main": "index", "files": [ From 8a462c98ee609728dc1f03063be7dcd38af89804 Mon Sep 17 00:00:00 2001 From: Andreas Hippler Date: Mon, 16 Oct 2017 09:09:54 +0200 Subject: [PATCH 5/6] fix readme: remove route --- README.md | 61 ------------------------------------------------------- 1 file changed, 61 deletions(-) diff --git a/README.md b/README.md index 946fad7..ea5c69d 100644 --- a/README.md +++ b/README.md @@ -116,67 +116,6 @@ Output: ] ``` -### Find routes - -Query the server for possible routes from one stop to another. Returns multiple possible trips, the bus-/tramlines to be taken, the single stops, their arrival and departure times and their GPS coordinates. - -Example: - -```js -var origin = 'Helmholtzstraße'; -var destination = 'Zellescher Weg'; -var time = new Date(); // starting at what time -var deparr = dvb.route.DEPARTURE; // set to dvb.route.DEPARTURE for the time to be the departure time, dvb.route.ARRIVAL for arrival time - -dvb.route(origin, destination, time, deparr, function(err, data) { - if (err) throw err; - console.log(JSON.stringify(data, null, 4)); -}); -``` - -Output: - -```js -{ - "origin": "Dresden, Helmholtzstraße", - "destination": "Dresden, Zellescher Weg", - "trips": [{ - "departure": "13:34", - "arrival": "13:56", - "duration": "00:22", - "interchange": 2, - "nodes": [{ - "mode": "Stadtbus", - "line": "85", - "direction": "DD Löbtau Süd Mohorner Str.", - "departure": { - "stop": "Helmholtzstraße", - "time": "13:34", - "coords": [ 51.025549, 13.725457 ] - }, - "arrival": { - "stop": "Plauen Nöthnitzer Straße", - "time": "13:36", - "coords": [ 51.027625, 13.715769 ] - }, - "path": [[ 51.02554, 13.725471 ],[ 51.02557, 13.725286 ], ...] - }, - {...} - ] - }, { - "departure": "14:02", - "arrival": "14:11", - "duration": "00:09", - "interchange": 1, - "nodes": [...] - }, - {...} - ] -} -``` - -The path property contains an array consisting of all the coordinates describing the path of this node. This can be useful to draw the route on a map. - ### Find stops by name Search for a single stop in the network of the DVB. Returns an array of all possible hits including their GPS coordinates. From 2df607047f6e88540869617a91e724c6cecfb76e Mon Sep 17 00:00:00 2001 From: Andreas Hippler Date: Mon, 16 Oct 2017 09:10:16 +0200 Subject: [PATCH 6/6] 4.3.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30cd70f..352df84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dvbjs", - "version": "4.3.6", + "version": "4.3.7", "description": "query Dresden's public transport system for current bus- and tramstop data", "main": "index", "files": [