GithubHelp home page GithubHelp logo

irail / irail Goto Github PK

View Code? Open in Web Editor NEW
111.0 12.0 27.0 5.35 MB

iRail API / scraper

Home Page: http://api.irail.be

License: GNU Affero General Public License v3.0

PHP 38.93% HTML 60.87% Dockerfile 0.20%
nmbs sncb opendata public-transport

irail's Introduction

iRail

License AGPL-3.0 Join the chat at https://gitter.im/iRail/iRail

iRail supports digital creativity concerning mobility in Belgium. This is an attempt to make the railway time schedules in Belgium easily available for anyone.

Our main site consists of a very easy mobile website to look up time schedules using our own API.

Native applications using the iRail API and created or supported by the iRail team are named BeTrains and RailerApp.

All information can be found on our blog at hello.iRail.be.

API Documentation

API Documentation can be found at https://docs.irail.be.

Installation for development purposes

note: you'll also need to have nodejs, composer and the PHP extensions listed in composer.json installed on your system

  • Step 1: Clone this repo
  • Step 2: Create an .env file which will contain your configuration.
  • CACHE_DRIVER should be set to apc, an in-memory cache with good performance.
  • NMBS_RIV_API_KEY should contain a valid API key for the internal NMBS RIV API.
  • GTFS_RANGE_DAYS_BACKWARDS and GTFS_RANGE_DAYS_FORWARDS define how long in the past and future GTFS data will be
  • APP_TIMEZONE should be set to EUROPE/BRUSSELS to ensure correct times in the responses, since several date/times without timezone information are parsed and interpreted at this timezone. read. This will affect memory usage, and limits the date ranges of some API endpoints.
  • Step 4: Run the docker-compose configuration, which consists of nginx, mariadb and the actual PHP application. If you want to use sqlite, adjust the database configuration. Note that sqlite is untested.
  • Step 5: When using mariadb, ensure a database exists on the mariadb server. It should match the database credentials specified for the php application in the docker-compose file.
  • Step 6: Run the database migrations in order to create the necessary database tables: php artisan migrate
  • Step 7: Enjoy your own iRail API at http://localhost:8080/. All routes are defined in the routes file. See the laravel docs for more information if needed.

Caching and performance

A working cache is required for the API to work correctly. Ensure APC is configured correctly when running this outside of the docker environment. Outgoing requests to NMBS servers should always be limited as much as possible!

Update stations list

Stations are updated through the irail/stations composer package. Just perform a composer update in the root of the project.

More links

irail's People

Contributors

121593 avatar altesack avatar bertware avatar brechtvdv avatar cimm avatar czmoodydev avatar dependabot[bot] avatar eriksmets avatar gitter-badger avatar haroenv avatar jncn avatar laurentvb avatar ludovic-gasc avatar mathiasbynens avatar nikoandpiko avatar nimaamiri92 avatar pietercolpaert avatar qkaiser avatar ronplanken avatar seppestas avatar stancallewaert avatar tjoosten avatar tuinslak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

irail's Issues

sometimes vehicle info returns invalid JSON string

colon is missing before last item:

http://api.irail.be/liveboard/?arrdep=ARR&fast=true&station=Brussel-Zuid&lang=nl&format=jsonp&callback=define&time=1731&date=01102012

