-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch make_routes.sh to pull data from GTFS.zip (instead of RTAGetRo…
…ute)
- Loading branch information
Showing
5 changed files
with
75 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,5 @@ nola-transit-map | |
|
||
#generated temp route files | ||
data/route_* | ||
data/*.txt | ||
data/*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#CREDIT: csv2json.jq from https://stackoverflow.com/questions/29663187/csv-to-json-using-jq | ||
|
||
def objectify(headers): | ||
def tonumberq: tonumber? // .; | ||
. as $in | ||
| reduce range(0; headers|length) as $i ({}; .[headers[$i]] = ($in[$i]) ); | ||
|
||
def csv2table: | ||
# For jq 1.4, replace the following line by: def trim: .; | ||
def trim: sub("^ +";"") | sub(" +$";""); | ||
split("\n") | map( split(",") | map(trim) ); | ||
|
||
def csv2json: | ||
csv2table | ||
| .[0] as $headers | ||
| reduce (.[1:][] | select(length > 0) ) as $row | ||
( []; . + [ $row|objectify($headers) ]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.