https://github.com/liodali/osm-routing-client-dart
flutter package for osrm client api and open source routing service
https://github.com/liodali/osm-routing-client-dart
client-api dart flutter osm package routing
Last synced: about 1 month ago
JSON representation
flutter package for osrm client api and open source routing service
- Host: GitHub
- URL: https://github.com/liodali/osm-routing-client-dart
- Owner: liodali
- License: mit
- Created: 2021-10-17T11:42:53.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-14T08:24:32.000Z (about 2 months ago)
- Last Synced: 2025-04-09T16:05:25.166Z (about 1 month ago)
- Topics: client-api, dart, flutter, osm, package, routing
- Language: Dart
- Homepage: https://pub.dev/packages/routing_client_dart
- Size: 213 KB
- Stars: 18
- Watchers: 1
- Forks: 15
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Routing Client Dart Package
> Package for osm routing client api
> we support routing API for osrm-backend
> also Valhalla Route API (more APIs will be added )
> openrouteservice (coming soon)
> from 1.0.0 instruction will be included directly when requesting the route
> you can use our osrm service or valhalla service directly insteado of our RoutingManager
### client api support
* OSRM Client Api
* route service
* trip service
* Valhalla Client
* route service API## Installing
Add the following to your `pubspec.yaml` file:
dependencies:
routing_client_dart: ^1.0.7### example for osrm route service
```dart
List waypoints = [
LngLat(lng: 13.388860, lat: 52.517037),
LngLat(lng: 13.397634, lat: 52.529407),
LngLat(lng: 13.428555, lat: 52.523219),
];
final manager = RoutingManager();
final route = await manager.getRoute(
OSRMRequest.route(
waypoints: waypoints,
geometries: Geometries.polyline,
steps: true,
languages: Languages.en,
)
);
```### example for osrm trip service
```dart
List waypoints = [
LngLat(lng: 13.388860, lat: 52.517037),
LngLat(lng: 13.397634, lat: 52.529407),
LngLat(lng: 13.428555, lat: 52.523219),
];
final manager = RoutingManager();
final road = await manager.getRoute(
OSRMRequest.trip(
waypoints: waypoints,
destination: DestinationGeoPointOption.last,
source: SourceGeoPointOption.first,
geometries: Geometries.polyline,
steps: true,
languages: Languages.en,
roundTrip:false,
)
);
```### example for check Location in Road
```dart
final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
final isOnPath =
await roadManager.isOnPath(road, currentLocation, tolerance: 5);
```### Example to get next navigation instruction of current Location
```dart
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
**Note** you can get voice instruction for valhalla instruction
**Note** more documentation will be added to soon