gtfs

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 14 Imported by: 0

README

gtfs-go

A simple Go library for parsing GTFS (General Transit Feed Specification) data, and storing it in a database for easy querying.

The following GTFS files are currently supported:

  • agency.txt
  • calendar.txt
  • calendar_dates.txt
  • routes.txt
  • shapes.txt
  • stops.txt
  • stop_times.txt
  • trips.txt

Documentation

Index

Constants

View Source
const CurrentVersion = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type GTFS

type GTFS struct {
	Version int
	// contains filtered or unexported fields
}

Represents a GTFS database connection

func (*GTFS) FromDB

func (g *GTFS) FromDB(dbFile string) error

Load GTFS data from a local database file

func (*GTFS) FromURL

func (g *GTFS) FromURL(gtfsURL, dbFile string) error

Construct a new GTFS database from a hosted GTFS URL

func (*GTFS) GetAgencyByID

func (g *GTFS) GetAgencyByID(agencyID models.Key) (*models.Agency, error)

Returns the agency with the given ID

func (*GTFS) GetAgencyByRouteID

func (g *GTFS) GetAgencyByRouteID(routeID models.Key) (*models.Agency, error)

Returns the agency for a given route ID

func (*GTFS) GetAllAgencies

func (g *GTFS) GetAllAgencies() ([]*models.Agency, error)

Returns all agencies in the GTFS database

func (*GTFS) GetAllCurrentTrips

func (g *GTFS) GetAllCurrentTrips() ([]*models.Trip, error)

Returns all trips that are currently running

func (*GTFS) GetRouteByID

func (g *GTFS) GetRouteByID(routeID models.Key) (*models.Route, error)

Returns the route with the given ID

func (*GTFS) GetServiceByID

func (g *GTFS) GetServiceByID(serviceID models.Key) (*models.Service, error)

Returns the service with the given ID

func (*GTFS) GetServiceExceptionsByServiceID

func (g *GTFS) GetServiceExceptionsByServiceID(serviceID models.Key) ([]*models.ServiceException, error)

Returns all services exceptions for a given service ID

func (*GTFS) GetStopByID

func (g *GTFS) GetStopByID(stopID models.Key) (*models.Stop, error)

Returns the agency with the given ID

func (*GTFS) GetTripByID

func (g *GTFS) GetTripByID(tripID models.Key) (*models.Trip, error)

func (*GTFS) GetTripsByRouteID

func (g *GTFS) GetTripsByRouteID(routeID models.Key) ([]*models.Trip, error)

Returns all trips for a given route ID

func (*GTFS) IsRunningToday

func (g *GTFS) IsRunningToday(tripID models.Key) (bool, error)

Checks if the given trip is running today

func (*GTFS) Save

func (g *GTFS) Save() error

Save the GTFS database to the file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL