MapQuest-GL.js

mqgl.Service.traffic

The traffic object for retrieving markets, incidents and flows.

Methods

mqgl.Service.traffic.flow()

Retrieves traffic flow data. Refer to the Traffic Flow API for more information.

Syntax

var services = new mqgl.Service('KEY');

services.traffic.flow({lng: -73.993411, lat: 40.731701}, 400, 400, 11)
  .then(response => console.log(response));
  

Parameters

  • center required {lng,lat} object

    The center point of the traffic flow.

  • width number

    The pixel width of the traffic flow.

  • height number

    The pixel height of the traffic flow.

  • zoom number

    The map zoom of the traffic flow.

Return Value

A Promise containing a JSON object in the results.

Example

Loading...

mqgl.Service.traffic.markets()

Retrieves traffic market data. Refer to the Traffic Markets API for more information.

Syntax

var services = new mqgl.Service('KEY');

services.traffic.markets()
  .then(response => console.log(response));
  

Parameters

None

Return Value

A Promise containing a JSON object in the results.

Example

Loading...

mqgl.Service.traffic.incidents()

Retrieves traffic incident data. Refer to the Traffic Incidents API for more information.

Syntax

var services = new mqgl.Service('KEY');

services.traffic.incidents({_sw: {lng: -105.25, lat: 39.95}, _ne: {lng: -104.71, lat: 39.52}}, 'incidents,construction')
  .then(response => console.log(response));
  

Parameters

  • boundingBox required {_sw: {lng, lat}, _ne: {lng, lat}} object

    The area in which to search for incidents.

  • filters string

    A list of incident types to return. Possible values are: incidents, construction, event, congestion. Default: incidents,construction

Return Value

A Promise containing a JSON object in the results.

Example

Loading...