2012-01-16 6 views
0

私はアンドロイドでGoogleマップに経路を描こうとしています。 (:...、左折など)、このAPIのJSONレスポンスから を は、そのために私は今、私は方向が矢印取得する方法を知っていただきたいと思いルートポイントhttp://code.google.com/intl/de-DE/apis/maps/documentation/directions/経路案内から道順を取得するにはどうすればよいですか?

を取得するには、Googleの方向APIを使用します。 http://maps.google.com/は(私の知る限り)同じ方向のAPIを使用し、それがすべてのエントリの左側に、このような矢印を描画します:Googleマップので、これは、可能なはず

{ 
"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" 
       }, 
    . 
    . 
    . 

応答は次のようになり(私が何を意味するかを見るためにどんなルートも計算する)。

、私は非常に助け

答えて

0

のあらゆる種類に感謝し、私のanswerを見てください。これは、 は、KMLを使用して、方向指示がこれは私が使っているものです

0

ファイルを取得するあなたに他の方法を提供します

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
Uri.parse("http://maps.google.com/maps?saddr="+latitude_cur+","+longitude_cur+"&daddr="+latitude+","+longitude)); 
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
intent.addCategory(Intent.CATEGORY_LAUNCHER);  
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); 
startActivity(intent); 
関連する問題