A generator for simulated NYC taxi data streams
Project description
Taxi Route Simulator
A generator for simulated NYC taxi data streams.
Installation
pip install .
Usage
Command Line
Run the simulator and output JSON lines to stdout:
taxi-sim
Python API
from taxi_simulator import stream_taxi_data
for event in stream_taxi_data(num_cars=5, speed_kmh=80):
print(f"Car {event['car_id']} is at {event['latitude']}, {event['longitude']}")
if event['speed_kmh'] > 100:
print("Warning: Speeding!")
Parameters
| Parameter | Default | Description |
|---|---|---|
num_cars |
10 | Number of simulated cars |
speed_kmh |
60.0 | Base speed in km/h (actual speed varies ±20%) |
update_interval |
0.5 | Time between updates in seconds |
realtime_factor |
5.0 | Speed multiplier for simulation |
custom_routes_file |
None | Path to custom routes JSON file |
Output Format
Each event is a dictionary with the following fields:
{
"car_id": "car_0001",
"time": "2024-01-15T12:30:45.123456+00:00",
"longitude": -73.976964,
"latitude": 40.755987,
"speed_kmh": 62.4
}
Custom Routes
You can provide your own routes file in JSON format. The simulator supports various GeoJSON-like structures and will automatically extract coordinate arrays. Example:
[
{
"geometry": {
"coordinates": [[-73.976, 40.755], [-73.975, 40.756]]
}
}
]
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 timeplus_taxi_simulator-0.1.0.tar.gz.
File metadata
- Download URL: timeplus_taxi_simulator-0.1.0.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68dbc7b77ae8de8a6d245f4a9e68b7bfdfe5fb6c45d40af056fabd02b49799c7
|
|
| MD5 |
f847b6ecdbd303590f5962028555f273
|
|
| BLAKE2b-256 |
d316258fa49eb5d28e54774b510b572d80e5902ca55bd420078402a2b300182b
|
File details
Details for the file timeplus_taxi_simulator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: timeplus_taxi_simulator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330f34e4a88bc5c31485a41a9a8a3055fe028687ab86d72c0343d68219fbfa2c
|
|
| MD5 |
4ac2aa36207535a261e75a509ee33401
|
|
| BLAKE2b-256 |
eed36e3e21e32c4792d83b73c219274b4b4d019a4df7ca928f78133defeca25d
|