returned
define({"version":"1.1","timestamp":"1326207718","station":"Brussel Zuid","stationinfo":{"id":"BE.NMBS.008814001","locationX":"4.336922","locationY":"50.836782","name":"Brussel Zuid","standardname":"Brussels South"},"arrivals":{"number":"23","arrival":[{"id":"0","delay":"0","station":"Jemeppe-Sur-Sambre","stationinfo":{"name":"Jemeppe-Sur-Sambre"},"time":"1326211920","vehicle":"BE.NMBS.P8722","platform":"21","platforminfo":{"name":"21","normal":"1"},"left":"0"},{"id":"1","delay":"0","station":"Oostende","stationinfo":{"name":"Oostende"},"time":"1326212040","vehicle":"BE.NMBS.P8005","platform":"15","platforminfo":{"name":"15","normal":"1"},"left":"0"},{"id":"2","delay":"0","station":"Gent-Sint-Pieters","stationinfo":{"name":"Gent-Sint-Pieters"},"time":"1326212100","vehicle":"BE.NMBS.P8014","platform":"10","platforminfo":{"name":"10","normal":"1"},"left":"0"},{"id":"3","delay":"0","station":"Leuven","stationinfo":{"name":"Leuven"},"time":"1326212160","vehicle":"BE.NMBS.CR3766","platform":"14","platforminfo":{"name":"14","normal":"1"},"left":"0"},{"id":"4","delay":"0","station":"Nijvel","stationinfo":{"name":"Nijvel"},"time":"1326212220","vehicle":"BE.NMBS.L6387","platform":"21","platforminfo":{"name":"21","normal":"1"},"left":"0"},{"id":"5","delay":"0","station":"Brussel-Zuid","stationinfo":{"name":"Brussel-Zuid"},"time":"1326212280","vehicle":"BE.NMBS.CR6587","platform":"17","platforminfo":{"name":"17","normal":"1"},"left":"0"},{"id":"6","delay":"0","station":"Sint-Niklaas","stationinfo":{"name":"Sint-Niklaas"},"time":"1326212340","vehicle":"BE.NMBS.IC2315","platform":"8","platforminfo":{"name":"8","normal":"1"},"left":"0"},{"id":"7","delay":"0","station":"Louvain-La-Neuve-Univ.","stationinfo":{"name":"Louvain-La-Neuve-Univ."},"time":"1326212340","vehicle":"BE.NMBS.IR3916","platform":"13","platforminfo":{"name":"13","normal":"1"},"left":"0"},{"id":"8","delay":"0","station":"Antwerpen-Centraal","stationinfo":{"name":"Antwerpen-Centraal"},"time":"1326212400","vehicle":"BE.NMBS.IR2816","platform":"20","platforminfo":{"name":"20","normal":"1"},"left":"0"},{"id":"9","delay":"0","station":"Moeskroen","stationinfo":{"name":"Moeskroen"},"time":"1326212460","vehicle":"BE.NMBS.P8513","platform":"9","platforminfo":{"name":"9","normal":"1"},"left":"0"},{"id":"10","delay":"0","station":"Oudenaarde","stationinfo":{"name":"Oudenaarde"},"time":"1326212460","vehicle":"BE.NMBS.P8906","platform":"","platforminfo":{"name":"","normal":"1"},"left":"0"},{"id":"11","delay":"0","station":"Brussel-Zuid","stationinfo":{"name":"Brussel-Zuid"},"time":"1326212520","vehicle":"BE.NMBS.IC3437","platform":"","platforminfo":{"name":"","normal":"1"},"left":"0"},{"id":"12","delay":"0","station":"Knokke","stationinfo":{"name":"Knokke"},"time":"1326212640","vehicle":"BE.NMBS.IC1538","platform":"15","platforminfo":{"name":"15","normal":"1"},"left":"0"},{"id":"13","delay":"0","station":"Essen","stationinfo":{"name":"Essen"},"time":"1326212700","vehicle":"BE.NMBS.IC4516","platform":"18","platforminfo":{"name":"18","normal":"1"},"left":"0"},{"id":"14","delay":"0","station":"Geraardsbergen","stationinfo":{"name":"Geraardsbergen"},"time":"1326212760","vehicle":"BE.NMBS.CR1588","platform":"7","platforminfo":{"name":"7","normal":"1"},"left":"0"},{"id":"15","delay":"0","station":"Luik-Guillemins","stationinfo":{"name":"Luik-Guillemins"},"time":"1326212820","vehicle":"BE.NMBS.IC1716","platform":"6","platforminfo":{"name":"6","normal":"1"},"left":"0"},{"id":"16","delay":"0","station":"Brussel-Zuid","stationinfo":{"name":"Brussel-Zuid"},"time":"1326212820","vehicle":"BE.NMBS.IC2137","platform":"13","platforminfo":{"name":"13","normal":"1"},"left":"0"},{"id":"17","delay":"0","station":"Kortrijk","stationinfo":{"name":"Kortrijk"},"time":"1326212880","vehicle":"BE.NMBS.IR3139","platform":"20","platforminfo":{"name":"20","normal":"1"},"left":"0"},{"id":"18","delay":"0","station":"Brussel-Nat-Luchthaven","stationinfo":{"name":"Brussel-Nat-Luchthaven"},"time":"1326212880","vehicle":"BE.NMBS.IR3516","platform":"","platforminfo":{"name":"","normal":"1"},"left":"0"},{"id":"19","delay":"0","station":"Quievrain","stationinfo":{"name":"Quievrain"},"time":"1326212940","vehicle":"BE.NMBS.IC1738","platform":"10","platforminfo":{"name":"10","normal":"1"},"left":"0"},{"id":"20","delay":"0","station":"Gent-Sint-Pieters","stationinfo":{"name":"Gent-Sint-Pieters"},"time":"1326213000","vehicle":"BE.NMBS.IR3538","platform":"","platforminfo":{"name":"","normal":"1"},"left":"0"},{"id":"21","delay":"0","station":"Antwerpen-Centraal","stationinfo":{"name":"Antwerpen-Centraal"},"time":"1326213000","vehicle":"BE.NMBS.IR3115","platform":"17","platforminfo":{"name":"17","normal":"1"},"left":"0"}{"id":"21","delay":"0","station":"Antwerpen-Centraal","stationinfo":{"name":"Antwerpen-Centraal"},"time":"1326213000","vehicle":"BE.NMBS.IR3115","platform":"17","platforminfo":{"name":"17","normal":"1"},"left":"0"}]}})

Deprecate PHP5.3

We have finally moved to PHP5.4+ on our new server infrastructure! \o/!

Now it's time to start using composer packages and deprecate PHP5.3 constructs.

  • use guzzle/guzzle for HTTP calls
  • methods returning arrays can now also be used as an array with square brackets
  • ...

Add properties to Vehicle object

For each stop show:

  • delay
  • delay forecast for future stops
    Delays are only visible in Departures/Arrivals for now. It's more logical to keep delays attached to the Vehicle object.
  • has_arrived (BOOL)
  • has_left (BOOL)
    These two properties make it easier to determine if a (delayed) train is currently parked in a station or on it's way to another.

Canceled trains are not indicated in the connection API (and nowhere on the website)

This one is in fact 2 bugs..

  1. When using iRail.be website for a station liveboards, the canceled trains are not shown, while the info is available on the Stations API, see the Android client:

1

  1. this "canceled" information is not shown in the connection API, giving no clue to the user that his train is in fact canceled, which is a huge problem!

id: "0",
departure: {
delay: "0",
station: "Tournai",
stationinfo: {
id: "BE.NMBS.008885001",
locationX: "3.396936",
locationY: "50.613125",
name: "Tournai",
standardname: "Tournai"
},
time: "1404125820",
vehicle: "BE.NMBS.IC912",
platform: "2",
platforminfo: {
name: "2",
normal: "1"
},
direction: {
id: "BE.NMBS.008841608",
locationX: "5.62235",
locationY: "50.6604",
name: "Herstal",
standardname: "Herstal"
}
},
arrival: {
delay: "0",
station: "Mons",
stationinfo: {
id: "BE.NMBS.008881000",
locationX: "3.942303",
locationY: "50.45445",
name: "Mons",
standardname: "Mons"
},
time: "1404127440",
vehicle: "BE.NMBS.IC912",
platform: "2",
platforminfo: {
name: "2",
normal: "1"
},
direction: {
id: "BE.NMBS.008841608",
locationX: "5.62235",
locationY: "50.6604",
name: "Herstal",
standardname: "Herstal"
}
},
duration: "1620"

screenshot_2014-06-30-12-39-03

Wrong timezone on connections endpoint

Take a connection between 2 Belgian stations, Aalter to Aalst for example. The result will look something like:

<time formatted="2015-03-21T05:23:00Z">1426911780</time>

