nearest method

Future<NearestResponse> nearest(
  1. NearestOptions options
)

nearest

If you encounter any issues or have any questions, please consult the Project-OSRM documentation or open an issue on the Project-OSRM GitHub repository. Snaps a coordinate to the street network and returns the nearest n matches. Parameters:

  • coordinate: Location
  • number: number of nearest segments that should be returned

Examples:

cURL example

curl "http://router.project-osrm.org/nearest/v1/driving/-0.1234,51.1234?number=3"

Dart example

final nearest = await osrm.nearest(
  NearestOptions(
    coordinate: Location(latitude: 52.4224, longitude: 13.333086),
    number: 3,
  ),
);

Implementation

Future<NearestResponse> nearest(NearestOptions options) async {
  final response = await source.request(options);
  return NearestResponse.fromMap(response);
}