Calculate accessibility to transit for any location using a gravity-based model with a Gaussian decay function.
pip install git+https://github.com/ai4up/transit-access@main
Prerequisite
Use gtfs2nx package to convert GTFS feed to GeoDataFrame of transit stops.
G = gtfs2nx.transit_graph('some-dir/city-GTFS.zip', 'EPSG:26914')
stops = utils.nodes_to_gdf(G)
API
# For specific lat lon location
locations = geopandas.GeoSeries.from_xy([13.351798027529089], [52.49615200183667], crs='EPSG:4326').to_crs(stops.crs)
score.transit_access(stops, locations)
# For H3 Uber hexagonal grid
score.transit_access_for_grid(stops, h3_res=8)
# For spatial units, e.g. zip codes
gdf_neighborhoods = gpd.read_file(<some-file>)
score.transit_access_for_neighborhood(stops, gdf_neighborhoods)
- Create routable NetworkX graph with realistic transfer times from GTFS feeds using gtfs2nx package.
- Transit score per stop
- Calculation depends on notion of transit accessibility (e.g. frequency weighted by closeness centrality)
- Calculate accessibility score per location
- Gravity model following a Gaussian decay with distance to stops
- Consider only nearest stop per route
- Mapping accessibility to neighborhoods
- Calculate mean over multiple locations arranged in hexagonal grid (Uber H3 with 10 resolution)