Skip to main content

metroscore

Metroscore is a Python package for analyzing transit quality in a region.

Abstract

In recent years, rideshare alternatives have significantly impacted public transit ridership in large American cities by offering speed and convenience. To address this issue, transit agencies require a measure of transit mode preference to determine when and where riders choose public transit over car-based options. This paper introduces Metroscore, an arcpy-powered API that computes a multidimensional preference statistic for transit agencies to evaluate their services in comparison to car-based transit. Metroscore allows transit planners to input their own networks or build one for their city and analyze the effects of potential changes on the transit system under various spatiotemporal constraints. The methodology is illustrated through case studies on three major cities: Cincinnati, San Diego, and New York. With Metroscore, transit agencies can make informed decisions regarding the development of transit services, respond to the growing popularity of rideshare options, and provide strong evidence to support transit expansion proposals. Metroscore is available as an open-source, pip-installable package, with opportunities for feedback and collaboration on future developments. This paper not only introduces the innovative tool, but also highlights its potential in improving transit quality and fostering sustainable urban mobility.

Installation

Prerequisites

  1. arcgis
  2. arcpy. This is installed with ArcGIS Pro and is required to generate transit service areas.

Install using pip

pip install metroscore

Install from source

git clone https://github.com/agupta01/metroscore.git
cd metroscore
pip install -e .

Getting Started

Datasets

  1. GTFS: public transit agencies frequently publish their transit schedules in the General Transit Feed Specification (GTFS) format. This is a standard format for describing transit schedules and routes. metroscore uses the GTFS format to generate transit service areas.
  2. Streets: In order for the network to know where people can and cannot walk, you will need a polyline dataset of streets. This dataset should also have a field called RestrictPedestrians to indicate whether pedestrians are allowed to walk on that street. If this field is not present, you should think about how to generate this using the existing fields (one approach, for example, might be to look at street speed, if available).

Building a transit network dataset

Pro tip: Generate your network dataset on ArcGIS desktop, as this will allow you to visually inspect the quality of it. metroscore has a function to do this using arcpy, but it assumes a certain data structure and quality and may fail without warning.

Follow the instructions here to generate a transit network dataset. This will generate a network dataset that can be used to generate transit service areas.

Selecting points

In order to run, metroscore needs one or more candidate points to score. These points can be manually selected or generated using the functions in metroscore.point_selection. For example, to make a grid of approximately 100 points inside San Diego,

# get san diego boundary
sd_boundary = gis.content.get("4a27b8717df945298546fdf3456b0a16")
sd_poly = sd_boundary.layers[0].query("NAME = 'SAN DIEGO'").sdf.iloc[0].SHAPE
points = make_grid_points(sd_poly, N=100)
len(points)

87

Generating service areas

Next, one must generate driving and transit service areas for each point. This is done using the metroscore.service_areas module. For example, to generate a 30 minute driving service area for each point,

time = datetime.datetime(2019, 1, 1, 8, 0, 0)
duration = [30]
metro_sdf = get_metro_service_areas(nd_path, points, cutoffs=duration, time_of_day=time)
drive_sdf = get_drive_time_service_areas(points, cutoffs=duration, time_of_day=time)

Scoring points

Finally, we can use the metroscore.analysis module to generate metroscores. This will generate a metroscore for every service area generated inn the previous step (that is, for every point, duration and time combination). To do this,

mts_df = sd_mts_loc = compute_metroscore(metro_sdf, drive_sdf)

The resultant dataframe will have a column called "Metroscore" and another column named "Name" with each row being of the form " : 0 - ". You may then groupby or average across the different dimensions to analyze the metroscore results. To get the overall metroscore, simply average the Metroscore column as follows:

mts_df.Metroscore.mean()

0.045

Metadata

Release files for metroscore 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metroscore 0.2.0
File Size Uploaded Provenance
metroscore-0.2.0.tar.gz 14.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for metroscore 0.2.0
File Interpreter ABI Platform
metroscore-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / metroscore-0.2.0.tar.gz

Download URL metroscore-0.2.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b8d1bca7cdedf1bbc94b08d8cf7f84b3854c13034be10eef43177e5d51406e30
BLAKE2b-256 checksum
How to use checksums
e4fb42e707e14af89bec0efa4c857d1c73aa23df1872b683a2d646ab3f5e98f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / metroscore-0.2.0-py3-none-any.whl

Download URL metroscore-0.2.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96fb7ae3e3e901a8be89959feaaf9dc629c1fcbbee9d0e7ebdad1f331b56fa41
BLAKE2b-256 checksum
How to use checksums
016004559e9aa9306829520d9173e59142f3a6f9ae598e4d3afb7e9ae3cbb8eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for metroscore 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page