Directions Service: Narrative Microformat

What is it?

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.

For more information on Microformats please see microformats.org.

Class Name Description
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

Sample Request URL

/directions/v1/route?key=YOUR_KEY_HERE&callback=render&narrativeType=microformat&from=Lancaster, PA&to=Philadelphia, PA

Sample Narrative Microformat

<span class="nav-cmd">
  <span class="type">Merge</span> onto 
  <span class="street-name">
    <span class="regular">
      <span class="first">I-76 E</span>
    </span>
  </span> via
  <span class="exit-number">
    <span class="label"> EXIT </span>
    <span class="value">326</span>
  </span> toward 
  <span class="toward-sign">US-202/I-476/PHILADELPHIA/VALLEY FORGE</span>
  <span class="note">
    <span class="toll"> (Portions toll)</span>
  </span>.
</span>
    

Sample Javascript to Manipulate Narrative

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

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

Narrative Response