question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conditional GTFS import

See original GitHub issue

Hello again,

This might sound stupid since I lack any real knowledge of GTFS, but I’m wondering if there’s any way to only import the GTFS fields that have a zone name with a specific prefix (either from an array of prefixes or a wildcard like ['Harju1', 'Harju2'] or Harju*)?

Reason I’m asking is that the only GTFS available to me is country-wide (even though I specify my agency_key with the capital’s name, but the GTFS doesn’t seem to respect that really, using it in other town’s and cities’ routes, stops, etc.)

If not, then is it possible to use it as a mongoose find filter within my queries (the 3rd parameter as I understood)? This last question may be more suitable for StackOverflow, so feel free to close if the first option isn’t available and I’ll do my best to find a way to handle this on the query level.

BR, Andreas

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
brendanneecommented, Mar 26, 2018

Thanks for the details.

zone_name doesn’t seem to be a standard field in GTFS - so it would be up to you to filter on this field. You could update the schema for stops: https://github.com/BlinkTagInc/node-gtfs/blob/master/models/gtfs/stop.js and maintain your own that supports the additional fields in your feed, such as “zone_name”. If these fields were defined in the schema, you could more easily query for them.

Or, you could write a small pre-import script that went through the GTFS file and removed all of the stops, routes and stoptimes that you were not interested in and created a smaller GTFS file for you to import.

0reactions
brendanneecommented, Apr 3, 2018

You can get all stoptimes for a specific stop id like:

gtfs.getStoptimes({
  agency_key: 'caltrain',
  stop_id: '70011'
})
.then(stoptimes => {
  // loop through all stoptimes and find the latest one
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

import_gtfs: Import GTFS transit feeds in gtfsio - Rdrr.io
Imports GTFS transit feeds from either a local .zip file or an URL. Columns are parsed according to the standards for reading and...
Read more >
Static GTFS files - Trafiklab
A GTFS archive forms a database-like structure with every file as one table, and you can import these CSV files directly into a...
Read more >
How can i import a GTFS file on Python? - Stack Overflow
I'm unable to import a GTFS file on Python. Which library should i use? I've tried to import using Pypi and Panda but...
Read more >
Conditionals and loops — Spatial Data Programming with ...
First, we import the csv package (see Loading packages). Next, we create a file connection object to the CSV file (see File object...
Read more >
GTFS - General Transit Feed Specification
multigtfs - A Django application to import and export GTFS. partridge - A fast, forgiving Python GTFS reader built on pandas DataFrames. transit_service_analyst ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found