Download GIS data published by SEPTA & NJ Transit
This package depends upon geopandas
and pandas
. After installing these two libraries
you can install this module using the following command:
pip install git+https://github.com/aaronfraint/philly-transit-data.git
>>> from philly_transit_data import TransitData
>>> data = TransitData()
>>> stops, lines = data.get_data_from_portal(mode="SEPTA bus")
>>> stops, lines = data.all_spatial_data()
For example, save to shapefile with .to_file()
>>> print(type(stops))
<class 'geopandas.geodataframe.GeoDataFrame'>
>>> stops.to_file("philly_transit_stops.shp")
>>> data.options()
['SEPTA regional rail', 'SEPTA trolley', 'SEPTA bus', 'SEPTA subway - broad', 'SEPTA subway - market', 'SEPTA norristown high speed line', 'NJT bus', 'NJT rail']
For example, add AMTRAK's national stop and route datasets
>>> new_mode = "AMTRAK national network"
>>> data.add_data_source(new_mode, "stops", "https://opendata.arcgis.com/datasets/628537f4cf774cde8aa9721212226390_0.geojson")
>>> data.add_data_source(new_mode, "lines", "https://opendata.arcgis.com/datasets/d04fab6590c04feaa5f3955ef5abe929_0.geojson")