budul100.GTFS
4.0.1
dotnet add package budul100.GTFS --version 4.0.1
NuGet\Install-Package budul100.GTFS -Version 4.0.1
<PackageReference Include="budul100.GTFS" Version="4.0.1" />
<PackageVersion Include="budul100.GTFS" Version="4.0.1" />
<PackageReference Include="budul100.GTFS" />
paket add budul100.GTFS --version 4.0.1
#r "nuget: budul100.GTFS, 4.0.1"
#:package budul100.GTFS@4.0.1
#addin nuget:?package=budul100.GTFS&version=4.0.1
#tool nuget:?package=budul100.GTFS&version=4.0.1
GTFS
A .NET library for reading and writing General Transit Feed Specification (GTFS) feeds.
This is a fork of Softwareentwicklung-Schittkowski-GmbH/GTFS, which itself is a fork of itinero/GTFS. The goal of this fork is to modernize the technology stack and extend GTFS spec coverage, particularly for features missing from earlier versions.
Features
- Read and write GTFS feeds from directories and ZIP archives
- Full support for core GTFS entities: agencies, stops, routes, trips, stop times, calendars, fares, shapes, frequencies, transfers, pathways, levels
- Strict and non-strict parsing modes
- Extensible reader and writer via subclassing
- In-memory feed model with index-based stop time lookups
- Feed validation and filtering utilities
- Compatible with .NET 8+
Installation
dotnet add package GTFS
Or via the NuGet Package Manager:
Install-Package GTFS
Quick Start
Reading a feed from a directory or ZIP archive:
var reader = new GTFSReader<GTFSFeed>();
var feed = reader.Read("path/to/gtfs"); // directory or .zip
Reading in strict mode (throws on any spec violation):
var reader = new GTFSReader<GTFSFeed>(strict: true);
var feed = reader.Read("path/to/gtfs");
Accessing entities:
foreach (var route in feed.Routes)
{
Console.WriteLine($"{route.Id}: {route.ShortName} � {route.LongName}");
}
var stopTimes = feed.StopTimes.GetForTrip("trip_id_here");
Writing a feed:
var writer = new GTFSWriter<GTFSFeed>();
using var target = new GTFSDirectoryTarget("path/to/output");
writer.Write(feed, target);
Configuring logging (Microsoft.Extensions.Logging):
Logger.UseLoggerFactory(loggerFactory);
GTFS Spec Coverage
Supported files
| File | Status |
|---|---|
agency.txt |
Supported |
stops.txt |
Supported |
routes.txt |
Supported |
trips.txt |
Supported |
stop_times.txt |
Supported |
calendar.txt |
Supported |
calendar_dates.txt |
Supported |
fare_attributes.txt |
Supported |
fare_rules.txt |
Supported |
shapes.txt |
Supported |
frequencies.txt |
Supported |
transfers.txt |
Supported, including transfer_type 4 and 5 |
feed_info.txt |
Supported |
pathways.txt |
Supported |
levels.txt |
Supported |
booking_rules.txt |
Not yet supported |
location_groups.txt |
Not yet supported |
locations.geojson |
Not yet supported |
Notable additions in this fork
TransferType.InSeat(4) andTransferType.InSeatNotAllowed(5)ContinuousPickupandContinuousDropOffon bothRouteandStopTime- Index-based trip lookup in
StopTimeListCollection(O(1) instead of O(n)) Microsoft.Extensions.Loggingintegration, replacing the static log delegate- Correct int values on
ExceptionType,PaymentMethodTypeandDirectionTypeenums DropOffTypemembers renamed to correct drop-off terminology (NoDropOff,PhoneForDropOff,DriverForDropOff); old names marked[Obsolete]nullable enableproject-wide- Strict/non-strict separation in time-of-day parsing; parse errors no longer silently produce
00:00:00
Breaking Changes
This fork introduces breaking changes relative to itinero/GTFS. If you are migrating:
DropOffType.NoPickup,PhoneForPickupandDriverForPickupare[Obsolete]. Replace withNoDropOff,PhoneForDropOffandDriverForDropOff.IEntityCollection.Get(string id)now returnsTEntity?instead ofTEntity.ReadTimeOfDayno longer silently returns00:00:00on parse errors; in strict mode it throws, in non-strict mode it returnsnull.- The static
Logger.LogActiondelegate is[Obsolete]. UseLogger.UseLoggerFactoryinstead. TraceEventTypeis[Obsolete]. UseMicrosoft.Extensions.Logging.LogLevelinstead.
Requirements
- .NET 8 or later
Microsoft.Extensions.Logging.Abstractions8.0.0+
Building
git clone https://github.com/budul100/GTFS
cd GTFS
dotnet build
dotnet test
Contributing
Pull requests are welcome. For larger changes, please open an issue first to discuss the intended approach.
When adding support for new GTFS entities or fields, please include:
- The entity class or property with
[FieldName]and[Required]attributes where applicable - Reader support (
ParseField*method and integration into the relevantParse*method) - Writer support (
WriteField*method and integration into the relevantWritemethod) - At least one test covering the happy path
License
MIT License. See LICENSE for details.
Original work copyright (c) 2014 Ben Abelshausen.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|