getMultiRouteCoordinates method
Future<List<Coordinate> >
getMultiRouteCoordinates({
- required List<
Coordinate> coordinates, - Object? alternativeRoutes,
- List<
String> ? attributes, - bool continueStraight = false,
- bool? elevation,
- List<
String> ? extraInfo, - bool geometrySimplify = false,
- String? id,
- bool instructions = true,
- String instructionsFormat = 'text',
- String language = 'en',
- bool maneuvers = false,
- Object? options,
- String preference = 'recommended',
- List<
int> ? radiuses, - bool roundaboutExits = false,
- List<
int> ? skipSegments, - bool suppressWarnings = false,
- String units = 'm',
- bool geometry = true,
- int? maximumSpeed,
- ORSProfile? profileOverride,
Fetches the Direction Route information for the route connecting the
various given coordinates
, from the openrouteservice API, and then
parses it's coordinates to a List of Coordinate objects.
To return the entire GeoJsonFeatureCollection containing the response data, use ORSDirections.getRouteDirectionsGeoJson.
Information about the endpoint and all the parameters can be found at: https://openrouteservice.org/dev/#/api-docs/v2/directions/{profile}/geojson/post
Implementation
Future<List<Coordinate>> getMultiRouteCoordinates({
required List<Coordinate> coordinates,
Object? alternativeRoutes,
List<String>? attributes,
bool continueStraight = false,
bool? elevation,
List<String>? extraInfo,
bool geometrySimplify = false,
String? id,
bool instructions = true,
String instructionsFormat = 'text',
String language = 'en',
bool maneuvers = false,
Object? options,
String preference = 'recommended',
List<int>? radiuses,
bool roundaboutExits = false,
List<int>? skipSegments,
bool suppressWarnings = false,
String units = 'm',
bool geometry = true,
int? maximumSpeed,
ORSProfile? profileOverride,
}) async {
// Fetch and parse the data.
final GeoJsonFeatureCollection featureCollection =
await getMultiRouteDirectionsGeoJson(
coordinates: coordinates,
alternativeRoutes: alternativeRoutes,
attributes: attributes,
continueStraight: continueStraight,
elevation: elevation,
extraInfo: extraInfo,
geometrySimplify: geometrySimplify,
id: id,
instructions: instructions,
instructionsFormat: instructionsFormat,
language: language,
maneuvers: maneuvers,
options: options,
preference: preference,
radiuses: radiuses,
roundaboutExits: roundaboutExits,
skipSegments: skipSegments,
suppressWarnings: suppressWarnings,
units: units,
geometry: geometry,
maximumSpeed: maximumSpeed,
profileOverride: profileOverride,
);
return featureCollection.features.first.geometry.coordinates.first;
}