Giter Site home page Giter Site logo

irail / stations Goto Github PK

View Code? Open in Web Editor NEW
29.0 14.0 20.0 4.09 MB

A list of all the Belgian stations and their properties used within the iRail project

Home Page: http://irail.be/stations/NMBS

JavaScript 3.31% PHP 96.69%
json-ld stations belgium sncb

stations's Introduction

All stations in Belgium

Build Status Dependency Status Software License

We try to maintain a list of all the stations in Belgium using CSV so everyone can help to maintain it on github. Furthermore, we have a PHP composer/packagist library for you to go from station name to ID and vice versa and we convert the CSV file to JSON-LD for maximum semantic interoperability.

Fields we collect

stations.csv

This file describes all NMBS/SNCB stations in Belgium. A station can have multiple platforms (stops), which are described in stops.csv.

  • URI: this is the URI where we can find more information (such as the real-time departures) about this station (this already contains the ID of the NMBS/SNCB as well)
  • longitude: the longitude of the station
  • latitude: the latitude of the station
  • name: the most neutral name of the station (e.g., in Wallonia use the French name, for Brussels use both, for Flanders use nl name)
  • alternative-fr: alt. name in French, if available
  • alternative-nl: alt. name in Dutch, if available
  • alternative-de: alt. name in German, if available
  • alternative-en: alt. name in English, if available
  • taf-tap-code: TSI TAF/TAP number for the station Source: Infrabel Operational point of the railway network .
  • telegraph-code: abbreviated name for Belgian stations, used by NMBS/SNCB internally. Source: Infrabel Network Statement, attachment D file D06-RIEI-12_N_20230915.pdf.
  • country-code: the code of the country the station belongs to
  • avg_stop_times: the average number of vehicles stopping each day in this station (computed field)
  • official_transfer_time: the time needed for an average person to make a transfer in this station, according to official sources (NMBS/SNCB) (computed field)

stops.csv

This file describes all NMBS/SNCB stops in Belgium. Each platform is a separate stop location. All fields are computed using gtfs_data_extractor.php.

  • URI: this is the URI where we can find more information about this stop/platform (exists out of URI of the parent station + '#' + platform code)
  • parent_stop: this is the URI of the parent stop defined in stations.csv
  • longitude: the longitude of the stop
  • latitude: the latitude of the stop
  • name: stop name
  • alternative-fr: alt. name in French, if available
  • alternative-nl: alt. name in Dutch, if available
  • alternative-de: alt. name in German, if available
  • alternative-en: alt. name in English, if available
  • platform: the platform code (can also consist of letters, so do not treat this as a number!)

facilities.csv

This file describes facilities available in NMBS/SNCB stations. All fields are computed using web_facilities_extractor.php.

  • URI: The URI identifying this station.
  • name: The name of this station.
  • street: The street of this station's address.
  • zip: The postal code of this station's address.
  • city: The city of this station's address.
  • ticket_vending_machine: Whether or not ticket vending machines are available. Note: Ticket vending machines might be located inside a building (and can be locked when the station is closed).
  • luggage_lockers: Whether or not luggage lockers are available.
  • free_parking: Whether or not free parking spots are available.
  • taxi: Whether or not parking spots for taxis / waiting taxis are available.
  • bicycle_spots: Whether or not bicycle parking spots are available.
  • blue-bike: Whether or not the has blue-bikes (rental bikes).
  • bus: Whether or not transferring to a bus line is possible in this station.
  • tram: Whether or not transferring to a tram line is possible in this station.
  • metro: Whether or not transferring to a metro line is possible in this station.
  • wheelchair_available: Whether or not the station has wheelchairs available.
  • ramp: Whether or not the station has a ramp for wheelchair users to board a train.
  • disabled_parking_spots: The number of reserved parking spots for travellers with a disability.
  • elevated_platform: Whether or not the station has elevated platforms.
  • escalator_up: Whether or not the station has an ascending escalator from or to the platform(s).
  • escalator_down: Whether or not the station has a descending escalator from or to the platform(s).
  • elevator_platform: Whether or not the station has an elevator to the platform(s).
  • audio_induction_loop : Whether or not an Audio induction loop (Dutch: Ringleiding) is available.
  • sales_open_monday - sales_open_sunday: The time at which ticket boots open on this day of the week.
  • sales_close_monday -sales_close_sunday:The time at which ticket boots close on this day of the week.

