getRouteCoordinates method
Future<List<Coordinate> >
getRouteCoordinates({
- required Coordinate startCoordinate,
- required Coordinate endCoordinate,
- ORSProfile? profileOverride,
Fetches the Direction Route information for the route between
startCoordinate
and endCoordinate
from the openrouteservice API, and
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}/get
Implementation
Future<List<Coordinate>> getRouteCoordinates({
required Coordinate startCoordinate,
required Coordinate endCoordinate,
ORSProfile? profileOverride,
}) async {
// Fetch and parse the data.
final GeoJsonFeatureCollection featureCollection =
await getRouteDirectionsGeoJson(
startCoordinate: startCoordinate,
endCoordinate: endCoordinate,
profileOverride: profileOverride,
);
return featureCollection.features.first.geometry.coordinates.first;
}