GTFS segments
Project description
Table of Contents
About The Project
Transit agencies use the General Transit Feed Specification (GTFS) to publish transit data. More and more cities are adopting the GTFS output_format across the globe. The GTFS feed can be downloaded from @transitfeeds and @mobility data. The GTFS segments is a concise representation of GTFS files removing unnecessary repetitions in the data and representing data in the form of segements.
Getting Started
Prerequisites
The major dependencies of this library are the following packages.
- numpy
- shapely
- pandas
- geopandas
- partridge
- seaborn
- matplotlib
- statsmodels
The detailed list of package dependencies can be found in requirements.txt
Installation
Option A
Use pip to install the package. Windows users may have to download and install Microsoft Visual C++ distributions. Follow these instructions.
pip install gtfs-segments
Option B
- Clone the repo
git clone https://github.com/UTEL-UIUC/gtfs_segments.git
- Install geopandas using the following code. Read more here
conda create -n geo_env conda activate geo_env conda config --env --add channels conda-forge conda config --env --set channel_priority strict conda install python=3 geopandas
- [Optional] Download modified version of
partridge
library and install it manually.git clone https://github.com/praneethd7/partridge cd partridge python setup.py install
- Install requirements using
pip install -r requirements.txt
- Install the
gtfs_segments
packagecd gtfs_segments python setup.py install
Usage
Import whole package using
import gtfs_segments
Get GTFS segments
Download the GTFS .zip file from @transitfeeds or @mobility data.
from gtfs_segments import get_gtfs_segments
segments_df = get_gtfs_segments("path_to_gtfs_zip_file")
segments_df
Plot Histogram
from gtfs_segments import plot_hist
plot_hist(segments_df)
Optionally save figure using
plot_hist(segments_df,file_path = "spacings_hist.png",save_fig = True)
Dowload Data
Download the data as either .csv
or .geojson
from gtfs_segments import export_segments
export_segments(segments_df,'filename', output_format ='geojson')
# Get csv without geometry
export_segments(segments_df,'filename', output_format ='csv',geometry = False)
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt
for more inoutput_formation.
Contact
Saipraneeth Devunuri - @praneethDevunu1 - sd37@illinois.edu
Project Link: https://github.com/UTEL-UIUC/gtfs_segments
Acknowledgments
- Parts of the code use the Partridge library
- Shoutout to Mobility Data for compiling GTFS from around the globe and constantly maintaining them
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gtfs_segments-0.0.4-3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a67a92134da43518864b45ea92883e59f96cbe47189611035528a165a2a362f |
|
MD5 | fd990d505add616898672a67517cce23 |
|
BLAKE2b-256 | 7de6987c61f8878dae139e7b4059fba8a4eb91c4b1604a05b6f714859f753211 |