Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_feed_dangerously usage #41

Closed
cjer opened this issue Aug 6, 2018 · 3 comments
Closed

write_feed_dangerously usage #41

cjer opened this issue Aug 6, 2018 · 3 comments

Comments

@cjer
Copy link
Contributor

cjer commented Aug 6, 2018

  • partridge version: 0.10.0

I would like to have the option for creating a valid pruned GTFS feed based on a partridge feed.
I tried to use write_feed_dangerously, but:

  1. I can't seem to figure out how to get back to a partridge feed from this. Can this be easily done somehow?
  2. I have noticed it really isn't a valid GTFS feed. Is there any plan or work in progress for doing so?

Thanks

@invisiblefunnel
Copy link
Contributor

Hi @cjer. I recommend using ptg.writers.extract_feed, instead of using write_feed_dangerously.

inpath = 'mygtfs.zip'
outpath = 'mygtfs-pruned.zip'
agency_ids = ['2', '4']

ptg.writers.extract_feed(inpath, outpath, {
    {'routes.txt': {'agency_id': agency_ids}}
})

feed = ptg.feed(outpath)

Does that work for your use case?

@cjer
Copy link
Contributor Author

cjer commented Aug 6, 2018

Hey! that seems to work great!

docs anyone? :)

@cjer cjer closed this as completed Aug 6, 2018
@invisiblefunnel
Copy link
Contributor

I recently added extract_feed to the docs under "Extracting a new feed" in the Usage section: https://github.com/remix/partridge#usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants