Type Alias MaptilerGeocoderOptions

type 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

adjustUrl?: (url: URL) => void

Callback function to adjust the geocoding URL before fetching.

Type Declaration

    • (url: URL): void
    • Parameters

      • url: URL

        URL parameter that can be modified.

        Default: Empty function.

      Returns void

apiKey?: string

MapTiler API key.

apiUrl?: string

Geocoding API URL.

Default: MapTiler Geocoding API URL.

bbox?: BBox

Bounding box in the format [minX, minY, maxX, maxY] to limit search results.

Default: undefined.

clearButtonTitle?: string

Title of the clear button.

Default: "clear".

clearListOnPick?: boolean

Clears the result list after picking an item. Prevents redisplaying the list when the input box is focused.

Default: false.

clearOnBlur?: boolean

Clears the input value when it loses focus.

Default: false.

collapsed?: boolean

Collapses the geocoder control until hovered or focused.

Default: false.

country?: string | string[]

Limits search to the specified country or countries.

Default: undefined (all countries).

debounceSearch?: number

Time delay (in milliseconds) before querying the server after typing in the input box. Useful for reducing the number of API calls.

Default: 200.

enableReverse?: EnableReverse

Enables reverse geocoding:

  • "button": Enables reverse geocoding button.
  • "always": Reverse geocoding is always active.

Default: "never".

errorMessage?: string

Custom error message.

Default: "Something went wrong…".

excludeTypes?: boolean

Includes all available types except those listed in the types option.

See reverseGeocodingExcludeTypes for reverse geocoding exclusion.

Default: false.

exhaustiveReverseGeocoding?: boolean

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.

fetchFullGeometryOnPick?: boolean

Enables fetching the full geometry (polygon etc.) instead of just a point on a picked feature.

Default: false.

fetchParameters?: RequestInit

Additional parameters for fetch requests.

Default: undefined.

filter?: (feature: Feature) => boolean

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.

fuzzyMatch?: boolean

Enables fuzzy search.

Default: true.

iconsBaseUrl?: string

Base URL for POI icons.

Default: "https://cdn.maptiler.com/maptiler-geocoding-control/v${version}/icons/"

keepListOpen?: boolean

Keeps the result list open even if the control is unfocused.

Default: false.

language?: string | string[] | null

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).

limit?: number

Maximum number of results to display.

See reverseGeocodingLimit for reverse geocoding limits.

Default: 5.

minLength?: number

Minimum number of characters required to start a search.

Default: 2.

noResultsMessage?: string

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!"
openListOnTop?: boolean

Opens the result list above the query input instead of below. Used when mounted at the bottom of a map.

Default: false.

placeholder?: string

Custom placeholder for the input box.

Default: "Search".

proximity?: ProximityRule[] | null

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" } ].

reverseActive?: boolean

Activates reverse geocoding.

Default: false.

reverseButtonTitle?: string

Title of the reverse geocoding toggle button.

Default: "toggle reverse geocoding".

reverseGeocodingExcludeTypes?: boolean

Excludes types for reverse geocoding.

Default: Same as excludeTypes.

reverseGeocodingLimit?: number

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.

reverseGeocodingTypes?: TypeRule[]

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.

selectFirst?: boolean

Automatically selects the first feature in the result list.

Default: true.

showPlaceType?: ShowPlaceType

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".

showResultsWhileTyping?: boolean

Displays results while typing:

  • false: Search occurs only on pressing the Enter key.
  • true: Search begins when the input meets the minLength requirement.

Default: true.

types?: TypeRule[]

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).

worldview?: Worldview

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 client
  • undefined: 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).

Was this helpful?

SDK JS
Modules
Reference
types
MaptilerGeocoderOptions