Skip to content

Instantly share code, notes, and snippets.

@stopfstedt
Last active August 29, 2015 13:58
Show Gist options
  • Save stopfstedt/10222988 to your computer and use it in GitHub Desktop.
Save stopfstedt/10222988 to your computer and use it in GitHub Desktop.
Installation and usage notes.

Crunching Nexbus API output for AC Transit

Requirements

  1. Install node.js and NPM
  2. Install csv2geojson
sudo npm install -g csv2geojson 

Data processing

  • Get a CSV data dump
wget -O raw.csv http://nextbus.dathub.org/_csv
  • Filter it down to a particular bus line, e.g. 1017
# get the header line
head -n1 raw.csv > 1017.csv
# grab the 1017 line info
cat raw.csv | grep '|1017|' >> 1017.csv
  • Convert the data to geojson format
# show route as bus stops
csv2geojson 1017.csv > 1017.geojson
# alternatively, show route as line
csv2geojson --line 1017.csv > 1017.geojson

Displaying data

  • Copy and paste the geojson data into geojson.io.

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment