2013-08-22 76 views

回答

0

我糾正了我以前的答案,這是可能的。您使用此鏈接中列出的谷歌路線API:

您發送您的方向請求,並根據您的偏好以json或xml的形式返回方向。爲您提供路線上每個點的座標。

,如果你想要回方向爲JSON請求將是您發送請求到http://maps.googleapis.com/maps/api/directions/outputformat?parameters

所以:

http://maps.googleapis.com/maps/api/directions/json?origin=ORIGIN_LOCATION&destination=DESTINATION_LOCATION&sensor=FALSE

ORIGIN_LOCATIONDESTINATION_LOCATION可以是一個緯度和經度分隔用逗號例如latitude,longitude或位置搜索字符串,例如Eiffel+Tower+,+Paris+France(搜索字符串必須進行url編碼)。

傳感器參數是另一個強制參數,並詢問發送請求的設備是否可以檢測到它自己的位置。

例如,對於從艾菲爾鐵塔盧浮宮方向以下鏈接爲JSON上給出:

http://maps.googleapis.com/maps/api/directions/json?origin=Louver+museum+Paris&destination=Eiffel+Tower+Paris+France&sensor=false

並將其返回的XML:

http://maps.googleapis.com/maps/api/directions/xml?origin=Louver+museum+Paris&destination=Eiffel+Tower+Paris+France&sensor=false

+0

Google Maps for iOS是無限制的查詢。 API請求的方向屬於哪個域? – Cris

+0

我編輯了我的答案與更多的細節,更多信息可以在這裏找到谷歌文檔: https://developers.google.com/maps/documentation/directions/#DirectionsRequests –

+0

@ cris做了這個幫助嗎?如果是的話,你可以將其標記爲答案。謝謝! –