2016-01-06 65 views
1

您好我想噸我的應用程序使用osmdroid在離線模式下回回,我用這個代碼路Maneger爲Osmdroid錯誤狀態200

Drawable marker = Mmarker; 
    int markerWidth = marker.getIntrinsicWidth(); 
    int markerHeight = marker.getIntrinsicHeight(); 
    marker.setBounds(0, markerHeight/2, markerWidth/2, 0); 

    ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getApplicationContext()); 

    myItemizedOverlay = new MyItemizedOverlay(marker, resourceProxy,mapView,getApplicationContext()); 
    mapView.getOverlays().add(myItemizedOverlay); 

    mapView.setTileSource(new XYTileSource("MapQuest", 
      ResourceProxy.string.mapquest_osm, 0, 18, 256, ".jpg", new String[] { 
      "http://otile1.mqcdn.com/tiles/1.0.0/map/", 
      "http://otile2.mqcdn.com/tiles/1.0.0/map/", 
      "http://otile3.mqcdn.com/tiles/1.0.0/map/", 
      "http://otile4.mqcdn.com/tiles/1.0.0/map/"})); 
    mapView.setBuiltInZoomControls(true); 
    mapView.setMultiTouchControls(true); 

    mapView.setUseDataConnection(false); //optional, but a good way to prevent loading from the network and test your zip loading. 
    final IMapController mapController = mapView.getController(); 
    mapController.setZoom(14);  



class DrawPath extends AsyncTask<String,String,String>{ 
    RoadManager roadManager; 
    ArrayList<GeoPoint> waypoints; 
    Road road; 
    @Override 
    protected void onPreExecute() { 
     super.onPreExecute(); 
     roadManager = new OSRMRoadManager(); 
     waypoints = new ArrayList<GeoPoint>(); 
     waypoints.add(myLocation);//start point 
     waypoints.add(diCenter);// end point 
     if (roadOverlay != null) { 

      mapView.getOverlays().remove(roadOverlay); 

     } 
    } 

    @Override 
    protected String doInBackground(String... params) { 

     road = roadManager.getRoad(waypoints); 

     if (road.mStatus != Road.STATUS_OK){ 
      Log.e(tag, "drawPath road.status="+road.mStatus); 
     }else{ 
      roadOverlay = RoadManager.buildRoadOverlay(road, getApplicationContext()); 
      Log.i(tag, "drawPath road.status="+road.mStatus); 
     } 
     return null; 
    } 

    @Override 
    protected void onPostExecute(String s) { 
     super.onPostExecute(s); 

     mapView.getOverlays().add(roadOverlay); 
     mapView.invalidate(); 
    } 
} 

但每次我試圖繪製路徑,我得到的錯誤與狀態200。
我看到this link但沒有幫助我。
我的錯誤是:

D/BONUSPACK: OSRMRoadManager.getRoad:http://router.project-osrm.org/viaroute?&loc=36.339279999999995,59.551213&loc=36.311346,59.556574999999995&instructions=true&alt=false 
W/System.err: [DEBUG] GbaRequest - GbaRequest: Constructor Called 222 userAgent null 
W/System.err: [DEBUG] NafRequest - NafRequest: NafRequest constructor===useragent null  

我在瀏覽器中鍵入鏈​​接,我得到這個

{"status":200,"hint_data":{"locations":["fktFBf____90qyUADQAAAB8AAAAAAAAACQAAAFGxpgInqAAANX4qAuWtjAMAAAEB","Erk6Bf____9G0yUACgAAAEUAAAAAAAAA9wAAAH3ntQInqAAAFxEqAgbDjAMAAAEB"],"checksum":2413689480},"route_name":["بولوار جانباز","بولوار خیام"],"via_indices":[0,55],"found_alternative":false,"route_summary":{"end_point":"بولوار خیام","start_point":"بولوار جانباز","total_time":291,"total_distance":4031},"via_points":[[36.339253,59.551205],[36.311319,59.556614]],"route_instructions":[["10","بولوار جانباز",2097,0,142,"2096m","E",103,1,"W",283],["11-2","بولوار جانباز",1072,35,92,"1071m","SE",135,1,"NW",315],["8","بولوار سجاد",205,48,16,"205m","SE",129,1,"NW",309],["3","بولوار خیام",520,50,31,"519m","SW",220,1,"NE",40],["7","",17,53,2,"16m","SE",129,1,"NW",309],["7","بولوار خیام",19,54,1,"18m","NE",40,1,"SW",220],["15","",0,55,0,"0m","N",0,"N",0]],"status_message":"Found route between points","route_geometry":"ib~hdAi}[email protected]@[email protected]}W`@_ElL{qAnBuQbC{[email protected]_vAxHmLlG}[email protected]@jdIexFbdA}[email protected]|O{JxJmEzI{CrIoB`Y{ClZDprAhFzDTjJpBbG|DhGdL|B|JlFrIlFpAfG[|FiD`EwIhNaRvEuAzM\\t}AfGb|@fDvKjAtGdAxG~A`NrFdCjBdnB~sBvsCd|CvGbBtaAocBnE_Ih\\|][email protected]@|DgH}FkG"} 

,所以我覺得鏈接是正確的。

所以誰能幫助我呢?

回答

0

實際上,OSRM目前存在一個大問題。募集爲Issue 195

等待修復,您可以切換到MapQuest或GraphHopper。

請記住,這些服務不能脫機工作,他們需要一個在線連接。

+0

OSRM服務器再次工作。 – MKer

+0

順便說一句:GraphHopper也能夠離線運行 – Karussell

相關問題