Skip to content

Support Multiple Locations in the /nearest API #7150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
muteebali opened this issue Apr 13, 2025 · 3 comments
Open

Support Multiple Locations in the /nearest API #7150

muteebali opened this issue Apr 13, 2025 · 3 comments

Comments

@muteebali
Copy link

Description:

Currently, the OSRM /nearest API supports querying the nearest routable node for a single location at a time. This limitation results in increased overhead and slower performance when multiple locations need to be processed, as each location requires a separate API call.

Feature Request:

Add support for multiple locations in a single /nearest request, similar to how other OSRM APIs (like /route, /table, etc.) accept multiple coordinates via a semicolon-separated list.

Proposed Usage:

GET /nearest/v1/driving/13.388860,52.517037;13.397634,52.529407?number=1

Expected Behavior:

The response should return the nearest node(s) for each of the provided coordinates in the order they are specified. This would significantly improve the efficiency of nearest-node queries when working with batch data.

Benefits:

Reduced number of HTTP requests.

Improved performance and lower latency.

Better alignment with batch processing use cases.

Consistent API design with other OSRM endpoints

@DennisOSRM
Copy link
Collaborator

Interesting idea. Thanks for sharing.

@jcoupey
Copy link
Contributor

jcoupey commented Apr 15, 2025

similar to how other OSRM APIs (like /route, /table, etc.) accept multiple coordinates

The fundamental difference though is that when providing multiple coordinates to other endpoints, they're part of a single coherent request, answering an atomic question like finding a route through a number of waypoints or matching a trace.

In the case of nearest, the multiple coordinates would be totally independent so that sounds more like a batch treatment.

@muteebali
Copy link
Author

@jcoupey You're absolutely right — each location is an independent entity. It would be great to process multiple locations in a single api call and return one result per location. This approach helps minimize round-trip overhead and improves overall efficiency at caller end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants