BlinkTagInc / gtfs-to-geojson

Generate geoJSON of transit route data from a GTFS file.
MIT License
114 stars 23 forks source link

SQLITE error even when not using SQLITE? #6

Closed larsschwarz closed 3 years ago

larsschwarz commented 3 years ago

I did not specify a sqlitePath in the config file, however when running gtfs-to-geojson it returns:

Starting GTFS import for 1 file
vbn: Downloading GTFS from http://www.connect-info.net/opendata/gtfs/connect-nds-toplevel/<hidden-api-key>
vbn: Download successful
vbn: Importing GTFS from /tmp/tmp-92890-Nz3KBUYM4MjY/vbn-gtfs.zip
vbn: Importing - agency.txt - 110 lines imported
vbn: Importing - attributions.txt - No file found
vbn: Importing - calendar_dates.txt - 43802 lines imported
vbn: Importing - calendar.txt - 1639 lines imported
vbn: Importing - fare_attributes.txt - No file found
vbn: Importing - fare_rules.txt - No file found
vbn: Importing - feed_info.txt - No file found
vbn: Importing - frequencies.txt - 0 lines imported
vbn: Importing - levels.txt - No file found
vbn: Importing - pathways.txt - 0 lines imported
vbn: Importing - routes.txt - 134 lines imported
Error: Error: SQLITE_CONSTRAINT: CHECK constraint failed: routes
[  Error: SQLITE_CONSTRAINT: CHECK constraint failed: routes
] {
  errno: 19,
  code: 'SQLITE_CONSTRAINT'
}

Also when using the same config file (no sqlitePath set) and providing --Skipimport it immediately returns

Starting GeoJSON creation for vbn
Error: Error: SQLITE_ERROR: no such table: routes
[  Error: SQLITE_ERROR: no such table: routes
] {
  errno: 1,
  code: 'SQLITE_ERROR'
}

Same error (SQLITE_CONSTRAINT) also happens with gtfs-to-html btw.

Ubuntu 20.04.1 LTS Node v12.18.4 npm 6.14.6

brendannee commented 3 years ago

Thanks for reporting this issue.

Can you share with me the GTFS file you are using so I can see why the SQLITE_CONSTRAINT: CHECK constraint failed: routes happened?

I just updated the documentation - if you use skipImport with an in-memory database, it will fail as there will be no data available.

larsschwarz commented 3 years ago

Due to license issues with the actual feed (it's only partially CC) I've sent the feed URL to your email address.

brendannee commented 3 years ago

Thanks for sharing the feed.

I found that it had some validation issues - but GTFS-to-HTML and GTFS-to-geojson were not giving very helpful and specific error messages. A few routes in routes.txt have invalid values of route_type set to 1200 (valid options are 0-7).

I added better validation with specific line numbers so that it is easier to see what's wrong. Check out the latest version of GTFS-to-HTML and GTFS-to-geojson and it will print some very helpful error messages.

Screen Shot 2020-10-13 at 12 42 57 AM

Once you get this working, let me know if you end up using GTFS-to-HTML or GTFS-to-geojson for anything interesting and let me know if you find any other issues.

larsschwarz commented 3 years ago

Thanks, but are there any plans to support extended route types like 1200 as proposed here https://developers.google.com/transit/gtfs/reference/extended-route-types ?

brendannee commented 3 years ago

Great point - I wasn't aware of these but I updated the schema definitions of route_type in routes.txt to support this and published updated versions of all libraries.