Traffic Monitoring APIs

STREAM
Trace Firehose API

Resource URL

http://www.mapquestapi.com/daas/v1/trace

Resource Information

Response Formats JSON, XML, CSV
Authentication Yes (Requires Key)
Rate Limited Yes

Client Initiated Filtering

The endpoint for GPS observations allows clients to curate the stream of information by defining predicates expressed as query parameters. Currently, query parameters are available to perform filtering on attributes such as location (bounding box) and speed.

Request Parameters

Request Parameter Description Required?
key
String
The API Key, which is needed to make requests to MapQuest services. Yes
Bounding Box Predicate
bbox
Numeric
Provides the capability of filtering observation data by a geographic bounding box expressed as the bottom left and top right corners of a rectangle.
The format is xmin,ymin,xmax,ymax. These values must be provided in decimal degrees.

Example

/daas/v1/trace?bbox=-105.206,39.815,-104.923,39.944
No
Speed Predicates
speed speed.eq
Numeric
Provides the capability of filtering observation data by exact speed expressed in kph.

Example

/daas/v1/trace?speed=0
No
speed.gt
Numeric
Provides the capability of filtering observation data by speed (expressed in kph) greater than the user supplied value.

Example

/daas/v1/trace?speed.gt=0
No
speed.ge
Numeric
Provides the capability of filtering observation data by speed (expressed in kph) greater than or equal to the user supplied value.

Example

/daas/v1/trace?speed.ge=0
No
speed.lt
Numeric
Provides the capability of filtering observation data by speed (expressed in kph) less than the user supplied value.

Example

/daas/v1/trace?speed.lt=100
No
speed.le
Numeric
Provides the capability of filtering observation data by speed (expressed in kph) less than or equal to the user supplied value.

Example

/daas/v1/trace?speed.le=100
No
Note: Multiple speed predicates (above) can be use to form range-based queries to be able to return records where the speed is (either inclusively or exclusively) between a minimum and maximum value.

Example

/daas/v1/trace?speed.ge=0&speed.lt=161

Available Rendering Formats

The streaming service allows the rendering of data in a variety of formats. Each observation is returned as a single line followed by a newline character. A client application can request a specific format to render each observation by using standard HTTP request headers to perform the necessary content negotiation. The default format for returning GPS observation data is GeoJSON when no content negotiation is requested.

The GeoJSON specification is described here: http://geojson.org/geojson-spec.html

HTTP Request Headers

Format Content Negotiation Description Default
GeoJSON Accept: application/json Observation data is returned as an GeoJSON Feature document. Yes
XML Accept: application/xml Observation data is returned as an XML document. No
CSV Accept: application/csv Observation data is returned as a series of comma-separated fields. No

Responses

The default response for GPS observations provides access to the data elements described in the Basic Attribution section. All information is anonymized for privacy, however, data points related to the same session can still be collated using the transaction_id to form a line string or ribbon representing the route.

Response

Response Field Description
Basic Attribution
transaction_id
String
A UUID identifying a distinct routing session.

Format Regex:

/([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}?)/i
observed_at
Long
The UNIX epoch time stamp detailing when the observation was made of the device.
received_at
Long
The UNIX epoch time stamp detailing when the observation was reported to MapQuest.
longitude
Decimal
The x-coordinate expressed in decimal degrees.

Constraint:

Values between -180 and 180.
latitude
Decimal
The y-coordinate expressed in decimal degrees.

Constraint:

Values between -90 and 90.

Example Request

STREAM

http://www.mapquestapi.com/daas/v1/trace?key=KEY&speed.ge=0&speed.lt=161

Example Response

{
    "type": "Feature",
    "properties": {
        "transaction_id": "E1AD1BD4-0B59-4DA2-956B-9B398A1DB013",
        "observed_at": 1456951468,
        "received_at": 1456951472
    },
    "geometry": {
        "type": "Point",
        "coordinates": [
            -119.682464,
            36.75068
        ]
    }
}
<trace>
  <transaction_id>E1AD1BD4-0B59-4DA2-956B-9B398A1DB013</transaction_id>
  <observed_at>1456951468</observed_at>
  <received_at>1456951472</received_at>
  <latitude>36.75068</latitude>
  <longitude>-119.682464</longitude>
</trace>
received_at,observed_at,transaction_id,latitude,longitude
1456951468,1456951472,E1AD1BD4-0B59-4DA2-956B-9B398A1DB013,36.75068,-119.682464