Sorry, you need to enable JavaScript to visit this website.

Search examples

Have a look at our functional examples to see how easy it is to implement search features with the Maps SDK.
Speed up development by using our sample code snippets in your app. Try all of this out with the Maps SDK Examples app!

Allow your users to easily search for addresses and POIs in a single step.
Implement global search or near-me search in your mobile app so that it returns the best search results for your needs.
Global search uses the search functionality’s default settings . It doesn’t use the user’s position or other search parameters.

Sample use case: You use an app to search for a place. This search should not be limited in any way.
Use the code snippet below in your app to list general search results or display them on the map.

return FuzzySearchQueryBuilder.create(text).build();

 

Add the code snippet presented below to your app to get search results that are geo-biased for a
given location in a range specified by a radius.

return FuzzySearchQueryBuilder.create(text).withPreciseness(new LatLngAcc(position, STANDARD_RADIUS)).build();

 



image

Global address search functional example from Sample App

image

Near me address search functional example from Sample App

Help your users search for specific types of places with category search.

Sample use case: You are preparing for a long drive and would like to find gas stations nearby.
Use the code snippet below to try this in your app.

FuzzySearchQueryBuilder.create(text)
        .withPreciseness(new LatLngAcc(position, STANDARD_RADIUS))
        .withTypeAhead(true)
        .withCategory(true).build();

 

For category search we use Online search - LowBandwidthSearch as in “Address and POI search”.
The difference is in endpoint:



Address search

GET https://<baseURL>/search/<versionNumber>/s/<query>...

Category search

GET https://<baseURL>/search/<versionNumber>/cS/<category>...

For complete description go to:

Below we present a exemplary application view utilizing Category Search.



image

Address search with category: Parking

image

Address search with category: Gas

image

Address search with category: ATM

Develop an international app that can be used in different languages. Enhance the search functionality with the language parameter so that the search returns results in a specific language.

Sample use case: If your mobile device is set to a particular language, you see it in your app as well.
Use the code snippet presented below to try this in your app.

return FuzzySearchQueryBuilder.create(text).withLanguage(lang).build();

 

Offer your users search suggestions while they type with the “typeahead” flag.

Sample use case: You were recommended a place to visit, but you can’t remember its name. You start searching in your app. After a few letters you see the place you’re looking for!
Use the code snippet below to try this in your app.

FuzzySearchQueryBuilder.create(text)
        .withPosition(position)
        .withTypeAhead(true).build();

 

Help your users even more with fuzzy search. Use the right fuzziness levels in your app to make it less sensitive to typos.

Sample use case: You occasionally make mistakes when typing. Your app still returns the desired search results.
Use the code snippet below to try this in your app.

  • Level 1 no spell checking

  • Level 2 is using normal n-gram spell checking. For example query "restrant" can be matched to
    "restaurant".

  • Level 3 is using sound-like spell checking, and shingle spell checking. Sound-like spell checking
    is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" to
    "mountain view" matching.

  • Level 4 doesn’t add any more spell checking function.

The search engine will start looking for a match on the level defined by minFuzzyLevel and will
stop searching at the level specified by maxFuzzyLevel.

FuzzySearchQueryBuilder.create(query)
.withPosition(position)
.withMinFuzzyLevel(1)
.withMaxFuzzyLevel(maxLevel).build();

 

Reverse geocoding

Sometimes you need to translate a coordinate into a human-readable street address. This is often used in tracking applications that receive a GPS feed from a device or asset and need to obtain the corresponding address. The reverse geocoding endpoint returns the address information described in the Reverse Geocoding API documentation on the Developer Portal.

Sample use case: You want to know the address of a place on the map. You press your finger on the map display, and address information appears in a balloon on the screen.
Use the code below to try this in your app:

SearchApi searchAPI = createSearchAPI();
ReverseGeocoderSearchQuery reverseGeocoderQuery =
        createReverseGeocoderQuery(latitude, longitude);

searchAPI.reverseGeocoding(reverseGeocoderQuery, new RevGeoSearchResultListener() {
    @Override
    public void onSearchResult(ReverseGeocoderSearchResponse response) {
        String address = getAddressFromResponse(response);
        balloon.setText(address);
        marker.select();
    }

    @Override
    public void onSearchError(SearchError error) {
        balloon.setText(context.getString(R.string.reverse_geocoding_error));
        marker.select();
    }
});

To cancel a pending search request in the Maps SDK, call:

getSearchProvider().cancelSearchIfRunning();

 

Search along the route

Allow your users to search for POIs along a planned route so they can add places to their rides optimally. 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 something in your vehicle to drive safely.

