https://github.com/tombuildsstuff/trainline-stations-parser
Parses the Trainline.eu stations list into a Go object
https://github.com/tombuildsstuff/trainline-stations-parser
Last synced: 11 months ago
JSON representation
Parses the Trainline.eu stations list into a Go object
- Host: GitHub
- URL: https://github.com/tombuildsstuff/trainline-stations-parser
- Owner: tombuildsstuff
- License: mit
- Created: 2020-01-26T10:38:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-26T10:38:31.000Z (over 6 years ago)
- Last Synced: 2025-04-01T22:34:54.861Z (over 1 year ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trainline Stations Parser
This package allows you to parse [the Trainline.eu Stations List](https://github.com/trainline-eu/stations) into a Go object.
## Example Usage
This assumes the file `stations.csv` ([from the Trainline.eu repository](https://github.com/trainline-eu/stations)) is present within the same folder.
```go
package main
import (
"log"
"os"
"github.com/tombuildsstuff/trainline-stations-parser/parser"
)
func main() {
fileName := "stations.csv"
stations, err := parser.Parse(fileName)
if err != nil {
log.Printf("Error parsing: %+v", err)
os.Exit(1)
}
for _, station := range *stations {
log.Printf("Station: %q in %q (%.6f, %.6f)", station.Name, station.Country, station.Latitude, station.Longitude)
}
}
```