ai4up / transit-access

GTFS-based transit accessibility index.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

transit-access

Calculate accessibility to transit for any location using a gravity-based model with a Gaussian decay function.

Install

pip install git+https://github.com/ai4up/transit-access@main

Usage

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)

Approach

  1. Create routable NetworkX graph with realistic transfer times from GTFS feeds using gtfs2nx package.
  2. Transit score per stop
    • Calculation depends on notion of transit accessibility (e.g. frequency weighted by closeness centrality)
  3. Calculate accessibility score per location
    • Gravity model following a Gaussian decay with distance to stops
    • Consider only nearest stop per route
  4. Mapping accessibility to neighborhoods
    • Calculate mean over multiple locations arranged in hexagonal grid (Uber H3 with 10 resolution)

About

GTFS-based transit accessibility index.

License:MIT License


Languages

Language:Python 100.0%