Analysis Histogram Result as a CSV file
Purpose
Get a full histogram result as a CSV file by sending a GET request.
The analysis must have been created with tripStats enabled.
Request data
Format
https://api.tomtom.com/origindestination/1/analysis/flowmatrix/{id}/result/histogram/csv?key={Your_API_Key}&dateRange={dateRange}&timeRange={timeRange}&type={type}Example
https://api.tomtom.com/origindestination/1/analysis/flowmatrix/123/result/histogram/csv?key=test-api-key&dateRange=0&timeRange=0&type=HOURS_OF_DAYRequest parameters
Required parameters | Description |
|---|---|
| Analysis number id. Value: The analysis number id. |
| Authorization key for access to the API. Value: Your valid API Key. |
| Index of the date range. Value: Example: |
| Index of the time range. Value: Example: |
| Type of the histogram. Values: One of the following values:
|
Optional parameters | Description |
|---|---|
boolean | Determines if via information should be included in the results. Useful when you want to download results passed by given regions. Value: Example: Default: |
Array of regions indexes | Limits the result to containing given origins determined as list of region indexes. Useful to reduce the size of the downloaded CSV file. Value: Example: Default: All regions included. |
Array of regions indexes | Limits the result to containing given destinations determined as list of region indexes. Useful to reduce the size of the downloaded CSV file. Value: Example: Default: All regions included. |
Array of regions indexes | Limits the result to containing given vias determined as list of region indexes. Useful to reduce the size of the downloaded CSV file. Value: Example: Default: All regions included. Ignored unless |
Response data
This response returns a CSV file containing one histogram per origin and destination pair, or per
origin, destination and via combination when includeVia=true. The file is served as an attachment
named {type}_{id}_{dateRange}_{timeRange}-v2.csv, with the histogram type in lower case.
Response structure
The response contains a CSV which should be self describing. The first row contains labels and the following rows contain data.
- The key columns are
Origin,Destination, orOrigin,Via,DestinationwhenincludeVia=true. Note the order: the via column sits between the two, not after them. - The remaining columns are the histogram buckets, labeled with the lower bound of each bucket and sorted in ascending order. Only the buckets that carry traffic somewhere in the file get a column.
Each cell is the normalized trip count for this date range and time range, written with a dot as the decimal separator.
A bucket with no traffic in a given row is written as 0.0.
Without includeVia the rows are the origin-destination view and all their cells together add up to about 100.
With includeVia they are a drill-down by via region and add up to more, because a trip that passed through three regions is counted in three rows.
See Normalized probe counts.
LENGTHS and DURATIONS describe the part of a trip that lies inside the analyzed regions.
HOURS_OF_DAY is the hour at which the trip entered its origin region. For AVG_SPEEDS, trips whose
average speed could not be computed are left out of both the buckets and the total.
Every key column names one of your own regions. A trip that starts or ends outside your regions is
counted under the boundary region it entered or left.
To see which trip ends fell outside your regions, use externalEndsCode in the trips result.
Response example
Origin,Destination,0,5,10,15,20,25,30,35,40,..Region A,Region A,1.12,0.57,0.27,0.11,0.0,0.0,0.03,0.05,0.0,..Region A,Region B,2.55,2.99,1.42,0.94,0.58,0.42,0.42,0.24,0.18,..Region B,Region A,2.34,2.53,1.15,0.77,0.57,0.46,0.36,0.21,0.23,..Region B,Region B,4.58,12.21,12.37,8.98,6.15,4.86,3.58,2.82,2.63,..Response types
Type | Bucket columns |
|---|---|
| Labels |
| No upper limit, one column per 5 minutes. A column labeled |
| No upper limit, one column per kilometer. |
| No upper limit, one column per kilometer per hour. |
Errors
If there is an error in the supplied parameters or any other internal problem, an error response is generated in the requested format.
Response codes
Code | Meaning & possible causes |
|---|---|
| OK |
| Bad request |
| Unauthorized |
| Forbidden |
| Not Found |