The formatted date string has an extra Z at the end meaning Zulu time or UTC or GMT according to the ISO 8601 standard (and explained in the iRail API docs). This is the UK timezone, not the Belgian one, we live in the Central European Timezone or CET.

So, the API basically returns 2 different times for the same event. The timestamp from the example would indicate the train leaves at 04:23:00 GMT while the formatted time tells you it's leaving an hour later.

I would just drop the Z in the formatted time. The ISO 8601 standard says that when no UTC relation information is given the time is assumed to be in local time, exactly what we want here (not sure if the API can return train connections that cross timezones like the Eurostar for example, in that case we probably want the timezone in there).

Timezones and programming... we'll never be friends.

Wrong HTTP status code on badly formatted URL

The server resonds with a nice error message when sending a badly formated request like http://api.irail.be/connections/?from=&to=.

The HTTP status code hower is 401 or Unauthorized which is specifically used when authentication is required. The correct status code in this case is a simple 400 or Bad Request.

This is important as my client side library now has to understand a 401 is not really a 401 and should pretend it's a 400. Extra code needed on the client which could be fixed on the server side.

To delete

Sorry for the onconveniance.. Wrong bug...

Made by Yeri Tiete

On the bottom of irail.be - Can we change that to a link to the "irail.be team"?

Pieter

Improvement idea for Pieter

As we talked a few minuts before with Pieter, I add this improvement in the issue section.
This will be moved in the future in the project page, but for "alzeihmer victim" purpose, i write it now.

For now, when we have more than one train to take and change gate at the station, the API gives:

 <trains>
      <train>
      IR 1234
      </train>
      <train>
      IC 6969
      </train>
 </trains>

I really would like to make something smarter and use the "detail for all" button on SNCB/NMBS website. That will provide a new web page with a really lot informations:

BEFORE: http://img.skitch.com/20100810-qi8yki9qnaxiyw8hh998a226yq.jpg

AFTER: http://img.skitch.com/20100810-fq2imqjh26cd2rsyxmwtaryxc7.jpg

So as you can understand, this feature might be a problem with the "KISS"
(Keep It Short & Simple) way of thinking, but we can do something smart.

  1. keep the train tag for the train number, so that won't change a lot of stuff for developers
  2. add informations with "link" tag (maybe there is a better english word)
 <links>
 <link>
     <startcity>
      Brussel
      </startcity>
      <starttime>
      13:03
      </starttime>
      <startgate>
      6
      </startgate>
      <train>
      IR 1234
      </train>
    <stopcity>
      Liege
      </stopcity>
      <stoptime>
      13:33
      </stoptime>
      <stopgate>
      11
      </stopgate>
 </link>
 <link>
     <startcity>
      Liege
      </startcity>
      <starttime>
      14:23
      </starttime>
      <startgate>
      3
      </startgate>
      <train>
      IC 6969
      </train>
    <stopcity>
      Aachen
      </stopcity>
      <stoptime>
      14:53
      </stoptime>
      <stopgate>
      1
      </stopgate>
 </link>
 </links>

Maybe you will find something better but I found these informations really usefull.

Having all these informations in one request seem amazing!

switch button

The "Switch" button doesn't work in Internet Explorer (8, don't know about 6 and 7).

mismatch between railtime info and iRail

I'm writing this after the redirection from the hyperRail github issues #93.

Basically, I see that there is a problem with the scraper.
Example: train 3639 from Landen to De Panne on 2015-02-20 vs the same info from railtime. Warning: limited time view (till the end of this week for both sources).

  1. First issue: scroll to item 7 from the iRail view: it shows the stop is Brussels-South. It should be Brussels-North. Stop number 9 is correct though, so you have Brussels-South twice in that view.
  2. Second issue: the delays do not match with the delays shown on the railtime page.

I'm mentioning this because I'm still interested in an alternative data provider for my delay tracker project, but it looks like the iRail scraper still has a few issues. Currently, my own scraper (written in python) is performing better although I have my own bug which I can't seem to get rid of. But I'm aware of how silly it is for several developers to be scraping the same sources, especially when there are those who support the "open data" ideology.

