SearchOptions

constructor(query: String = "", @IntRange(from = 1, to = 100) limit: Int = DEFAULT_LIMIT, countryCodes: Set<String> = emptySet(), geoBias: GeoPoint? = null, @Size(min = 0, max = 50) searchAreas: Set<Geometry> = emptySet(), locale: Locale = Locale.getDefault(), resultTypes: Set<SearchResultType> = emptySet(), categoryIds: Set<CategoryId> = emptySet(), brands: Set<Brand> = emptySet(), connectors: Set<ConnectorType> = emptySet(), minPower: Power? = null, maxPower: Power? = null, fuelTypes: Set<FuelType> = emptySet(), openingHoursMode: OpeningHoursMode? = null, sessionId: UUID? = null)

Initializes the search options with the provided parameters for a search request.

Parameters

query

The search query. Defaults to an empty string if not specified.

limit

The maximum number of search results to return. Must be between MIN_LIMIT and MAX_FUZZY_LIMIT. Defaults to DEFAULT_LIMIT.

countryCodes

A set of ISO 3166-1 alpha3 country codes. (e.g., FRA,ESP). This will limit the search to the specified countries.

geoBias

The GeoPoint position where results should be biased.

searchAreas

The geographic filter for search, all search results returned are confined in the specified geography. Max number of geometries is MAX_NUMBER_OF_SEARCH_AREAS. Three types of geometries can be passed as searchAreas: CircleGeometry, RectangleGeometry and PolygonGeometry. When a single CircleGeometry is set the CircleGeometry center overrides geoBias.

locale

The language in which search results should be returned. If not specified, language is set to the system default language.

resultTypes

A set of SearchResultType which should be used for the search. An empty set implies search can return results of any type. Other filters can influence the selection of resultTypes. For example when a category filter is set, result types are limited to SearchResultType.Poi.

categoryIds

Restricts the Points Of Interest in the response to those whose ID is listed.

brands

A list of brand names (case sensitive) used to restrict the result.

connectors

A list of connector types used to restrict the result to Points Of Interest of type Electric Vehicle Station, supporting specific connector types. See https://developer.tomtom.com/search-api/search-api-documentation/supported-connector-types for more details.

minPower

A power rate, used to restrict the results to electric vehicle stations with at least one connector that has a power greater or equal to that minimum power.

maxPower

A power rate, used to restrict the results to electric vehicle stations with at least one connector that has a power lesser or equal to that maximum power.

fuelTypes

A set of a FuelType used to restrict the result to Points Of Interest with those specific fuels.

openingHoursMode

The opening hours scope. If it's not provided, no data about opening hours will be returned.

sessionId

A search session is a user session during which a user performs multiple search requests to find a specific address or point of interest. Connecting search request with a session improves quality of online search. It must be a valid UUIDv4. If it is not provided, no feedback is sent.

Throws

if any of the provided arguments do not meet their specified constraints.


constructor(route: List<GeoPoint>, query: String = "", @IntRange(from = 1, to = 20) limit: Int = DEFAULT_LIMIT, maxDetourDuration: Duration? = MAX_DETOUR_DURATION_UPPER_LIMIT, categoryIds: Set<CategoryId> = emptySet(), brands: Set<Brand> = emptySet(), fuelTypes: Set<FuelType> = emptySet(), connectors: Set<ConnectorType> = emptySet(), minPower: Power? = null, maxPower: Power? = null, sortOrder: SortOrder = SortOrder.ByDetourTime, openingHoursMode: OpeningHoursMode? = null, sessionId: UUID? = null, locale: Locale = Locale.getDefault())

Initializes the search options along a specified route with additional parameters. This constructor is useful for defining searches that are constrained along a route, such as finding points of interest along the remaining part of a journey.

Parameters

route

A list of GeoPoint defining the route to search along. Must contain at least two points.

query

The search query. Defaults to an empty string if not specified.

limit

The maximum number of search results to return. Must be between MIN_LIMIT and MAX_ALONG_ROUTE_LIMIT. Defaults to DEFAULT_LIMIT.

maxDetourDuration

The maximum allowed detour duration. Defaults to MAX_DETOUR_DURATION_UPPER_LIMIT if not specified.

categoryIds

Restricts the Points Of Interest in the response to those whose ID is listed.

brands

A list of brand names (case sensitive) used to restrict the result.

fuelTypes

A set of a FuelType used to restrict the result to Points Of Interest with those specific fuels.

connectors

A list of connector types used to restrict the result to Points Of Interest of type Electric Vehicle Station, supporting specific connector types. See https://developer.tomtom.com/search-api/search-api-documentation/supported-connector-types for more details.

minPower

A power rate, used to restrict the results to electric vehicle stations with at least one connector that has a power greater or equal to that minimum power.

maxPower

A power rate, used to restrict the results to electric vehicle stations with at least one connector that has a power lesser or equal to that maximum power.

openingHoursMode

Specifies whether to return opening hours information for POIs. If not provided, no opening hours data will be returned.

sessionId

A search session is a user session during which a user performs multiple search requests to find a specific address or point of interest. This is needed for sending feedback to the online search. It must be a valid UUIDv4. If it is not provided, no feedback is sent.

locale

The language in which search results should be returned. If not specified, language is set to the system default language.

Throws

if any of the provided arguments do not meet their specified constraints.

A common use case is to search along the remaining part of the current route. Example:

lateinit var route: Route
lateinit var routeProgress: RouteProgress
val routePoints = route.routePoints
val distanceAlongRoute = routeProgress.distanceAlongRoute

val remainingRoutePoints = routePoints.drop(
routePoints.indexOfLast{ it.routeOffset <= distanceAlongRoute }.coerceIn(routePoints.indices)
)

val query = "ATM"
val searchOptions =
SearchOptions(
query = query,
route = remainingRoutePoints.map { it.coordinate }
)