Combined search and geocode - finds and geocodes the best match
This is a convenience method that combines search and geocode in one call. Useful when you need coordinates directly from a text query.
Address text to search
Optionaloptions: { countryCode?: string; streetNumber?: string }Optional filtering options
Geocoded result of the best match, or null if no results
Geocode a suggestion to get precise coordinates
After selecting a suggestion from search(), use this method to get
the exact coordinates for the address. For streets, you can specify
a house number to get the precise location.
Geocode options with codes from suggestion
Geocoded result with coordinates and full address
// First search for suggestions
const suggestions = await service.search({ text: 'Provença 5' });
// Then geocode the selected suggestion with specific number
const location = await service.geocode({
streetCode: suggestions[0].street?.code,
streetNumber: '589',
cityCode: suggestions[0].city?.code,
countryCode: 'ESP'
});
logger.info(location.coord); // { lat: 41.41, lng: 2.18 }
ProtectedrequestExecutes a generic request to the Cercalia API.
Query parameters for the API request.
Human-readable name for logging and debugging.
OptionalbaseUrl: stringOptional override for the base API URL.
A promise resolving to the parsed API response.
Search for address/POI suggestions based on partial text input
Use this method for autocomplete/typeahead functionality. Returns suggestions ordered by relevance. Minimum 3 characters recommended for best results.
Search configuration
Array of suggestions ordered by relevance
Search for city/locality suggestions only
Convenience method for city-only autocomplete.
Search text
OptionalcountryCode: stringOptional country code filter
Array of city suggestions
Search for POI suggestions only
Convenience method for POI-only autocomplete.
Search text
Optionaloptions: {Optional filtering options
Array of POI suggestions
Search for street suggestions only
Convenience method for street-only autocomplete.
Search text
OptionalcountryCode: stringOptional country code filter
Array of street suggestions
SuggestService - Address and POI autocomplete using Cercalia Suggest API
This service provides real-time autocomplete suggestions for addresses, streets, cities, and POIs. It's designed for typeahead search experiences.
Key Features
Usage Examples
See
https://docs.cercalia.com/docs/cercalia-webservices/suggest/