Skip to content

Commit

Permalink
Merge pull request #142 from linkedconnections/development
Browse files Browse the repository at this point in the history
v2.1.9
  • Loading branch information
julianrojas87 authored Nov 23, 2022
2 parents 0680725 + a90af62 commit c387e69
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ We support other formats such as `csv` as well.

For _big_ GTFS files, your memory may not be sufficient. Luckily, we’ve implemented a way to use your hard disk instead of your RAM. You can enable this with an option: `gtfs2lc /path/to/extracted/gtfs -f json --store LevelStore`.

It may also be the case that your disk has limited storage space. In that case you may want to use the `--compressed` option.

### Step 5: Generate *Linked* Connections!

When you download a new GTFS file, all identifiers in there might change and conflict with your previous export. Therefore, we need to think about a way to create global identifiers for the connections, trips, routes and stops in our system. As we are publishing our data on the Web, we will also use Web addresses for these global identifiers.
Expand Down
5 changes: 3 additions & 2 deletions lib/gtfs2connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Mapper.prototype.resultStream = async function (path, output, done) {
// Step 5: Merge all the created files into one
const format = this._options.format;
let ext = null;
let gz = '';
let mergeCommand = 'zcat';

if (!format || ['json', 'mongo', 'jsonld', 'mongold'].indexOf(format) >= 0) {
Expand All @@ -96,11 +97,11 @@ Mapper.prototype.resultStream = async function (path, output, done) {
console.error('Merging final Linked Connections file...');
if(this._options.compressed) {
mergeCommand = 'cat';
ext += '.gz';
gz = '.gz';
}

// Join all resulting files into one
await exec(`for i in ${raws.map(r => { return `${r}.${ext}.gz` }).join(" ")} ; do ${mergeCommand} "$i" >> linkedConnections.${ext} && rm "$i" || break ; done`, { cwd: output });
await exec(`for i in ${raws.map(r => { return `${r}.${ext}.gz` }).join(" ")} ; do ${mergeCommand} "$i" >> linkedConnections.${ext}${gz} && rm "$i" || break ; done`, { cwd: output });
let t1 = new Date();
console.error('linkedConnections.' + ext + ' File created in ' + (t1.getTime() - t0.getTime()) + ' ms');
await del(
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gtfs2lc",
"version": "2.1.8",
"version": "2.1.9",
"description": "Mapping script from gtfs to (linked) connections",
"main": "lib/gtfs2lc.js",
"bin": {
Expand Down

0 comments on commit c387e69

Please sign in to comment.