Question

I was using Google Maps and for doing things like that I just needed to add the parameter WayPoints:

http://maps.googleapis.com/maps/api/directions/xml?origin=18.4543467001058,-69.9294914999045&destination=18.4804850999499,-69.932457299903&sensor=false&alternatives=true&waypoints=18.4543467001058,-69.9294914999045|18.4543467001058,-69.9294914999045|18.4779706000118,-69.9026079000905|18.4794135999982,-69.8832237999886|

But now I wanted to use MapQuest and I can't figure out how to do it.

I tried adding them in the Location parameter but it didnt work:

http://open.mapquestapi.com/directions/v0/route?callback=renderAdvancedNarrative&outFormat=xml&routeType=shortest&timeType=1&narrativeType=html&enhancedNarrative=false&shapeFormat=raw&generalize=200&locale=en_US&unit=k&from=18.4574500999879,-69.9374951999635&to=18.4739507000195,-69.9658190000337&drivingStyle=2&highwayEfficiency=21.0&locations=18.4574500999879,-69.9374951999635|18.4574500999879,-69.9374951999635|18.4574500999879,-69.9374951999635|18.4641813000198,-69.937076299917|18.4801647000131,-69.9080942999572|18.4934515000205,-69.9272894002497|

Could you please help me with this subject?

Was it helpful?

Solution

When using the MapQuest Open Directions API, you need to specify multiple stops along a route like this, without pipes -- and use "&to=..." to add multiple stops between the &from= and final destination:

http://open.mapquestapi.com/directions/v1/route?key=YOUR-KEY-HERE&outFormat=xml&routeType=shortest&enhancedNarrative=false&locale=en_US&unit=m&drivingStyle=2&highwayEfficiency=21.0&from=39.750560,-104.999388&to=39.745940,-104.985805&to=39.734952,-104.989947

The API also accepts JSON and XML input as well as Key/Value pairs.

Don't forget to sign up for a free appllication key!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top