Last updated:
0 purchases
routing client dart
Routing Client Dart Package #
Package for osm routing client api
for now this package support only server based on osrm-backend
client api support #
OSRM Client Api
route service
trip service
Installing #
Add the following to your pubspec.yaml file:
dependencies:
routing_client_dart: ^0.5.5
copied to clipboard
example for route service #
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",
);
copied to clipboard
example for trip service #
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",
);
copied to clipboard
build instruction from road #
final instructions = await manager.buildInstructions(road);
copied to clipboard
example for check Location in Road #
final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
final isOnPath =
await roadManager.isOnPath(road, currentLocation, tolerance: 5);
copied to clipboard
Example to get next navigation instruction of current Location #
final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
final isOnPath =
final instruction = await roadManager.nextInstruction(instructions, road, currentLocation, tolerance: 5);
copied to clipboard
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.