Viewing version 1.0.8. Open the latest package page.
routing_client_dart
1.0.8Dart Package for Routing Client Api ( support OSRM/Valhalla project )
Readme
Routing Client Dart Package
pub
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
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 = RoutingManager();
final route = await manager.getRoute(
OSRMRequest.route(
waypoints: waypoints,
geometries: Geometries.polyline,
steps: true,
languages: Languages.en,
)
);
example for osrm 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 = 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
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
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
Changelog
1.0.8:
- fix bug in getRoute alternatives (#30)
1.0.7:
- remove isolate to support wasm
- bump dart sdk to 3.7
1.0.6:
- fix nextInstruction implementation
- decode geometry in osrm road if geometry as given is string
1.0.5:
- fix copy instruction in getOSRMRoad #26
1.0.4:
- improve internally osrm_service,valhalla_service
1.0.3:
- change the name RoadType to
RoutingType
1.0.2:
- export route model
1.0.1:
- forget to export OSRMRequest & ValhallaRequest
1.0.0: add valhalla route API
- break changes:
- replace OSRMManager with RoutingManager
- replace getRoad with getRoute
- remove buildInstruction ( becone integrated automatically with route object )
- replace Road by Route
- replace return of OSRM api to OSRMRoad
- create OSRMService for osrm apis
- create ValhallaService for valhalla apis
0.5.5: fix bug
- fix bug related to generate path for getRoute
0.5.4:
- remove unnecessary dependency
- add check for nullable in road for attribute geometry
- thanks for @eshjordan, @derklaro for their contribution
0.5.3:
- add destinations to get all destination from road
0.5.2:
- remove some unnecessary files
0.5.1:
- fix bug
0.5.0:
- add
isOnPath,nextInstructionin OSRMManager - support new languages for instructions
0.4.3: fix bug #16
- fix compute
parseRoadin mobile platform
0.4.2: fix bugs
- fix load json for instructionsHelper
0.4.1: fix bugs
- fix uninitialized dio in OSRMManager default constructor
- remove instructions from road classes
0.4.0: re-implementation for buildInstruction
0.3.2: update dependency
0.3.1:
- fix parse route when configure geometry to geojson
- add new attribute polyline
0.3.0+1:
- fix parse data
0.3.0: trip service
- add new method
getTripthat implement req call to trip service for osrm
0.2.0:
- add get route alternatives inside road
0.1.1: fix parse json
- fix parse duration value from road json
0.1.0:
- support osrm client
- add example in readme
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'routing_client_dart:1.0.8'pubspec.yaml
name: routing_client_dart
description: Dart Package for Routing Client Api ( support OSRM/Valhalla project )
version: 1.0.8
topics:
- osm
- routing
- osrm
- valhalla
homepage: https://github.com/liodali/OSM-Routing-Client-Dart
environment:
sdk: ">=3.7.0 <4.0.0"
dependencies:
# flutter:
# sdk: flutter
dio: '>=5.6.0'
fixnum: ^1.1.0
dev_dependencies:
# flutter_test:
# sdk: flutter
# flutter_lints: ^3.0.1
lints: any
test: ^1.5.1
http_mock_adapter: ^0.6.1
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
# flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - packages/routing_client_dart/src/assets/en.json
# - packages/routing_client_dart/src/assets/de.json
# - packages/routing_client_dart/src/assets/es.json
# - packages/routing_client_dart/src/assets/ar.json
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | On demand | Download | 1052d911…a285af |
| 0.1.1 | On demand | Download | 49893b0f…085b0d |
| 0.2.0 | On demand | Download | 329d4b25…92f286 |
| 0.3.0 | On demand | Download | 6c386038…04cb06 |
| 0.3.0+1 | On demand | Download | 8da96e12…c787fd |
| 0.3.1 | On demand | Download | 6bdd8293…f53790 |
| 0.3.2 | On demand | Download | 7e1e5400…d414fa |
| 0.4.0 | On demand | Download | 9799b197…7c3bab |
| 0.4.1 | On demand | Download | a5eaa3bb…4893a7 |
| 0.4.2 | On demand | Download | b082289b…e221d2 |
| 0.4.3 | On demand | Download | 00089e50…301de9 |
| 0.5.0 | On demand | Download | 74d3ba32…e0d83b |
| 0.5.1 | On demand | Download | d052851b…f59073 |
| 0.5.2 | On demand | Download | cc8d908c…1a959a |
| 0.5.3 | On demand | Download | 2e006535…9050a9 |
| 0.5.4 | On demand | Download | b7d48ba1…32ebcc |
| 0.5.5 | On demand | Download | 4e2acf11…70cb33 |
| 1.0.0 | On demand | Download | ee720e00…297316 |
| 1.0.1 | On demand | Download | 46154c8d…701571 |
| 1.0.2 | On demand | Download | 9eaee3a8…eed6cd |
| 1.0.3 | On demand | Download | c04073a7…f1e902 |
| 1.0.4 | On demand | Download | cda2c01f…9d8c5a |
| 1.0.5 | On demand | Download | a9b7e9e0…1b3a44 |
| 1.0.6 | On demand | Download | 5b000c1f…06ef24 |
| 1.0.7 | On demand | Download | f0f46c34…b88c4f |
| 1.0.8 | Cached · Upstream SHA-256 matched | Download | 0aa44f6a…31c89e |
Dependencies
dio "\u003e=5.6.0"
fixnum "^1.1.0"