Package for osm routing client api
for now this package support only server based on osrm-backend
- OSRM Client Api
- route service
- trip service
Add the following to your pubspec.yaml file:
dependencies:
routing_client_dart: ^0.5.5
List<LngLat> waypoints = [
LngLat(lng: 13.388860, lat: 52.517037),
LngLat(lng: 13.397634, lat: 52.529407),
LngLat(lng: 13.428555, lat: 52.523219),
];
final manager = OSRMManager();
final road = await manager.getRoad(
waypoints: waypoints,
geometries: Geometries.polyline,
steps: true,
languageCode: "en",
);List<LngLat> waypoints = [
LngLat(lng: 13.388860, lat: 52.517037),
LngLat(lng: 13.397634, lat: 52.529407),
LngLat(lng: 13.428555, lat: 52.523219),
];
final manager = OSRMManager();
final road = await manager.getTrip(
waypoints: waypoints,
roundTrip:false,
source: SourceGeoPointOption.first,
destination: DestinationGeoPointOption.last,
geometries: Geometries.polyline,
steps: true,
languageCode: "en",
); final instructions = await manager.buildInstructions(road);final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
final isOnPath =
await roadManager.isOnPath(road, currentLocation, tolerance: 5);final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
final isOnPath =
final instruction = await roadManager.nextInstruction(instructions, road, currentLocation, tolerance: 5);
Warning the precision of LngLat should be 5 if the road contain polylineEncoded, or the same precies as LngLat in polylines
Note you can get some inaccurate information nextInstruction,for that we will be happy for yours contributions