I'd dig through some of the iRail API code to find out where the issue is originating, but my PHP is rusty and I thought I'd already mention this now. You might find it quicker than me (also I don't have much time this week).

Error 502 for past train

youri:Temp $ curl "http://api.irail.be/connections/?from=Ottignies&to=Louvain-la-Neuve&typeOfTransport=train&date=101114" | xmllint --format -
<?xml version="1.0"?>
<error code="502">Could not get data. Please report this problem to [email protected].</error>

When requesting Departures, account for delays

Example:
Train A leaves at 9:20 and has a delay of 7 minutes
Train B leaves at 9:25
Train C leaves at 9:30

Request at 9:19 will show A, B and C
Request at 9:20 will show A, B and C
Requests from 9:21 until 9:25 will show B and C, while A still hasn't departed
Request from 9:26 until 9:30 will show C while train A was still arriving/departing until 9:27

License

Hi,

At this moment the license is a creative commons license. http://creativecommons.org/software → On the site of creative commons they do not encourage the use of these licenses for software because the lawyer's texts are written in function of culture.

A better idea is to license IRail.be 's code under the GNU Public License. You can find documentation about this here:
http://www.gnu.org/licenses/gpl-howto.html

Pieter

Setting up a trac and get lost of this issue system

Frankly,
I think github's issue system is not sufficient for our project.

Yeri: can you set up a http://trac.edgewall.org/ system in http://project.irail.be please? Over there we will be able to properly manage and see what everyone is doing. As well we will have a more advanced bug tracking system. http://project.irail.be should become the central point for international and central API/API-wrapper developers.

On that system we can also feature application built upon our API.

As well the wikipages on github can disappear as the trac system has built in wiki system for all pages. Github should only be used for git, which is awesome.

Pieter

'time' param in query not taken into account

In connections queries, the time parameter does not seem to be taken into account:

youri:Temp $ curl "http://api.irail.be/connections/?to=Ottignies&from=Bruxelles-Nord&typeOfTransport=train&date=191114&time=0730" | xmllint --format - |grep "<time" |head -4
  <time formatted="2014-11-19T07:30:00Z">1416378600</time>
  <time formatted="2014-11-19T08:08:00Z">1416380880</time>
  <time formatted="2014-11-19T07:42:00Z">1416379320</time>
  <time formatted="2014-11-19T08:13:00Z">1416381180</time>

I would expect to see only the 07:30 train, or to receive an error if the query is malformed, rather than all trains on the given date.

EDIT: the query returns "some" trains starting from the given time. The info is there but the parameter name is misleading (eg startTime would be more appropriate).

[Connections] Via-information

Order the via-information differently. Do as Christophe mentioned in a previous ticket:

frominformation
endfrominformation
toinformation
endtoinformation
connection1
Link1
from: ...
direction: ...
startplatform:
endplatform:
to: ...
Link2
...
connection2
...

Provide HTTP-request feedback

Provide a status parameter in answers:

200 SUCCES
500 SERVER ERROR
504 ...

So we can provide decent feedback to users instead of 'something went wrong'.

Always return the requested format

It would be nice if the API would always returns XML or JSON (depending on the format in the query). Right now it might return XML or JSON when the query is successful but might return plain text when the station isn't found. Other errors might return the correct format.

Take http://api.irail.be/connections/?to=heaven&from=hell&format=xml for example, which returns plain text. This means the client implementation needs to call a different parser if the XML or JSON parser can't parse the result.

It does do the right thing when you send a broken query like http://api.irail.be/connections/?format=xml though.

No results for stations with a slash in their name

Finding connections by station ID between, say, Aalst to Aalter works perfect

http://api.irail.be/connections/?to=BE.NMBS.008895000&from=BE.NMBS.008891140 [WORKS]

but Aalst to Brussel-Centraal/Bruxelles-Central

http://api.irail.be/connections/?to=BE.NMBS.008895000&from=BE.NMBS.008813003 [BROKEN]

returns "No station found for Brussel-Centraal/Bruxelles-Central" result in plain text. This happens for all stations with a slash in their name. Tried both the JSON and XML endpoints but they both have the same problem, specifying the language in the query doesn't help ether.

I can work around the bug when I replace the station ID with the string Brussel-Centraal but isn't that problem exactly why you would use an ID in the first place?

http://api.irail.be/connections/?to=BE.NMBS.008895000&from=Brussel-Centraal [WORKS]

Trains with dual destinations should be 1 train instead of 2

Example: P8004 rides in weekdays.
Train departs in Schaarbeek, has destinations De Panne/Kortrijk. Train is split up in Gent Sint-Pieters.

When seeing this train in Departures from Brussel-Centraal: this train is mentioned twice.

  • as a train to De Panne - Platform X - Hour Y - Vehicle id Z
  • as a train to Kortrijk - Platform X - Hour Y - Vehicle id Z

So to do this cleaner, add parameters to the Vehicle-object:

split_in : station-object (id, name, location)
destinations:
--- departure-object 1 (vehicle, time, station-object, ...)
--- departure-object 2 (vehicle, time, station-object, ...)
--- ...

Remove all ending ?>

In every file, we still have the old style ?> endings which results in newlines being added to the output. Remove this

Stations

Certain stations aren't being looked up correctly. See http://yeri.be/cc
NMBS shows intermediate page, issue by passing that page.

Route data platform incorrect

This is the query: http://api.irail.be/connections/?lang=NL&format=json&to=008814001&from=008895802&sel=depart&date=210515&time=0737

Error is both in XML and JSON, although behaviour is different.

For both the first and the third train there's a platform change for the arrival station if I compare with the website belgianrail.be. For the first route the arrival platform should be platform 10, for the third it should be platform 13.

Both XML and JSON are the same for the first route and don't show any platform change.
For the third route there is a difference:
XML: according to the XML everything is ok: 12
JSON: in the JSON blob I can see something is wrong, but not what (normal is zero so something is up, but the platform hasn't changed) :

                "platform": "12",
                "platforminfo": {
                    "name": "12",
                    "normal": "0"
                },

So anyway, whatever the problem at the server is exactly, there is difference between the output in XML and JSON which shouldn't be. According to the JSON output I suppose that you know the platform has changed and to what it changed.

This is quite an urgent one as we cannot be sure what is correct...

Dirk

API: Some station have empty location

There are a few stations where the location is empty: here is a (generated) list:

BERCHEM SAINTE AGATHE
BEVEREN
BOITSFORT
BORGWORM
BRAINE L ALLEUD
BRAINE LE COMTE
BRUGGE ST PIETERS
BRUSSEL NAT LUCHTHAVEN
BRUXELLES CENTRAL
BRUXELLES CHAPELLE
BRUXELLES CONGRES
BRUXELLES MIDI
BRUXELLES NAT AEROPORT
BRUXELLES NORD
BRUXELLES LUXEMBOURG
BRUXELLES SCHUMAN
CHATEAU DE SEILLES
COMBLAIN LA TOUR
COMINES
COUR SUR HEURE
COURT SAINT ETIENNE
DAVE SAINT MARTIN
DOORNIK
EIGENBRAKEL
ENGHIEN
FAUX
FEXHE LE HAUT CLOCHER
FOREST EST
FOREST MIDI
GENT SINT PIETERS
GOUY LEZ PIETON
HAL
HAM SUR HEURE
HAM SUR SAMBRE
HAREN SUD
HEIST OP DEN BERG
HOEI
JEMEPPE SUR MEUSE
JEMEPPE SUR SAMBRE
KAPELLE OP DEN BOS
LA ROCHE
LOUVAIN LA NEUVE UNIV
MARCHE EN FAMENNE
MARCHE LES DAMES
MARCHE LEZ ECAUSSINNES
MARCHIENNE AU PONT
MASNUY SAINT PIERRE
MONT SAINT GUIBERT
MOUSCRON
NIJVEL
POIX SAINT HUBERT
PONT A CELLES
PONT DE SERAING
SAUVEGARDE
SAINT DENIS BOVESSE
SAINT JOB
SCHAERBEEK
'S GRAVENBRAKEL
S'INAAI
SINT AGATHA BERCHEM
SINT DENIJS BOEKEL
SINT GENESIUS RODE
SINT GILLIS
SINT JORIS WEERT
SINT KATELIJNE WAVER
SINT MARTENS BODEGEM
SOLRE SUR SAMBRE
SPA-GERONSTERE
TERHULPEN
UCCLE CALEVOET
UCCLE STALLE
VILLERS LA VILLE
VOROUX GOREUX
WATERMAEL
WAVER

I looked up the problem, and it seems that it the used keys in coordinates.php are different from the lookup stations names, mostly because of missing dashes like BRUGGE ST PIETERS which is in the coordinates.php written as BRUGGE ST-PIETERS or names in different languages like WAVER, which is in coordinates.php listed as WAVRE.

Direction in route calculation (in via) is incorrect

Both in XML and JSON WS's I'm having this issue.
When I calculate a route on the NMBS website from "Brussel-Noord" to "Okegem" I can see that I have certain routes with 1 stop ( or "via" in iRail terms ) in Denderleeuw. The first train from Brussel-Noord goes to direction "Oudenaarde", the second one goes to direction "Schaerbeek".

However there is an inconsistency with the webservices.
This webservice call for instance gives me the same routes as I can find on the website:
http://api.irail.be/connections/?lang=NL&format=xml&to=008895778&from=008812005

So for the departure station I can see that it's going direction "Oudenaarde" which is fine, but for the via the direction is also "Oudenaarde" where it should be "Schaerbeek".

I have added the extract of the JSON result where the data is wrong. I do see however that the correct destination is in the arrival station. However the 'via' should also include this the correct destination station...

{
"connection": [
    {
        ... NOT RELEVANT DATA
    },
    {
        "arrival": {
            "delay": "0",
            "direction": {
                "name": "Schaarbeek"
            },
            "platform": "1",
            "platforminfo": {
                "name": "1",
                "normal": "1"
            },
            "station": "Okegem",
            "stationinfo": {
                "@id": "http://irail.be/stations/NMBS/008895778",
                "id": "BE.NMBS.008895778",
                "locationX": "4.054557",
                "locationY": "50.857712",
                "name": "Okegem",
                "standardname": "Okegem"
            },
            "time": "1432645260",
            "vehicle": "BE.NMBS.L1564"
        },
        "departure": {
            "@id": "http://irail.be/stations/NMBS/008812005/departures/201505261415447021ebb3998f00d3559b2897f96afe",
            "delay": "0",
            "direction": {
                "name": "Oudenaarde"
            },
            "platform": "2",
            "platforminfo": {
                "name": "2",
                "normal": "1"
            },
            "station": "Brussel-Noord",
            "stationinfo": {
                "@id": "http://irail.be/stations/NMBS/008812005",
                "id": "BE.NMBS.008812005",
                "locationX": "4.360846",
                "locationY": "50.859663",
                "name": "Brussel-Noord",
                "standardname": "Brussel-Noord/Bruxelles-Nord"
            },
            "time": "1432642500",
            "vehicle": "BE.NMBS.L2285"
        },
        "duration": "2760",
        "id": "1",
        "vias": {
            "number": "1",
            "via": [
                {
                    "arrival": {
                        "platform": "6",
                        "platforminfo": {
                            "name": "6",
                            "normal": "1"
                        },
                        "time": "1432644240"
                    },
                    "departure": {
                        "platform": "8",
                        "platforminfo": {
                            "name": "8",
                            "normal": "1"
                        },
                        "time": "1432644900"
                    },
                    "direction": {
                        "name": "Oudenaarde"
                    },
                    "id": "0",
                    "station": "Denderleeuw",
                    "stationinfo": {
                        "@id": "http://irail.be/stations/NMBS/008895802",
                        "id": "BE.NMBS.008895802",
                        "locationX": "4.071825",
                        "locationY": "50.891925",
                        "name": "Denderleeuw",
                        "standardname": "Denderleeuw"
                    },
                    "timeBetween": "660",
                    "vehicle": "BE.NMBS.L2285"
                }
            ]
        }
    },
    ... NOT RELEVANT DATA
],
"timestamp": "1432639097",
"version": "1.1"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.