Tools for analyzing Flamingo E-Scooter movement patterns, trip data cleaning, and parking restriction compliance within the Auckland CBD.
Project description
Link to full documentation: https://jhe482-uoa.github.io/flamingo-escooter/
This Python package is used for analysing Flamingo e-scooter movement patterns within the Auckland CBD, providing tools to clean trip data and easily identify trips ending in restricted no-parking zones. It is designed to assist Auckland Council, Auckland Transport, and Flamingo Scooters to better understand scooter usage, support infrastructure planning, and improve enforcement of parking restrictions.
Features:
- Loads and cleans Flamingo trip data
- Generate OD flows between SA zones
- Detect rides ending in no-parking zones
- Create interactive folium maps to visualise common routes and parking violation areas
- Analyse how many users may be using the scooters to connect to public transport
Installation
Install from PyPI:
pip install flamingo-escooter
Install from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ flamingo-escooter
Install from source for development:
git clone https://github.com/jhe482-uoa/flamingo-escooter
cd flamingo-escooter
python3 -m pip install -e .[dev]
Quick-start example
import flamingo_escooter as fe
trips = fe.analyse()
fe.path_heatmap(trips) # See Path Heatmap image for expected output
fe.violation_heatmap(trips) # See Violation Heatmap image for expected output
violation_df_wide = fe.violations_table_wide(trips)
violation_df_wide # See Violation table in wide format for expected output
fe.first_and_last_mile_heatmap(trips) # See First and Last Mile Heatmap for expected output
See demo.ipynb for an additional demonstration.
Example Outputs using demo data
Path Heatmap
Violation Heatmap
Violation table in wide format
First and Last Mile Heatmap
Functions
Master Function
analyse()— Runs the full pipeline in one call: loads trips, SA1 boundaries, geofence zones, and transit stations, then computes OD flows, flags geofence violations, and calculates transit proximity. Returns a single enriched trip GeoDataFrame withorigin,destination,is_violation,violated_area,start/end_near_transit, andstart/end_distance_to_transit_mcolumns.
Data Loading
load_trips(data_file=None)— Loads Flamingo trip CSV, decodes encoded polylines into LineString geometries, and reprojects start/end points to EPSG:2193 (NZTM). Defaults to the bundled sample dataset; accepts a file path or DataFrame.load_sa(layer_id=123510)— Downloads Stats NZ SA1 (or SA2) boundaries from the datafinder WFS API, clipped to the Auckland CBD bounding box.load_sa_cached(layer_id=123510)— Wrapsload_sa()with local disk caching at~/.cache/flamingo_escooter/. Skips the network call on subsequent runs.load_geofence(json_file=None)— Fetches live Flamingo geofence zones from the GBFS API and parses them into a GeoDataFrame withride_start_allowed,ride_end_allowed,ride_through_allowed, andmaximum_speed_kphcolumns. Accepts a pre-loaded JSON dict.load_transit_stations()— Loads bundled Auckland bus and train stop locations and merges them into a single GeoDataFrame.
Analysis
od_flows(trips_gdf, zones_gdf)— Spatially joins trip start and end points to SA1 zones, addingoriginanddestinationcolumns. Trips outside any zone boundary are dropped.geofence_violations(trips_gdf, no_park_gdf, location_type="end")— Flags trips whose endpoint falls inside a no-parking zone. Addsis_violation(bool) andviolated_area(zone name or None) columns to the full trips GeoDataFrame. All rows are preserved.violations_table_wide(trips_gdf)— Summarises violations by zone from the output ofgeofence_violations(), returning a wide-format DataFrame withviolated_areaandtotal_violationscolumns sorted by count descending.transit_proximity(trips_gdf, transit_gdf, distance=10)— Finds the nearest transit stop to each trip's start and end point, addingstart/end_distance_to_transit_mandstart/end_near_transitcolumns. Prints a proximity summary to stdout.
Visualisation
All visualisation functions return a folium.Map object displayable inline in Jupyter.
path_heatmap(trips)— Interactive heatmap of scooter route density across the CBD, decoded directly from encoded polylines. Hot spots indicate frequently used streets.violation_heatmap(trips_gdf, location_type="end")— Interactive heatmap of no-parking violation locations, filtered fromis_violationcolumn. Accepts the full trips GeoDataFrame fromgeofence_violations()oranalyse().first_and_last_mile_heatmap(trips_gdf, location_type="both")— Interactive heatmap of trip endpoints near transit stops, filtered fromstart/end_near_transitcolumns. Supports"start","end", or"both"as toggleable layers.
Authors
- Jeff He - jhe482@aucklanduni.ac.nz
- Georgia Short - gsho521@aucklanduni.ac.nz
- Hans Setiawan - hset686@aucklanduni.ac.nz
Supervisor
- Dr. Hyesop Shin - hyesop.shin@auckland.ac.nz
Industry Partner
- Flamingo Scooters
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flamingo_escooter-1.0.0.tar.gz.
File metadata
- Download URL: flamingo_escooter-1.0.0.tar.gz
- Upload date:
- Size: 433.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4adbfca362208f50bc417f5256226a30e36bc7a50d58055ec25cdb2ffed6dac1
|
|
| MD5 |
b38fc331eb670af86913927d81eaf7ad
|
|
| BLAKE2b-256 |
2efb512cb94d262c5696278ec9dfbf20b64386d293471f6f98f0d775c79fb16a
|
File details
Details for the file flamingo_escooter-1.0.0-py3-none-any.whl.
File metadata
- Download URL: flamingo_escooter-1.0.0-py3-none-any.whl
- Upload date:
- Size: 420.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
264fdca681a6359adf24d5f35c7b4a208bb9d0f12f2a527a498bb1b2863332fa
|
|
| MD5 |
02aad9a459729937910097b620a9db68
|
|
| BLAKE2b-256 |
d6c987b69f46cbc2de9337abba2f6f5bfb0a041ebe071f08cd469f8a22930de5
|