2012-11-29 19 views
1

我使用谷歌地圖和做的事情一樣,我只需要添加參數航點:如何在MapquestApi中請求帶有路標(多個位置)的路線?

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

但現在我想使用MapQuest,我無法弄清楚如何去做。

我嘗試添加他們在定位參數,但它沒有工作:

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&位置= 18.4574500999879,-69.9374951999635 | 18.4574500999879,-69.9374951999635 | 18.4574500999879,-69.9374951999635 | 18.4641813000198,-69.937076299917 | 18.4801647000131,-69.9080942999572 | 18.4934515000205,-69.9272894002497 |

你能幫我解決這個問題嗎?

回答

2

當使用MapQuest Open Directions API,你需要沿着這樣的路徑指定多個停止,無管道 - 並使用「&爲= ...」到&從之間添加多個停靠點=和最終目的地:

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

該API還接受JSON和XML輸入以及鍵/值對。

不要忘了註冊一個免費的應用程序密鑰!

+0

問題是我仍然得到兩條路線相同的距離!一個人,你和我沒有任何位置... – Laggel

+1

對不起 - 我在我的要求中也犯了一個錯誤。您必須在起點和終點之間添加多個「&to =」值以執行多點路線。我編輯了我的帖子。 – jharahush

相關問題