Type Alias MaptilerGeocoderOptions
adjustUrl?: (url: URL) => void;
apiKey?: string;
apiUrl?: string;
bbox?: BBox;
clearButtonTitle?: string;
clearListOnPick?: boolean;
clearOnBlur?: boolean;
collapsed?: boolean;
country?: string | string[];
debounceSearch?: number;
enableReverse?: EnableReverse;
errorMessage?: string;
excludeTypes?: boolean;
exhaustiveReverseGeocoding?: boolean;
fetchFullGeometryOnPick?: boolean;
fetchParameters?: RequestInit;
filter?: (feature: Feature) => boolean;
fuzzyMatch?: boolean;
iconsBaseUrl?: string;
keepListOpen?: boolean;
language?: string | string[] | null;
limit?: number;
minLength?: number;
noResultsMessage?: string;
openListOnTop?: boolean;
placeholder?: string;
proximity?: ProximityRule[] | null;
reverseActive?: boolean;
reverseButtonTitle?: string;
reverseGeocodingExcludeTypes?: boolean;
reverseGeocodingLimit?: number;
reverseGeocodingTypes?: TypeRule[];
selectFirst?: boolean;
showPlaceType?: ShowPlaceType;
showResultsWhileTyping?: boolean;
types?: TypeRule[];
worldview?: Worldview;
}
Implemented by
Index
Properties
Properties
OptionaladjustUrl
Type Declaration
- (url: URL): void
Parameters
- url: URL
URL parameter that can be modified.
Default: Empty function.
Returns void
- url: URL
OptionalapiKey
MapTiler API key.
OptionalapiUrl
Geocoding API URL.
Default: MapTiler Geocoding API URL.
Optionalbbox
Bounding box in the format [minX, minY, maxX, maxY] to limit search results.
Default: undefined.
OptionalclearButtonTitle
Title of the clear button.
Default: "clear".
OptionalclearListOnPick
Clears the result list after picking an item. Prevents redisplaying the list when the input box is focused.
Default: false.
OptionalclearOnBlur
Clears the input value when it loses focus.
Default: false.
Optionalcollapsed
Collapses the geocoder control until hovered or focused.
Default: false.
Optionalcountry
Limits search to the specified country or countries.
Default: undefined (all countries).
OptionaldebounceSearch
Time delay (in milliseconds) before querying the server after typing in the input box. Useful for reducing the number of API calls.
Default: 200.
OptionalenableReverse
Enables reverse geocoding:
"button": Enables reverse geocoding button."always": Reverse geocoding is always active.
Default: "never".
OptionalerrorMessage
Custom error message.
Default: "Something went wrong…".
OptionalexcludeTypes
Includes all available types except those listed in the types option.
See reverseGeocodingExcludeTypes for reverse geocoding exclusion.
Default: false.
OptionalexhaustiveReverseGeocoding
Uses the limit option value for reverse geocoding even if the types option has multiple elements.
Works only if enabled on the server.
Default: false.
OptionalfetchFullGeometryOnPick
Enables fetching the full geometry (polygon etc.) instead of just a point on a picked feature.
Default: false.
OptionalfetchParameters
Additional parameters for fetch requests.
Default: undefined.
Optionalfilter
Callback function to filter results from the Geocoding API response.
The function should return true to keep an item, or false to exclude it.
Default: A function that always returns true.
OptionalfuzzyMatch
Enables fuzzy search.
Default: true.
OptionaliconsBaseUrl
Base URL for POI icons.
Default: "https://cdn.maptiler.com/maptiler-geocoding-control/v${version}/icons/"
OptionalkeepListOpen
Keeps the result list open even if the control is unfocused.
Default: false.
Optionallanguage
Language for response text and query weighting.
Accepts IETF language tags.
Set to null or an empty string to disable language-specific searching.
Default: undefined (uses the browser's language settings).
Optionallimit
Maximum number of results to display.
See reverseGeocodingLimit for reverse geocoding limits.
Default: 5.
OptionalminLength
Minimum number of characters required to start a search.
Default: 2.
OptionalnoResultsMessage
Custom message for when no results are found.
Default:
"Oops! Looks like you're trying to predict something that's not quite right.We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term.Keep on typing - we'll do our best to get you where you need to go!"
OptionalopenListOnTop
Opens the result list above the query input instead of below. Used when mounted at the bottom of a map.
Default: false.
Optionalplaceholder
Custom placeholder for the input box.
Default: "Search".
Optionalproximity
Prioritizes search results closer to a proximity point.
The first matching rule in the array is used.
Set to null to disable proximity.
Default: [ { type: "server-geolocation" } ].
OptionalreverseActive
Activates reverse geocoding.
Default: false.
OptionalreverseButtonTitle
Title of the reverse geocoding toggle button.
Default: "toggle reverse geocoding".
OptionalreverseGeocodingExcludeTypes
Excludes types for reverse geocoding.
Default: Same as excludeTypes.
OptionalreverseGeocodingLimit
Limits results for reverse geocoding. Applied only if value is 1 or effective types contain a single value.
See also reverseGeocodingTypes option.
Default: The value of the limit option if set. If effective types contain a single value, the default is 1. In all other cases, this option is not used.
OptionalreverseGeocodingTypes
Specifies types for reverse geocoding.
If effective types are multiple values, the limit/reverseGeocodingLimit option is ignored.
See also reverseGeocodingLimit option.
Default: Same as types.
OptionalselectFirst
Automatically selects the first feature in the result list.
Default: true.
OptionalshowPlaceType
Indicates when to show place/POI types in the dropdown:
"never": Hide the type."always": Always show the type."if-needed": Show the type only if it cannot be determined from the icon.
Default: "if-needed".
OptionalshowResultsWhileTyping
Displays results while typing:
false: Search occurs only on pressing the Enter key.true: Search begins when the input meets theminLengthrequirement.
Default: true.
Optionaltypes
Types to query, either as an array or [minZoom, maxZoom, type] format.
minZoom is inclusive, maxZoom is exclusive, and either can be null or undefined for unbounded values.
See reverseGeocodingTypes option for reverse geocoding types.
Default: undefined (uses server default feature types).
Optionalworldview
Some of the geographical boundaries and names are disputed. When worldview option is selected, the Geocoding API responses will be aligned with the borders and names recognized by the selected country. This affects filtering by country, the context returned with the given feature and also some of the labels (e.g., Gulf of Mexico vs. Gulf of America).
Available options:
"ch": Use the worldview of Switzerland"us": Use the worldview of US"auto": Automatically determine the worldview by the location of the clientundefined: Do not use any particular worldview (disputed areas are returned without country information, countries with disputed borders are returned without full geometry)
Default: undefined (no worldview).
Callback function to adjust the geocoding URL before fetching.