【发布时间】:2014-02-19 07:57:55
【问题描述】:
在日志中
02-19 14:41:29.151 10336-10336/com.example.app E/BONUSPACK﹕ OSRMRoadManager::getRoad: request failed.
02-19 14:41:29.151 10336-10336/com.example.app I/System.out﹕ 2
我有route.gpx 文件,但我不知道如何使用它
GeoPoint startPoint = new GeoPoint(48.13, -1.63);
mapView = (MapView) findViewById(R.id.mapview);
mapCTRL = (MapController) mapView.getController();
mapCTRL.setZoom(13);
mapView.setBuiltInZoomControls(true);
mapCTRL.setCenter((new GeoPoint(startPoint)));
RoadManager roadManager = new OSRMRoadManager();
ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
waypoints.add(startPoint);
//waypoints.add(new GeoPoint(16.236505, 103.264646)); //end point บ้านดินดำ
waypoints.add(new GeoPoint(48.4, -1.9)); //end point
Road road = roadManager.getRoad(waypoints);
System.out.println(road.mStatus);
Polyline roadOverlay = RoadManager.buildRoadOverlay(road, this);
mapView.getOverlays().add(roadOverlay);
mapView.invalidate();
setContentView(mapView);
mapView.invalidate();
【问题讨论】:
-
你考虑过使用 osmdroid 奖励包吗? code.google.com/p/osmbonuspack
-
@MaM 是的,我想显示 A 到 B 之间的路线方向
-
@illnino 如何使用 OSM API 设置源坐标和目标坐标,它是什么?
-
@KarthikeyanVe 我在我的 garph 文件类型 .gpx 中使用 lat lon 在我的离线应用程序上设置 A 到 B
标签: android openstreetmap osmdroid