Filter only cities on maps SDK for web

Hello all,
I would like to do a 2 steps search, first step to search on the cities (big&medium size cities) and when the user choose the city to search on the street of this selected city.
Can you please help?

Hi and welcome to our community :slight_smile:

To search for cities you can use our fuzzy search service with the parameter idxSet: Geo (https://developer.tomtom.com/maps-sdk-web-js/documentation#Services.services.fuzzySearch). You will still have to do some filtering on your side to get only the cities. For more information about idxSet have a look here: https://developer.tomtom.com/search-api/search-api-documentation-search/fuzzy-search

Then, to search in a particular geography obtained in the previous call you can use geography search (https://developer.tomtom.com/search-api/search-api-documentation-search/geometry-search). To search only for addresses you need to use idxSet: PAD,Addr in the call.

Hope this was helpful!

1 Like