directionsRouteCoordsGet method
Future<List<ORSCoordinate> >
directionsRouteCoordsGet({
- required ORSCoordinate startCoordinate,
- required ORSCoordinate 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 ORSCoordinate objects.
To return the entire GeoJsonFeatureCollection containing the response data, use ORSDirections.directionsRouteGeoJsonGet.
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<ORSCoordinate>> directionsRouteCoordsGet({
required ORSCoordinate startCoordinate,
required ORSCoordinate endCoordinate,
ORSProfile? profileOverride,
}) async {
// Fetch and parse the data.
final GeoJsonFeatureCollection featureCollection =
await directionsRouteGeoJsonGet(
startCoordinate: startCoordinate,
endCoordinate: endCoordinate,
profileOverride: profileOverride,
);
return featureCollection.features.first.geometry.coordinates.first;
}