gtfs2geojson
November 21, 2017 ยท View on GitHub
Convert GTFS data into GeoJSON.
npm install --save gtfs2geojson
Command Line
gtfs2geojson [--shapes-assume-ordered] [--output output_path] [source_path]
The shapes.txt and stops.txt files need to be in the source_path directory you
specify, or if none is specified the current directory is assumed. If --output is not
specified the shapes.geojson and stops.geojson will be created in the source_path
directory.
If --shapes-assume-ordered is provided the shapes.txt is assumed to be ordered by
shape_id and shape_pt_sequence as this reduces memory usage and processing time.
However since the GTFS spec doesn't mandate this ordering, the default is to not assume
any ordering.
You may want to set the heap size by invoking with something like node --max_old_space_size=4096 ./gtfs2geojson (which is 4GB) to prevent errors like FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory.
API
lines(gtfs, callback, assumeOrdered)
Parse GTFS shapes.txt data given as a string or readable stream and invokes callback with
a GeoJSON FeatureCollection of features with LineString geometries. If assumeOrdered is
true, the GTFS shapes.txt is assumed to be ordered by shape_id and shape_pt_sequence.
However since the GTFS spec doesn't mandate this ordering, the default is false.
stops(gtfs, callback)
Parse GTFS stops.txt data given as a string or readable stream and invokes callback with
a GeoJSON FeatureCollection of features with Point geometries.