Search along the route
Search along the route
Allow your users to search for POIs (Points of Interest) along a planned route so they can optimally add places to their rides. This search is constrained by specifying the detour time and limiting the number of results. The minimum number of route points is 2.
Sample use case 1: You are driving from Amsterdam to Haarlem and you would like to find a gas station or an EV station to fuel or charge your car during your drive.
Sample use case 2: When planning your next trip, you would like to add a car repair station so you can fix and safely drive your vehicle.
Use the following code to try this in your app:
_
AlongRouteSearchQueryBuilder query = new AlongRouteSearchQueryBuilder(
term,
route.getCoordinates(),
SEARCH_MAX_DETOUR_TIME);
query.withLimit(SEARCH_MAX_LIMIT);
SearchApi searchAPI = OnlineSearchApi.create(context, BuildConfig.SEARCH_API_KEY);
searchAPI.alongRouteSearch(query.build(), alongRouteSearchCallback);
val query = AlongRouteSearchQueryBuilder(
term,
route.getCoordinates(),
SEARCH_MAX_DETOUR_TIME
)
.withLimit(SEARCH_MAX_LIMIT)
.build()
searchApi.alongRouteSearch(query)
Sample views utilizing Search Along Route:
![]() With term "PETROL_STATION" |
![]() With term "ELECTRIC_VEHICLE_STATION" |