Documentation
¶
Index ¶
- Constants
- Variables
- func ExportLocationData(stops []*Stop) error
- func ExportSpecialEdgesLocationData(specialEdges SpecialEdges) error
- func GetDateFromEdgeDataFilename(filename string) (time.Time, error)
- func GetEdgeKey(stopAName, stopBName string) string
- func GetEdgeKeyWalking(stopAName, stopBName string) string
- func GetStopCoordinatesForGoogleAPI()
- func GetTransitDataFilename(startTime time.Time, interval time.Duration) string
- func GetTransitDataWithGoogleAPI(startTime, endTime time.Time, interval time.Duration, apiKeyFile string)
- func ParseDateToEST(date string) (time.Time, error)
- func ReconstructRoute(route []Stop, startTime time.Time, apiKeyFile string)
- func WriteEdgeDataToFile(edges Edges, startTime time.Time, interval time.Duration) error
- type EdgeTimes
- type Edges
- type SpecialEdge
- type SpecialEdgeFiles
- type SpecialEdges
- type Stop
- type StopFiles
Constants ¶
Variables ¶
var EdgeDataTimeLocation, _ = time.LoadLocation("America/New_York")
EdgeDataTimeLocation location that dates and times should be in
Functions ¶
func ExportLocationData ¶
ExportLocationData exorts the location data from the mbta API
func ExportSpecialEdgesLocationData ¶
func ExportSpecialEdgesLocationData(specialEdges SpecialEdges) error
ExportSpecialEdgesLocationData exorts the location data from the mbta API for the middle stops of special edges
func GetDateFromEdgeDataFilename ¶
GetDateFromEdgeDataFilename return the date from the filename of a EdgeData file
func GetEdgeKey ¶
GetEdgeKey returns the map key for an edge between two stops
func GetEdgeKeyWalking ¶
GetEdgeKeyWalking returns the map key for an edge between two stops with walking
func GetStopCoordinatesForGoogleAPI ¶
func GetStopCoordinatesForGoogleAPI()
GetStopCoordinatesForGoogleAPI calculates and saves mbta api location data
func GetTransitDataFilename ¶
GetTransitDataFilename returns the filename that represents this data
func GetTransitDataWithGoogleAPI ¶
func GetTransitDataWithGoogleAPI(startTime, endTime time.Time, interval time.Duration, apiKeyFile string)
GetTransitDataWithGoogleAPI generates a json file of distance data of edges
func ParseDateToEST ¶
ParseDateToEST takes in a string of format EdgeDataTimeLocation and returns a time.Time variable in EST
func ReconstructRoute ¶
ReconstructRoute will print out all of the directions and times of each step of the route
Types ¶
type EdgeTimes ¶
EdgeTimes stores the time each edge took to traverse (unix time -> duration for that time)
type Edges ¶
Edges a map of all edges by edge key
func GetTransitDataForAnEdgeWithGoogleAPI ¶
func GetTransitDataForAnEdgeWithGoogleAPI(stopA, stopB *Stop, startTime, endTime time.Time, interval time.Duration, apiKeyFile string) Edges
GetTransitDataForAnEdgeWithGoogleAPI returns edge data for a particular edge stopA->stopB
func ImportEdgeData ¶
ImportEdgeData gets the edge data from a file
type SpecialEdge ¶
SpecialEdge holds data about a special edge, including its midstop and if a walking edge is allowed
type SpecialEdgeFiles ¶
type SpecialEdgeFiles string
SpecialEdgeFiles enum for files containing special edges
const ( // SpecialEdgesFile the file that stores the edges with multiple ways to go SpecialEdgesFile SpecialEdgeFiles = "datacollection/special_edges.json" // SpecialEdgesFileWithLocationData the file that stores the edges with multiple ways to go and the middle stop locations SpecialEdgesFileWithLocationData SpecialEdgeFiles = "datacollection/special_edges_with_location_data.json" )
type SpecialEdges ¶
type SpecialEdges map[string]SpecialEdge
SpecialEdges holds which edges need a stop in between them (and can also possibly walk between them)
func ReadSpecialEdgesFromFile ¶
func ReadSpecialEdgesFromFile(filename SpecialEdgeFiles) (SpecialEdges, error)
ReadSpecialEdgesFromFile reads in the special edges from a file (probably special_edges.json)
type Stop ¶
type Stop struct {
Name string `json:"name"`
LongitudeCommaLatitude string `json:"longitude_comma_latitude,omitempty"`
WalkToNextStop bool `json:"walk_to_next_stop,omitempty"`
}
Stop stores the coordinates of a stop and its name
func ImportStopsFromFile ¶
ImportStopsFromFile imports a list of stop data
func ImportStopsFromFileNonePointer ¶
ImportStopsFromFileNonePointer imports a list of stop data
func (*Stop) SetLongitudeCommaLatitude ¶
SetLongitudeCommaLatitude sets the LongitudeCommaLatitude field given longitude and latitude floats