Use the code below 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);
searchAPI.alongRouteSearch(query.build(), alongRouteSearchCallback);

 

Sample views utilizing Search Along Route:



image

With term "PETROL_STATION"

image

With term "ELECTRIC_VEHICLE_STATION"

Allow your users to perform a free text search inside geometries specified by circles and/or polygons.

Sample use case: You are planing to visit the area of Amsterdam.  You need find a parking, an ATM and a grocery store in the city centre in Amsterdam and/or in the west part of the city.

Use the code below to try this in your app:

List<Geometry> geometries = new ArrayList<>();
geometries.add(new Geometry(new PolygonGeometry(POLYGON_POINTS)));
geometries.add(new Geometry(new CircleGeometry(CIRCLE_CENTER, CIRCLE_RADIUS)));

GeometrySearchQuery query = new GeometrySearchQueryBuilder(term, geometries)
        .withLimit(SEARCH_RESULTS_LIMIT).build();

SearchApi searchAPI = OnlineSearchApi.create(context);
searchAPI.geometrySearch(query, searchResultListener);

 

Sample views utilizing Geometry Search:



image

Geometry search with term: Parking

image

Geometry search with term: ATM

Entry points

Allow your users to display entry points using fuzzy search results.

Sample use case: A taxi driver wants to pick up a passenger from the specific entry point at the airport.

Use the code below to try this in your app:

for (EntryPoint entryPoint : fuzzySearchResult.getEntryPoints()) {
    SimpleMarkerBalloon balloon = new SimpleMarkerBalloon(
            String.format(view.getString(R.string.entry_points_type),
                    entryPoint.getType())
    );
    tomtomMap.addMarker(new MarkerBuilder(entryPoint.getPosition())
            .markerBalloon(balloon)
            .icon(icon));
}

 

Sample views utilizing entry points:



image

Entry points for the Amsterdam airport

image

Entry points for the Kalvertoren mall

Additional data

Allow your users to request extra data, like polygons representing administrative borders, for a set
of entities previously retrieved from an Online Search service. For more information, refer to the
Additional Data service
documentation.

Sample use case: You want to apply colors to geographic-boundary areas such as countries, cities or districts.

Use the code below to try this in your app:

FuzzySearchQueryBuilder fuzzySearchQuery = FuzzySearchQueryBuilder.create(term);

final SearchApi searchApi = OnlineSearchApi.create(view.getContext());
observableWork = searchApi.search(fuzzySearchQuery.build())
        .observeOn(getWorkingScheduler())
        .filter(nonEmptyResponse())
        .map(firstResultWithAdditionalData())
        .filter(nonEmptyResult())
        .map(whenResultPresent())
        .filter(whenGeometrySourcePresent())
        .map(firstAvailableGeometryData())
        .flatMap(geometryDataSource -> {
            AdditionalDataSearchQueryBuilder adpQuery = AdditionalDataSearchQueryBuilder.create();
            adpQuery.withGeometryDataSource(geometryDataSource);
            return searchApi.additionalDataSearch(adpQuery.build()).toMaybe();
        })
        .subscribeOn(getResultScheduler())
        .subscribe(adpResponse -> {
            fragment.enableOptionsView();
            new AdpResponseParser(new GeoDataConsumer(tomtomMap)).parseAdpResponse(adpResponse);
        });

 

Sample views utilizing entities retrieved from the Additional Data service:



image

Boundaries for Amsterdam

image

Boundaries for Poland

Allow your users to process synchronous batch search calls with the Batch Search
service integrated. When the service receives a request, it will respond as soon as the batch items
are calculated and there will be no possibility to retrieve the results later on.

Supported types of requests

  1. Geometry Search

  2. Fuzzy Search

  3. Reverse Geocoder

Different types of requests can be mixed in one batch request. The information about the limit of
queries, request processing time and other details are described in Batch Search
service documentation. An error in one of the batch requests causes the whole batch to fail.

Sample use case: You want to simultaneously search for different categories within different locations.

Use the code below to try this in your app:

//Using batch, it is possible to execute different search types:
//fuzzy, geometry or reverse geocoding. The order of responses
//is the same as the order in which the queries are added.

BatchSearchQueryBuilder batchQuery = new BatchSearchQueryBuilder();
batchQuery.withFuzzySearchQuery(getAmsterdamQuery(category));
batchQuery.withFuzzySearchQuery(getHaarlemQuery(category));
batchQuery.withGeometrySearchQuery(getHoofddropQuery(category));

final SearchApi searchApi = OnlineSearchApi.create(view.getContext());
searchApi.batchSearch(batchQuery.build(), batchSearchResultListener);

 

Sample views utilizing data retrieved using Batch Search service:


image

Search results for different locations