Written Directions on the directions api

4 posts / 0 new
Last post
ecornell
Written Directions on the directions api

I am trying to figure out how to get the written direction out of the code and into real text so I can print them out.  Am I missing something.  I am looking for that code, but having a hard time finding it.  Any help will be greatly appreciated.  Three times a year, I print out directions for people that are technicialy challenged.  Most of these people don't have GPS let alone understand how to use the GPS.  I got the map part, just need the written directions.


MQBrianCoakley
You can use the MapQuest.js
You can use the MapQuest.js Directions Narrative Control or if you're not using MapQuest.js, you just need to parse the narrative from each maneuver in the route leg.

ecornell
Almost there

I go the written directions, however they are over th map.  So when I print the map it is blocking the map.  How do I get the written Directions in there own div box, So I can place them on another page, when I print the map.

 


MQBrianCoakley
You can use the directions

You can use the directions.route() callback function to handle the route response and display the narrative as needed. Starting with the Basic Directions example, you could do something like this.

 

L.mapquest.directions().route({
  start: '350 5th Ave, New York, NY 10118',
  end: 'One Liberty Plaza, New York, NY 10006'
}, function(e, data){console.log(data.route.legs[0].maneuvers[0].narrative);});