embarkment_statistics.csv

This file describes how many people embark a train at the given station per day. Statistics from october 2023, source: belgiantrain.be, Cijfers opgestapte reizigers

  • URI: The URI identifying this station.
  • name: The name of this station.
  • nmbs_short_name: The short name of this station, as used in the original source data. For verification and future update purposes.
  • average_weekday_embarkments: The average number of travelers embarking on a weekday. Empty when a station does not have traffic on weekdays.
  • average_saturday_embarkments: The average number of travelers embarking on a saturday. Empty when a station does not have traffic on saturdays.
  • average_sunday_embarkments: The average number of travelers embarking on a sunday. Empty when a station does not have traffic on sundays.

How we collect data

This repository contains two PHP scripts which can load all data from the NMBS GTFS public data and the NMBS website. These scripts can be used to generate all CSV files from scratch, and to update existing files.

Manual changes and corrections can be made to stations.csv. It is recommended to use the stations.csv file in this repository as a starting point instead of using the scripts to generate this file, as the repository versions includes manual fixes to station names and translations.

Any changes made to stops.csv or facilities.csv will be overwritten by the scripts. Therefore, any pull requests with the sole purpose of updating/modifying these files won't be accepted

Missing stations and missing fields in stations.csv are automatically added when the gtfs_data_extractor tool runs.

How to make a correction

Corrections to names, translations and locations can be made by adjusting fields in stations.csv:

  • Names or translations will never be overwritten by the scripts.
  • Names in facilities.csv or stops.csv are derived from the names in stations.csv, meaning you only need to update stations.csv.
  • The GTFS data extractor script will warn on wrong locations, but won't correct them.

If you want to make a correction to facilities.csv or stops.csv, don't fix the files, but fix the scripts instead, and let these scripts run to update the file for you.

In case you just want to reuse the data

Latest update over HTTP

JSON-LD is available at https://irail.be/stations/NMBS if you add the right accept header. For example, using curl on the command line, you would do this:

curl -H "accept: application/json" https://irail.be/stations/NMBS

If you want to change this output, please change the CSV files over here first (we love pull requests)

In PHP project

Using composer (mind that we also require nodejs to be installed on your system in order to use the linked-data interface):

composer require irail/stations

Then you can use the stations in your code as follows:

use irail\stations\Stations;
use irail\stations\StationsLd;
// Using the strongly typed CSV parser:
// getStations() returns a irail\stations\Station array
$brusselsnorth = Stations::getStations("Brussels North")[0];
// getStationByID($id) returns a irail\stations\Station object with the station or null
$ghentstpieters = Stations::getStationByID("http://irail.be/stations/NMBS/008892007");

// Using the linked-data interface
// getStations() returns a json-ld document
$brusselsnorth = StationsLd::getStations("Brussels North")->{"@graph"}[0];
// getStationByID($id) returns a simple object with the station or null
$ghentstpieters = StationsLd::getStationByID("http://irail.be/stations/NMBS/008892007");

Don't forget to do a composer update from time to time to update the data

Building the RDF or JSON-LD

Using scripts, this data can be converted to JSON-LD. In order to run the script, run this command:

First time run this in your terminal (nodejs needs to be installed on your system):

npm install

