budul100.GTFS 4.0.1

Suggested Alternatives

budul.GTFS

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package budul100.GTFS --version 4.0.1
                    
NuGet\Install-Package budul100.GTFS -Version 4.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="budul100.GTFS" Version="4.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="budul100.GTFS" Version="4.0.1" />
                    
Directory.Packages.props
<PackageReference Include="budul100.GTFS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add budul100.GTFS --version 4.0.1
                    
#r "nuget: budul100.GTFS, 4.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package budul100.GTFS@4.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=budul100.GTFS&version=4.0.1
                    
Install as a Cake Addin
#tool nuget:?package=budul100.GTFS&version=4.0.1
                    
Install as a Cake Tool

alternate text is missing from this package README image GTFS

NuGet NuGet Downloads

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) and TransferType.InSeatNotAllowed (5)
  • ContinuousPickup and ContinuousDropOff on both Route and StopTime
  • Index-based trip lookup in StopTimeListCollection (O(1) instead of O(n))
  • Microsoft.Extensions.Logging integration, replacing the static log delegate
  • Correct int values on ExceptionType, PaymentMethodType and DirectionType enums
  • DropOffType members renamed to correct drop-off terminology (NoDropOff, PhoneForDropOff, DriverForDropOff); old names marked [Obsolete]
  • nullable enable project-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, PhoneForPickup and DriverForPickup are [Obsolete]. Replace with NoDropOff, PhoneForDropOff and DriverForDropOff.
  • IEntityCollection.Get(string id) now returns TEntity? instead of TEntity.
  • ReadTimeOfDay no longer silently returns 00:00:00 on parse errors; in strict mode it throws, in non-strict mode it returns null.
  • The static Logger.LogAction delegate is [Obsolete]. Use Logger.UseLoggerFactory instead.
  • TraceEventType is [Obsolete]. Use Microsoft.Extensions.Logging.LogLevel instead.

Requirements

  • .NET 8 or later
  • Microsoft.Extensions.Logging.Abstractions 8.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 relevant Parse* method)
  • Writer support (WriteField* method and integration into the relevant Write method)
  • At least one test covering the happy path

License

MIT License. See LICENSE for details.

Original work copyright (c) 2014 Ben Abelshausen.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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