Westfalenfahrplan.NET is a .NET library for accessing real-time public transportation data in the Westfalen region of Germany.
- Search Locations: Find public transport stops, point of interests and more by name.
- Real-Time Data: Retrieve real-time departure information for a specific stop.
- Serving Lines: Get all lines serving a particular location.
To use Westfalenfahrplan.NET, follow these steps:
- Install via NuGet: Add the package to your project using the .NET CLI:
Or, search for
dotnet add package Westfalenfahrplan.NET
Westfalenfahrplan.NET
in the NuGet Package Manager in Visual Studio. - Use the package: Use the
WestfalenfahrplanClient
class to create your own application.
A simple example that shows how to retrieve and display real-time departure information for a specific location:
using Westfalenfahrplan.NET;
using var api = new WestfalenfahrplanClient();
var stop = (await api.SearchAsync("Bielefeld Jahnplatz")).Locations.FirstOrDefault();
var realtimeData = await api.GetRealtimeLocationInfoAsync(stop.Id);
foreach (var stopEvent in realtimeData.StopEvents)
Console.WriteLine($"{stopEvent.Transportation.Number} -> {stopEvent.Transportation.Destination.Name}: {stopEvent.DepartureTimeBaseTimetable.ToLocalTime():t}");
This example demonstrates:
- Searching for a stop by name.
- Retrieving real-time departure data for the stop.
- Displaying the departure times and destinations.
The sample can also be found in the repository under Sample.
If you have specific feature requests or need additional methods, feel free to open an issue.