BlinkTagInc/gtfs-to-geojson

Cannot read property '0' of undefined when loading a GTFS file

denishuvelle opened this issue · 1 comments

Hello,

I tried to load this GTFS: http://opendata.tec-wl.be/Current%20GTFS/TEC-GTFS.zip

With this config:

{ "mongoUrl": "mongodb://localhost:27017/gtfs", "agencies": [ { "agency_key": "L", "path": "TEC-GTFS_cleaned_trips.zip" } ], "includeStops": false, "outputType": "route", "coordinatePrecision": 5, "zipOutput": false }

With this command: gtfs-to-geojson --configPath config.json --max-old-space-size=8000

It imports everything in DB but ends with an error in the GeoJSON creation:

`Starting GTFS import for 1 file(node:73204) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

L: Importing GTFS from TEC-GTFS_cleaned_trips.zip
L: Importing - agency.txt - 5 lines imported
L: Importing - calendar_dates.txt - 341 lines imported
L: Importing - calendar.txt - 299 lines imported
L: Importing - fare_attributes.txt - No file found
L: Importing - fare_rules.txt - No file found
L: Importing - feed_info.txt - No file found
L: Importing - frequencies.txt - No file found
L: Importing - routes.txt - 810 lines imported
L: Importing - shapes.txt - 4759081 lines imported
L: Importing - stop_times.txt - 4012539 lines imported
L: Importing - stops.txt - 21573 lines imported
L: Importing - transfers.txt - No file found
L: Importing - trips.txt - 128838 lines imported
L: Post Processing data
L: Completed GTFS import
Completed GTFS import for 1 file
Starting GeoJSON creation for L
TypeError: Cannot read property '0' of undefined
at C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:233:25
at Array.map ()
at simplifyLine (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:232:35)
at simplifyGeom (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:203:35)
at C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:177:9
at Object.geomEach (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\meta\main.js:486:21)
at simplify (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:176:10)
at C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:54:35
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
at async C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:51:7
at async Promise.all (index 264)
at async buildGeoJSON (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:43:5)
at async C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:102:5
at async Promise.all (index 0)
at async module.exports (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:84:3)
at async C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\bin\gtfs-to-geojson.js:56:5`

I tried to isolate one route and all the corresponding trips (I removed all the other lines in these 2 text files) and it was running well... But I have no idea of which property is undefined.

Any idea on the issue? :)

Thanks for reporting this issue.

I pushed an update https://github.com/BlinkTagInc/gtfs-to-geojson/releases/tag/0.5.3 which should solve this issue.

Try it out and reopen this github issue if it still persists.