Line sections
/infrabel/line-sections
GEOJSON
APPLICATION/JSON
Segmentation of the rail network according to the characteristics of the infrastructure and the possibilities of operation. This list includes the route and technical characteristics of the line sections. Important note :
These data are to be associated with the data set of the network's Operational points. It geolocates the start and end points of the sections whose identifiers and abbreviations are given in this dataset. These data are intended to allow schematic representations of the Belgian rail network (i.e. for a maximum scale of 1/25 000). (source: https://opendata.infrabel.be/explore/dataset/lijnsecties/information)
import requests
import geopandas as gpd
url = "https://api.mobilitytwin.brussels/infrabel/line-sections"
data = requests.get(url, headers={
'Authorization': 'Bearer [MY_API_KEY]'
}).json()
gdf = gpd.GeoDataFrame.from_features(data["features"])
# Plot the Belgian rail network
gdf.plot(figsize=(12, 10), linewidth=0.5, color="darkblue")
# Compute total network length
gdf['length_km'] = gdf.geometry.length / 1000
print(f"Total rail network: {gdf['length_km'].sum():.0f} km")
Operational points
/infrabel/operational-points
GEOJSON
APPLICATION/JSON
The operational points of the railway network in Belgium
import requests
import geopandas as gpd
url = "https://api.mobilitytwin.brussels/infrabel/operational-points"
data = requests.get(url, headers={
'Authorization': 'Bearer [MY_API_KEY]'
}).json()
gdf = gpd.GeoDataFrame.from_features(data["features"])
# Filter only stations (Gare)
stations = gdf[gdf['classification'] == 'Gare']
print(f"Total stations: {len(stations)}")
for _, s in stations.head(10).iterrows():
print(f" {s['longNameFr']} ({s['symbolicName']})")
# Plot all operational points
gdf.plot(figsize=(10, 8), markersize=5, color="navy")
Punctuality
/infrabel/punctuality
JSON
APPLICATION/JSON
The daily report of the lateness of the trains
import requests
import pandas as pd
url = "https://api.mobilitytwin.brussels/infrabel/punctuality"
data = requests.get(url, headers={
'Authorization': 'Bearer [MY_API_KEY]'
}).json()
df = pd.DataFrame(data)
# Compute delay statistics
df['delay_min'] = df['delay_seconds'] / 60
avg_delay = df['delay_min'].mean()
late_trains = df[df['delay_min'] > 5]
print(f"Average delay: {avg_delay:.1f} min")
print(f"Trains >5min late: {len(late_trains)} / {len(df)}")
# Most delayed stations
worst = df.groupby('station_name')['delay_min'].mean().nlargest(10)
print("\nMost delayed stations:")
print(worst)
Segments
/infrabel/segments
GEOJSON
APPLICATION/JSON
Geolocalised route of all railway tracks on the Infrabel network (not only the main tracks with a line number).
import requests
import geopandas as gpd
url = "https://api.mobilitytwin.brussels/infrabel/segments"
data = requests.get(url, headers={
'Authorization': 'Bearer [MY_API_KEY]'
}).json()
gdf = gpd.GeoDataFrame.from_features(data["features"])
# Compute segment lengths
gdf['length_km'] = gdf.geometry.length / 1000
# Show longest segments
longest = gdf.nlargest(5, 'length_km')[['segment_name', 'length_km']]
print("Longest rail segments:")
print(longest)
# Plot the full railway network
gdf.plot(figsize=(12, 10), linewidth=0.5, color="gray")