amtrak

package module
v0.0.0-...-e327369 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

README

AMTRAK

An unoffical train status wrapper for use with Amtrak!
This package uses the data available from amtrak and converts it into usable train information.

Usage

go get -u "github.com/ATTron/amtrak"
import (
    "fmt"
    "github.com/ATTron/amtrak"
)

func main() {
    fmt.Println("SHOWING TRAIN 95: ", amtrak.GetTrain(95))
}
Functions

Currently this only has 2 functions. Return a specific train or return every train.

import (
    "github.com/ATTron/amtrak"
)
func main() {
    allTrains := amtrak.GetAllTrains()
    myTrain := amtrak.GetTrain(95)
}
Additional Docs

Full documentation can be found on pkg.go.dev

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeZones = map[string]string{
	"E": "EST",
	"C": "CST",
	"M": "MST",
	"P": "PST",
}

Functions

func GetAllTrains

func GetAllTrains() map[string]Train

GetAllTrains - return information on all trains

Types

type Geometry

type Geometry struct {
	GeoType     string    `json:"type"`
	Coordinates []float64 `json:"coordinates"`
}

type Properties

type Properties struct {
	ObjectID                 int      `json:"OBJECTID"`
	Longitude                *float64 `json:"lon"`
	Latitude                 *float64 `json:"lat"`
	Gx_ID                    string   `json:"gx_id"`
	StatusMsg                string   `json:"StatusMsg"`
	Stations                 []Station
	Heading                  string `json:"Heading"`
	LastValueTS              string `json:"LastValTS"`
	EventCode                string `json:"EventCode"`
	DestinationCode          string `json:"DestCode"`
	OriginCode               string `json:"OrigCode"`
	RouteName                string `json:"RouteName"`
	TrainState               string `json:"TrainState"`
	OriginTZ                 string `json:"OriginTZ"`
	OriginScheduledDeparture string `json:"OrigSchDep"`
	TrainNum                 string `json:"TrainNum"`
	Velocity                 string `json:"velocity"`
	CMSID                    string `json:"CMSID"`
	ID                       int    `json:"ID"`
}

type Station

type Station struct {
	Station          string
	Code             string `json:"code"`
	TZ               string `json:"tz"`
	Bus              bool   `json:"bus"`
	ScheduledArrival string `json:"scharr"`
	ScheduledComment string `json:"schcmnt"`
	AutoArrive       bool   `json:"autoarr"`
	AutoDepart       bool   `json:"autodep"`
	EstimatedArrival string `json:"estarr"`
	EstimatedComment string `json:"estarrcmnt"`
	ActualArrival    string `json:"postarr"`
	ActualDeparture  string `json:"postdep"`
	ActualComment    string `json:"postcmnt"`
}

type Train

type Train struct {
	ID         int        `json:"id"`
	Geometry   Geometry   `json:"geometry"`
	Properties Properties `json:"properties"`
}

func GetTrain

func GetTrain(trainNum int) Train

GetTrain - return information about 1 specific train

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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