我想在android中的谷歌地圖上繪製路線。 對於我使用谷歌的方向API來獲取路線點http://code.google.com/intl/de-DE/apis/maps/documentation/directions/如何從api響應方向獲取行車路線?
現在我想知道如何獲得方向箭頭(如:左轉,...)從這個API的JSON響應 。
的響應的樣子:
{
"routes" : [
{
"bounds" : {
"northeast" : {
"lat" : 48.306950,
"lng" : 14.304310
},
"southwest" : {
"lat" : 48.163440,
"lng" : 14.033580
}
},
"copyrights" : "Map data ©2012 GeoBasis-DE/BKG (©2009), Google",
"legs" : [
{
"distance" : {
"text" : "34.6 km",
"value" : 34554
},
"duration" : {
"text" : "31 mins",
"value" : 1866
},
"end_address" : "Linz, Austria",
"end_location" : {
"lat" : 48.306950,
"lng" : 14.285860
},
"start_address" : "Wels, Austria",
"start_location" : {
"lat" : 48.16545000000001,
"lng" : 14.036620
},
"steps" : [
{
"distance" : {
"text" : "0.3 km",
"value" : 252
},
"duration" : {
"text" : "1 min",
"value" : 28
},
"end_location" : {
"lat" : 48.164110,
"lng" : 14.033890
},
"html_instructions" : "Head \u003cb\u003esouthwest\u003c/b\u003e on \u003cb\u003eHans-Sachs-Straße\u003c/b\u003e toward \u003cb\u003eGemeindestr.\u003c/b\u003e",
"polyline" : {
"points" : "ai~dH{ottAHHHNN`@jBjFzBxF"
},
"start_location" : {
"lat" : 48.16545000000001,
"lng" : 14.036620
},
"travel_mode" : "DRIVING"
},
{
"distance" : {
"text" : "0.1 km",
"value" : 149
},
"duration" : {
"text" : "1 min",
"value" : 48
},
"end_location" : {
"lat" : 48.163440,
"lng" : 14.03470
},
"html_instructions" : "At the roundabout, take the \u003cb\u003e3rd\u003c/b\u003e exit onto \u003cb\u003eMagazinstr./B1\u003c/b\u003e",
"polyline" : {
"points" : "u`[email protected]@[email protected]@[email protected][email protected]"
},
"start_location" : {
"lat" : 48.164110,
"lng" : 14.033890
},
"travel_mode" : "DRIVING"
},
.
.
.
這應該是可能的,因爲谷歌地圖:http://maps.google.com/使用相同方向的API(據我所知),它借鑑了每個項目的左側這樣的箭頭的路線描述(只需計算任何路線即可查看我的意思)。
我很感激每一種幫助