Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 2 months 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 (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-11T18:14:38.000Z (5 months ago)
- Last Synced: 2024-10-12T08:42:14.584Z (2 months ago)
- Topics: client-api, dart, flutter, osm, package, routing
- Language: Dart
- Homepage: https://pub.dev/packages/routing_client_dart
- Size: 125 KB
- Stars: 18
- Watchers: 2
- Forks: 12
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Routing Client Dart Package
![pub](https://img.shields.io/badge/pub-v0.5.5-orange)> 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### example for 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 = OSRMManager();
final road = await manager.getRoad(
waypoints: waypoints,
geometries: Geometries.polyline,
steps: true,
languageCode: "en",
);
```### example for 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 = OSRMManager();
final road = await manager.getTrip(
waypoints: waypoints,
roundTrip:false,
source: SourceGeoPointOption.first,
destination: DestinationGeoPointOption.last,
geometries: Geometries.polyline,
steps: true,
languageCode: "en",
);
```### build instruction from road
```dart
final instructions = await manager.buildInstructions(road);
```### 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