service

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Overview

This package is for compound entities, e.g. calendar services and shape lines

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenShape

func FlattenShape(ent ShapeLine) []gtfs.Shape

func ValidateShapes

func ValidateShapes(shapes []gtfs.Shape) []error

ValidateShapes returns errors for an array of shapes.

Types

type Service

type Service struct {
	gtfs.Calendar
	// contains filtered or unexported fields
}

Service is a Calendar / CalendarDate union.

func NewService

func NewService(c gtfs.Calendar, cds ...gtfs.CalendarDate) *Service

NewService returns a new Service.

func NewServicesFromReader

func NewServicesFromReader(reader adapters.Reader) []*Service

NewServicesFromReader returns the reader's Calendar and CalendarDate entities as a Service

func (*Service) AddCalendarDate

func (s *Service) AddCalendarDate(cd gtfs.CalendarDate) error

AddCalendarDate adds a service exception.

func (*Service) CalendarDates

func (s *Service) CalendarDates() []gtfs.CalendarDate

CalendarDates returns CalendarDates for this service.

func (*Service) Exception

func (s *Service) Exception(t time.Time) (int, bool)

func (*Service) GetWeekday

func (s *Service) GetWeekday(dow int) (int, error)

GetWeekday returns the value fo the day of week.

func (*Service) HasAtLeastOneDay

func (s *Service) HasAtLeastOneDay() bool

HasAtLeastOneDay checks if the Service is active for at least one day.

func (*Service) IsActive

func (s *Service) IsActive(t time.Time) bool

IsActive returns if this Service period is active on a specified date.

func (*Service) Reset

func (s *Service) Reset()

Reset resets calendars, except ServiceID

func (*Service) ServicePeriod

func (s *Service) ServicePeriod() (time.Time, time.Time)

ServicePeriod returns the widest possible range of days with transit service, including service exceptions.

func (*Service) SetWeekday

func (s *Service) SetWeekday(dow int, value int) error

SetWeekday sets the day of week.

func (*Service) Simplify

func (s *Service) Simplify() (*Service, error)

Simplify tries to simplify exceptions down to a basic calendar with fewer exceptions.

type ShapeLine

type ShapeLine struct {
	ShapeID   tt.String     `csv:",required"`
	Geometry  tt.LineString `db:"geometry" csv:"-"`
	Generated bool          `db:"generated" csv:"-"`
	tt.BaseEntity
}

Shape shapes.txt

func NewShapeLineFromShapes

func NewShapeLineFromShapes(shapes []gtfs.Shape) ShapeLine

NewShapeFromShapes takes Shapes with single points and returns a Shape with linestring geometry. Any errors from the input errors, or errors such as duplicate sequences, are added as entity errors.

func (*ShapeLine) EntityID

func (ent *ShapeLine) EntityID() string

EntityID returns the ID or ShapeID.

func (*ShapeLine) EntityKey

func (ent *ShapeLine) EntityKey() string

EntityKey returns the GTFS identifier.

func (ShapeLine) Filename

func (ent ShapeLine) Filename() string

Filename shapes.txt This is for entity map, not output file

func (ShapeLine) Flatten

func (ent ShapeLine) Flatten() []tt.Entity

func (*ShapeLine) TableName

func (ent *ShapeLine) TableName() string

TableName gtfs_shapes

Jump to

Keyboard shortcuts

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