O/D Analysis

Analysis Partial Histogram Result

Important Note
Explore ready-to-use traffic reports and data visualizations immediately by signing up for a 30-day free trial on the MOVE Portal. Once registered, you’ll receive an API key to start using the Traffic Analytics APIs right away. Alternatively, you may contact our Sales team for a tailored solution.

Purpose

Get a partial histogram result by sending a POST request. The analysis must have been created with tripStats enabled.

Request data

HTTPS Method: POST

For ease of viewing and identification:

  • Parameters enclosed in curly brackets { } must be replaced with their values.
  • Please see the following Request parameters section with the required parameters table for their values. The generic request format is as follows.

Format

post
URL request format
https://api.tomtom.com/origindestination/1/analysis/flowmatrix/{id}/result/partial/histogram?key={Your_API_Key}&dateRange={dateRange}&timeRange={timeRange}&type={type}

Example

post
URL request example
https://api.tomtom.com/origindestination/1/analysis/flowmatrix/123/result/partial/histogram?key={Your_API_Key}&dateRange=0&timeRange=0&type=HOURS_OF_DAY

Required parameters

Required parameters

Description

id
integer

Analysis number id.


Value: The analysis number id.

key
string

Authorization key for access to the API.


Value: Your valid API Key.

dateRange
integer

Index of the date range.


Value: Example: 0

timeRange
integer

Index of the time range.


Value: Example: 0

type
string

Type of the histogram.


Values: One of the following values:

  • HOURS_OF_DAY - hour of the day at which trips entered their origin region

  • LENGTHS - trips lengths in kilometers

  • DURATIONS - trips durations in minutes

  • AVG_SPEEDS - average speeds in kilometers per hour

AVG_SPEEDS is available only for an analysis that produced an average speeds histogram.

Request POST body example

post
Request body - JSON
{
"origins": [0, 1, 2, 3],
"destinations": [4, 5, 6, 7, 8],
"vias": [10]
}

Request POST body stucture

Field

Description

origins
array (of integers)

List of regions’ indexes where trips started. Must not be empty.

destinations
array (of integers)

List of regions’ indexes where trips ended. Must not be empty.

vias
array (of integers)

List of regions’ indexes where trips went through.


Leaving it out, or sending an empty list, is not a wildcard: it selects the origin-destination view, that is only the entries whose via equals their destination. Send the indexes of all your regions to aggregate the full drill-down by via region.

Required POST headers

Header

Value

Content-Type

application/json

Response data

This response returns one histogram, merged over every origin, destination and via combination you selected. It is available once the analysis reaches the ACCEPTED status.

Response example

Response body - JSON
{
"bucketInterval": 1,
"unit": "HOUR",
"histogram": {
"4": 0.02,
"5": 0.05,
"6": 0.18,
"7": 0.51,
"8": 1.96,
"9": 3.71,
"10": 8.72,
"11": 9.29,
"12": 9.97,
"13": 10.02,
"14": 9.95,
"15": 10.92,
"16": 10.95,
"17": 10.89,
"18": 10.66,
"19": 8.95
}
}

Response structure

Field

Description

bucketInterval
integer

Width of a single bucket, in the unit given by unit. See Response types.

unit
string

Unit of the bucket keys: HOUR, KILOMETERS, MINUTES or KILOMETERS_PER_HOUR.

histogram
object

Map from the lower bound of a bucket to the normalized trip count for the trips that fall into it. Only buckets that carry traffic are present.

Reading the normalized trip count

Each value is the normalized trip count for this date range and time range. See Normalized probe counts.

  • With vias left empty and every region listed in origins and destinations, the buckets add up to about 100. A narrower selection adds up to less.
  • With vias filled in, a trip that passed through several of the selected regions is counted in several entries before they are merged, so the buckets add up to more than 100.
  • AVG_SPEEDS has its own population: trips whose average speed could not be computed are left out of both the buckets and the total, so this histogram is not comparable cell by cell with the other three.
  • Histograms of two different results - a different dateRange or timeRange - have different denominators and must not be added together.

LENGTHS and DURATIONS describe the part of a trip that lies inside the analyzed regions, from the origin region to the destination region. HOURS_OF_DAY is the hour at which the trip entered its origin region, the same moment that decides which time range the trip is counted in.

Response types

Type

Buckets

HOURS_OF_DAY

Keys 0 to 23, bucketInterval 1, unit HOUR. Only the hours with traffic are returned.

DURATIONS

No upper limit, bucketInterval 5, unit MINUTES. A key of 10 covers durations from 10 up to 15 minutes.

LENGTHS

No upper limit, bucketInterval 1, unit KILOMETERS.

AVG_SPEEDS

No upper limit, bucketInterval 1, unit KILOMETERS_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

200

OK

400

Bad request

401

Unauthorized

403

Forbidden

404

Not Found