Skip to content

Directions API

Narrative Microformat

The microformat Narrative type adds <span> tags that have semantic value. This lets you easily style part of the narrative, and includes the adr format found at microformats.org.

Class NameDescription
nav-cmdThe top level parent element of the maneuver.
compass-dirThe directional component of the maneuver. (ex: East, West, Northwest)
relative-dirThe turn direction. (ex: left, right)
typeThe type of maneuver to make. (ex. Turn, Keep Going, Merge)
street-nameParent element of a collection of street names.
first, second, thirdThe streets that make up a street-name. (ex. US-222/US-30)
regularA normal street along the maneuver.
intersectingA street that intersects the maneuver.
toward-signToward sign on the maneuver. Usually a highway interchange.
exit-signThe exit sign name on a maneuver.
labelThe text of an exit sign.
valueThe numerical value of the exit sign.
branch-signA branch sign on the maneuver. Usually part of an exit.
noteExtra information about the maneuver.
tollMessaging to indicate the user on a toll road.
adrA location. See the hCard specification for the class names that make up a location microformat.

Demo

Example Request

GET https://www.mapquestapi.com/directions/v2/route?key=KEY&callback=render&narrativeType=microformat&from=Denver, CO&to=Boulder, CO

Sample Narrative Microformat

js
<span class="nav-cmd">Go
  <span class="compass-dir">west</span>
  on
  <span class="street-name">
    <span class="regular">
      <span class="first">E Colfax Ave</span>
      /
      <span class="second">I-70 Bus W</span>
      /
      <span class="third">US-40 W</span>
      /
      <span class="fourth">US-287 N</span></span>
  </span>
  .
</span>

Sample Javascript to Manipulate Narrative

js
function turnBold() {
    var elements = document.getElementsByClassName('street-name'), i = 0, element;

    for (; i < elements.length; i++) {
        element = elements[i];
        element.style.fontWeight = 'bold';
    }
}