MapQuest-GL.js

Options

The MapQuest-GL map can be instantiated with an options object as the third argument in the map constructor.

Any of the following values may be provided.

  • bearing number, default is 0

    The bearing or rotation in degrees to be applied to the map.

  • center Array<number>, default is [-104.984855, 39.738452]

    A Lng,Lat array to be used as the map's center.

  • pitch number, default is 0

    The pitch or tilt in degrees to be applied to the map.

  • zoom number, default is 10

    The initial zoom level of the map.

  • minZoom number, default is 0

    The minimum zoom level the map can support.

  • maxZoom number, default is 20

    The maximum zoom level the map can support.

  • padding number, default is 100

    The padding to be applied to generated points and shapes when the fitBounds function is called.

  • open boolean, default is false

    Specifies whether the MapQuest Open APIs should be used for the map.

  • controls object, keys are navigation and geocoding

  • trafficFlow object

    An object describing traffic configuration.

    Accepted values are:

    • low - rgb, hex, or color name for low traffic conditions
    • medium - rgb, hex, or color name for medium traffic conditions
    • high - rgb, hex, or color name for high traffic conditions
    • closed - rgb, hex, or color name for closed roads
    • thickness - the thickness of the traffic flow lines
    • opacity - opacity applied to all traffic lines. Accepts 0 - 1 as values
    • filter - filters traffic shown on the map

    Accepted filter values are:

    • flow - display only traffic flow
    • incidents - display only traffic incidents
  • directions object

    An object describing direction layer ribbons and markers.

    • ribbon object

      color: A string hex code of the color of the route. The showTraffic boolean must be set to false for this color to appear. Default is '#022853'.

      opacity: A number that controls the opacity of the route ribbon. Default is 0.6.

      showTraffic: A boolean that controls if traffic is rendered along the route. Overrides the color option if set to true. Default is true.

      trafficRibbonColors: An object containing any of the following key value options: low, medium, high, and closed.

      • low: The string hex code for the low congestion color of the traffic ribbon. Default is '#1ca747'.

      • medium: The string hex code for the medium congestion color of the traffic ribbon. Default is '#feeb41'.

      • high: The string hex code for the high congestion color of the traffic ribbon. Default is '#df0021'.

      • closed: The string hex code for the closed color of the traffic ribbon. Default is '#0c0000'.

      weight: The width of the ribbon. Default is 6.

    • startMarker string

      The Icons API resource for the start marker.

    • endMarker string

      The Icons API resource for the end marker.

    • viaMarker string

      The Icons API resource for the via markers.

  • scaleBar Array<String>, default is []

    Array of scale bar identifiers to be added to the map.

    Accepted values are:

    • km
    • mi
  • style object

    The style to be applied to the map.

    Accepted values are:

    • map
    • hybrid