Name | traveltime-google-comparison JSON |
Version |
1.1.1
JSON |
| download |
home_page | None |
Summary | Compare travel times obtained from TravelTime API and Google Maps API |
upload_time | 2024-10-01 08:37:11 |
maintainer | None |
docs_url | None |
author | TravelTime |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# TravelTime/Google comparison tool
This tool compares the travel times obtained from [TravelTime Routes API](https://docs.traveltime.com/api/reference/routes),
[Google Maps Directions API](https://developers.google.com/maps/documentation/directions/get-directions),
[TomTom Routing API](https://developer.tomtom.com/routing-api/documentation/tomtom-maps/routing-service),
[HERE Routing API](https://www.here.com/docs/bundle/routing-api-v8-api-reference),
[Mapbox Directions API](https://docs.mapbox.com/api/navigation/directions/),
[OpenRoutes API](https://openrouteservice.org/dev/#/api-docs/v2/directions/%7Bprofile%7D/get),
and [OSRM Routes API](https://project-osrm.org/docs/v5.5.1/api/?language=cURL#route-service).
Source code is available on [GitHub](https://github.com/traveltime-dev/traveltime-google-comparison).
## Features
- Get travel times from TravelTime API, Google Maps API, TomTom API, HERE API, Mapbox API and OSRM API in parallel, for provided origin/destination pairs and a set
of departure times.
- Departure times are calculated based on user provided start time, end time and interval.
- Analyze the differences between the results and print out the average error percentage.
## Prerequisites
The tool requires Python 3.8+ installed on your system. You can download it from [here](https://www.python.org/downloads/).
## Installation
Create a new virtual environment with a chosen name (here, we'll name it 'env'):
```bash
python -m venv env
```
Activate the virtual environment:
```bash
source env/bin/activate
```
Install the project and its dependencies:
```bash
pip install traveltime-google-comparison
```
## Setup
Provide credentials and desired max requests per minute for the APIs inside the `config.json` file.
You can also disable unwanted APIs by changing the `enabled` value to `false`.
```json
{
"traveltime": {
"app-id": "<your-app-id>",
"api-key": "<your-api-key>",
"max-rpm": "60"
},
"api-providers": [
{
"name": "google",
"enabled": true,
"api-key": "<your-api-key>",
"max-rpm": "60"
},
...other providers
]
}
```
## Usage
Run the tool:
```bash
traveltime_google_comparison --input [Input CSV file path] --output [Output CSV file path] \
--date [Date (YYYY-MM-DD)] --start-time [Start time (HH:MM)] --end-time [End time (HH:MM)] \
--interval [Interval in minutes] --time-zone-id [Time zone ID]
```
Required arguments:
- `--input [Input CSV file path]`: Path to the input file. Input file is required to have a header row and at least one
row with data, with two columns: `origin` and `destination`.
The values in the columns must be latitude and longitude pairs, separated
by comma and enclosed in double quotes. For example: `"51.5074,-0.1278"`. Columns must be separated by comma as well.
Check out the [project's repository](https://github.com/traveltime-dev/traveltime-google-comparison.git)
for examples in the `examples` directory and more pre-prepared routes in the `inputs` directory.
- `--output [Output CSV file path]`: Path to the output file. It will contain the gathered travel times.
See the details in the [Output section](#output)
- `--date [Date (YYYY-MM-DD)]`: date on which the travel times are gathered. Use a future date, as Google API returns
errors for past dates (and times). Take into account the time needed to collect the data for provided input.
- `--start-time [Start time (HH:MM)]`: start time in `HH:MM` format, used for calculation of departure times.
See [Calculating departure times](#calculating-departure-times)
- `--end-time [End time (HH:MM)]`: end time in `HH:MM` format, used for calculation of departure times.
See [Calculating departure times](#calculating-departure-times)
- `--interval [Interval in minutes]`: interval in minutes, used for calculation of departure times.
See [Calculating departure times](#calculating-departure-times)
- `--time-zone-id [Time zone ID]`: non-abbreviated time zone identifier in which the time values are specified.
For example: `Europe/London`. For more information, see [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
Optional arguments:
- `--config [Config file path]`: Path to the config file. Default - ./config.json
Example:
```bash
traveltime_google_comparison --input examples/uk.csv --output output.csv --date 2023-09-20 \
--start-time 07:00 --end-time 20:00 --interval 180 --time-zone-id "Europe/London"
```
## Calculating departure times
Script will collect travel times on the given day for departure times between provided start-time and end-time, with the
given interval. The start-time and end-time are in principle inclusive, however if the time window is not exactly divisible by the
given interval, the end-time will not be included. For example, if you set the start-time to 08:00, end-time to 20:00
and interval to 240, the script will sample both APIs for departure times 08:00, 12:00, 16:00 and 20:00 (end-time
included). But for interval equal to 300, the script will sample APIs for departure times 08:00, 13:00 and 18:00 (end-time
is not included).
## Output
The output file will contain the `origin` and `destination` columns from input file, with additional 4 columns:
- `departure_time`: departure time in `YYYY-MM-DD HH:MM:SS±HHMM` format, calculated from the start-time, end-time and interval.
It includes date, time and timezone offset.
- `google_travel_time`: travel time gathered from Google Directions API in seconds
- `tt_travel_time`: travel time gathered from TravelTime API in seconds
- `error_percentage_*`: relative error between provider and TravelTime travel times in percent, relative to provider result.
### Sample output
```csv
origin,destination,departure_time,google_travel_time,tomtom_travel_time,here_travel_time,osrm_travel_time,openroutes_travel_time,mapbox_travel_time,tt_travel_time,error_percentage_google,error_percentage_tomtom,error_percentage_here,error_percentage_mapbox,error_percentage_osrm,error_percentage_openroutes
"52.200400622501455, 0.1082577055247136","52.21614536733819, 0.15782831362961777",2024-09-25 07:00:00+0100,621.0,805.0,614.0,532.0,697.0,1018.0,956.0,53,18,55,6,79,37
```
## License
This project is licensed under MIT License. For more details, see the LICENSE file.
Raw data
{
"_id": null,
"home_page": null,
"name": "traveltime-google-comparison",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "TravelTime",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/74/74/7cfe1e2abc452b010d101f36e83033bc46fa38ba788c131483e9a25e1d28/traveltime_google_comparison-1.1.1.tar.gz",
"platform": null,
"description": "# TravelTime/Google comparison tool\n\nThis tool compares the travel times obtained from [TravelTime Routes API](https://docs.traveltime.com/api/reference/routes),\n[Google Maps Directions API](https://developers.google.com/maps/documentation/directions/get-directions),\n[TomTom Routing API](https://developer.tomtom.com/routing-api/documentation/tomtom-maps/routing-service),\n[HERE Routing API](https://www.here.com/docs/bundle/routing-api-v8-api-reference),\n[Mapbox Directions API](https://docs.mapbox.com/api/navigation/directions/),\n[OpenRoutes API](https://openrouteservice.org/dev/#/api-docs/v2/directions/%7Bprofile%7D/get),\nand [OSRM Routes API](https://project-osrm.org/docs/v5.5.1/api/?language=cURL#route-service).\nSource code is available on [GitHub](https://github.com/traveltime-dev/traveltime-google-comparison).\n\n## Features\n\n- Get travel times from TravelTime API, Google Maps API, TomTom API, HERE API, Mapbox API and OSRM API in parallel, for provided origin/destination pairs and a set \n of departure times.\n- Departure times are calculated based on user provided start time, end time and interval. \n- Analyze the differences between the results and print out the average error percentage.\n\n## Prerequisites\n\nThe tool requires Python 3.8+ installed on your system. You can download it from [here](https://www.python.org/downloads/).\n\n## Installation\nCreate a new virtual environment with a chosen name (here, we'll name it 'env'):\n```bash\npython -m venv env\n```\n\nActivate the virtual environment:\n```bash\nsource env/bin/activate\n```\n\nInstall the project and its dependencies:\n```bash\npip install traveltime-google-comparison\n```\n\n## Setup\nProvide credentials and desired max requests per minute for the APIs inside the `config.json` file.\nYou can also disable unwanted APIs by changing the `enabled` value to `false`.\n\n```json\n{\n \"traveltime\": {\n \"app-id\": \"<your-app-id>\",\n \"api-key\": \"<your-api-key>\",\n \"max-rpm\": \"60\"\n },\n \"api-providers\": [\n {\n \"name\": \"google\",\n \"enabled\": true,\n \"api-key\": \"<your-api-key>\",\n \"max-rpm\": \"60\"\n },\n ...other providers\n ]\n}\n```\n\n## Usage\nRun the tool:\n```bash\ntraveltime_google_comparison --input [Input CSV file path] --output [Output CSV file path] \\\n --date [Date (YYYY-MM-DD)] --start-time [Start time (HH:MM)] --end-time [End time (HH:MM)] \\\n --interval [Interval in minutes] --time-zone-id [Time zone ID] \n```\nRequired arguments:\n- `--input [Input CSV file path]`: Path to the input file. Input file is required to have a header row and at least one \n row with data, with two columns: `origin` and `destination`.\n The values in the columns must be latitude and longitude pairs, separated \n by comma and enclosed in double quotes. For example: `\"51.5074,-0.1278\"`. Columns must be separated by comma as well.\n Check out the [project's repository](https://github.com/traveltime-dev/traveltime-google-comparison.git) \n for examples in the `examples` directory and more pre-prepared routes in the `inputs` directory.\n- `--output [Output CSV file path]`: Path to the output file. It will contain the gathered travel times. \n See the details in the [Output section](#output)\n- `--date [Date (YYYY-MM-DD)]`: date on which the travel times are gathered. Use a future date, as Google API returns\n errors for past dates (and times). Take into account the time needed to collect the data for provided input.\n- `--start-time [Start time (HH:MM)]`: start time in `HH:MM` format, used for calculation of departure times.\n See [Calculating departure times](#calculating-departure-times)\n- `--end-time [End time (HH:MM)]`: end time in `HH:MM` format, used for calculation of departure times.\n See [Calculating departure times](#calculating-departure-times)\n- `--interval [Interval in minutes]`: interval in minutes, used for calculation of departure times. \n See [Calculating departure times](#calculating-departure-times)\n- `--time-zone-id [Time zone ID]`: non-abbreviated time zone identifier in which the time values are specified. \n For example: `Europe/London`. For more information, see [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).\n\nOptional arguments:\n- `--config [Config file path]`: Path to the config file. Default - ./config.json\n\nExample:\n\n```bash\ntraveltime_google_comparison --input examples/uk.csv --output output.csv --date 2023-09-20 \\\n --start-time 07:00 --end-time 20:00 --interval 180 --time-zone-id \"Europe/London\"\n```\n\n## Calculating departure times\nScript will collect travel times on the given day for departure times between provided start-time and end-time, with the\ngiven interval. The start-time and end-time are in principle inclusive, however if the time window is not exactly divisible by the \ngiven interval, the end-time will not be included. For example, if you set the start-time to 08:00, end-time to 20:00 \nand interval to 240, the script will sample both APIs for departure times 08:00, 12:00, 16:00 and 20:00 (end-time \nincluded). But for interval equal to 300, the script will sample APIs for departure times 08:00, 13:00 and 18:00 (end-time \nis not included).\n\n## Output\nThe output file will contain the `origin` and `destination` columns from input file, with additional 4 columns: \n - `departure_time`: departure time in `YYYY-MM-DD HH:MM:SS\u00b1HHMM` format, calculated from the start-time, end-time and interval.\n It includes date, time and timezone offset.\n - `google_travel_time`: travel time gathered from Google Directions API in seconds\n - `tt_travel_time`: travel time gathered from TravelTime API in seconds\n - `error_percentage_*`: relative error between provider and TravelTime travel times in percent, relative to provider result.\n\n### Sample output\n```csv\norigin,destination,departure_time,google_travel_time,tomtom_travel_time,here_travel_time,osrm_travel_time,openroutes_travel_time,mapbox_travel_time,tt_travel_time,error_percentage_google,error_percentage_tomtom,error_percentage_here,error_percentage_mapbox,error_percentage_osrm,error_percentage_openroutes\n\"52.200400622501455, 0.1082577055247136\",\"52.21614536733819, 0.15782831362961777\",2024-09-25 07:00:00+0100,621.0,805.0,614.0,532.0,697.0,1018.0,956.0,53,18,55,6,79,37\n```\n\n## License\nThis project is licensed under MIT License. For more details, see the LICENSE file.\n",
"bugtrack_url": null,
"license": null,
"summary": "Compare travel times obtained from TravelTime API and Google Maps API",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://github.com/traveltime-dev/traveltime-google-comparison"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "777a973c81ffcf2b1299966d19bc1eb538a40e934b43081bf81a61acc363e3a5",
"md5": "6c429686ebcde5de34cf303251dd0392",
"sha256": "268c9c8907819813f968b292fc64c2124a40b96c2e81f767bcdea9e8d2fb6d80"
},
"downloads": -1,
"filename": "traveltime_google_comparison-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c429686ebcde5de34cf303251dd0392",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21937,
"upload_time": "2024-10-01T08:37:09",
"upload_time_iso_8601": "2024-10-01T08:37:09.630485Z",
"url": "https://files.pythonhosted.org/packages/77/7a/973c81ffcf2b1299966d19bc1eb538a40e934b43081bf81a61acc363e3a5/traveltime_google_comparison-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "74747cfe1e2abc452b010d101f36e83033bc46fa38ba788c131483e9a25e1d28",
"md5": "6eabb9168c272554f002323b606997a7",
"sha256": "92e5887911f79e90b7ba63c8ae85ce1622efcf2d4c1f1b4b2b54be0025c97b7d"
},
"downloads": -1,
"filename": "traveltime_google_comparison-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "6eabb9168c272554f002323b606997a7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 487262,
"upload_time": "2024-10-01T08:37:11",
"upload_time_iso_8601": "2024-10-01T08:37:11.096520Z",
"url": "https://files.pythonhosted.org/packages/74/74/7cfe1e2abc452b010d101f36e83033bc46fa38ba788c131483e9a25e1d28/traveltime_google_comparison-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-01 08:37:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "traveltime-dev",
"github_project": "traveltime-google-comparison",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "traveltime-google-comparison"
}