osrm 0.0.1 copy "osrm: ^0.0.1" to clipboard
osrm: ^0.0.1 copied to clipboard

outdated

Open Source Routing Machine (OSRM) client for Dart.

example/osrm_example.dart

import 'package:osrm/osrm.dart';
import 'dart:io';
import 'dart:math' as math;

/// how to use the OSRM package to get a route between two coordinates.
void main() async {
  final osrm = Osrm();
  // get the route
  final options =  RouteRequest(
      coordinates: [
      // LatLng
      (36.479960, 2.829099),
      (36.473662, 2.825987),
    ],
    geometries: OsrmGeometries.geojson,
    overview: OsrmOverview.full,
    alternatives: OsrmAlternative.number(2),
    annotations: OsrmAnnotation.true_,
    steps: true,

  );
  print(osrm.source.serverBuilder(options));
  final route = await osrm.route(options);
  List<Map<String,double>> latlng = route.routes.first.geometry!.lineString!.coordinates.map((e) {
    return e.toCoordinateMap();
  }).toList();
  print(latlng);
}
26
likes
0
points
187
downloads

Publisher

verified publisherphysia.dev

Weekly Downloads

Open Source Routing Machine (OSRM) client for Dart.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http, recase

More

Packages that depend on osrm