Or install it globally using the npm package (you will need to run this again when there's an update to the stations file):

npm install -g irail-stations

From then on, you can always run:

# using this repo
./bin/build.js
# or with the global package:
irail-stations

For extra commands, check:

./bin/build.js --help
# or
irail-stations --help

We currently support the output formats TRiG, N-Quads and JSON-LD (default)

License

CC0: This dataset belongs to the public domain. You're free to reuse it without any restrictions whatsoever.

If you contribute to this repository, you agree that your contributions will be licensed under the CC0 open data license.

We do appreciate a link back to this repository, or a mention of the iRail project.

stations's People

Contributors

bertware avatar brechtvdv avatar christopheversieux avatar dependabot[bot] avatar dylanvanassche avatar haroenv avatar jncn avatar miclf avatar pietercolpaert avatar stancallewaert avatar tjoosten avatar tuinslak avatar xivk 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

Watchers

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

stations's Issues

Add styleCI

StyleCI does checks on PR's for the PSR-2 requirements

Ville Pommeroeul

This station is not working in the autocomplete due to the character oe

Cannes & Nice Ville

Cannes & Nice Ville have the same URI. This should be fixed: something went wrong probably when assigning new URIs

@jncn

shapes.geojson

What do we need:
List of all coordinates of the trackshape between stationX and stationY.
Platforms must be excluded so we can calculate the first/last point to the correct platform.
Inside the properties-key of the geojson, you specify the start- and stopStation by using its URI.

TODO

  • Make geojson-ld file with context
  • Add shape between two stations as example (you can use geojson.io for the coordinates)
  • Generate todo.csv of all combinations of stations (one direction), so people know what has to be done.

Frankfurt main not matched

Frankfurt main is not matched as the station name is frankfurt am mein. Same for other German stations

La louvière centre

Somehow, when NMBS/SNCB's HAFAS interface talks about La Louvière centre, it returns La Louviere- Centre in the results, with an extra space after the -.

Possible solution

Remove every space after a -

This issue closes

Official station names vs. alternatives

How do we handle official names and their alternatives?
e.g. Brussel-Nationaal-Luchthaven vs. Brussels-Airport or Amsterdam CS (old name) vs. Amsterdam Centraal (official name).

Suggestion: stops.csv

I suggest we add a stops.csv that contains all the platforms with their own URI (= parent_station URI#platformNumber), latitude and longitude.

This way we can crowdsource the locations of these platforms.

Centralise all PHP code to resolve stations

We have a lot of issues open that are concerning keeping our stations list up to date, or the autocompletion features of iRail: iRail/BRailResource#1 iRail/iRail#60 iRail/iRail#66 iRail/iRail#64 iRail/hyperRail#49 iRail/hyperRail#109 iRail/hyperRail#122

Solution for this would be to create a composer packagist PHP library in this repository (next to the nodejs package) which implements all of these features in a class and copies the file with it. In the different projects that needs stations lists, we update the list using composer update and have all the features at all times.

Giving stations a magnitude indication

Gent Sint Pieters is more important than Gentbrugge. Brussels Schuman is less important than Brussels Central, North or Midi. To optimize user experience, we could use an indication of this importance in our CSV file.

Use case: autocompletion

When autocompleting Brussels, Brussels Luxemburg is the first option. This is one of the smaller stations in Brussels and should appear lower.

Which data should we use?

This importance field can be made on the basis of different parameters:

  • number of platforms at a station
  • number of passengers per day in a station
  • Number of trains per day in that station
  • Number of times the station is requested over the past year in the iRail API compared to others
  • etc.

All of these could are valid indications. We can use these indicators to categorize stations.

Implementation

Add a field importance: a number between 0 (low) and 1 (high).

to start, we can make this a normalized percent based on the access logs or iRail

Problems I see

  • Adding a station will become a difficult operation
  • This percent will be difficult to compare in a global setting and will only be usable within projects for the NMBS/SNCB using the iRail API

PSR-2 violations.

01 WARNING

A file should declare new symbols (classes,
functions, constants, etc.) and cause no other
side effects, or it should execute logic with
side effects, but should not do both. The first
symbol is defined on line 10 and the first side
effect is on line 145.

02 ERROR: Whitespace found at end of line
59 WARNING: Line exceeds 120 characters; contains 136 characters
65 WARNING: Line exceeds 120 characters; contains 156 characters
72 WARNING: Line exceeds 120 characters; contains 142 characters
145 ERROR: Closing class brace must be on a line by itself

Add a CSV file pictures.csv with links to the images

Add a CSV file to the repository called pictures.csv.

Use columns:

  • name (primary key): name of the file of the picture in your Pictures directory
  • URI: http URI to station (find the URI in stations.csv)
  • license: add CC0, CC BY, or CC BY SA
  • author: the author of the image
  • source: add a URL to the source of the file

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.