Class: SearchNominatim

ol.control. SearchNominatim


new SearchNominatim( [Control])

Search places using the French National Base Address (BAN) API.

Parameters:
Name Type Argument Description
Control Object <optional>

options.

options.className string

control class name

options.polygon boolean | undefined

To get output geometry of results (in geojson format), default false.

options.target Element | string | undefined

Specify a target if you want the control to be rendered outside of the map's viewport.

options.label string | undefined

Text label to use for the search button, default "search"

options.placeholder string | undefined

placeholder, default "Search..."

options.typing number | undefined

a delay on each typing to start searching (ms), default 500.

options.minLength integer | undefined

minimum length to start searching, default 3

options.maxItems integer | undefined

maximum number of items to display in the autocomplete list, default 10

options.url string | undefined

Url to BAN api, default "https://api-adresse.data.gouv.fr/search/"

See:
Fires:
  • event:select

Extends

Methods


autocomplete(s, cback)

Autocomplete function

Parameters:
Name Type Description
s string

search string

cback function

a callback function that takes an array to display in the autocomplete field (for asynchronous search)

Inherited From:
Returns:

an array of search solutions or false if the array is send with the cback argument (asnchronous)

Type
Array | false

clearHistory()

Remove previous history

Inherited From:

equalFeatures(f1, f2)

Test if 2 features are equal

Parameters:
Name Type Description
f1 any
f2 any
Inherited From:
Returns:
Type
boolean

getHistory()

Get history table

Inherited From:

getTitle(f)

Returns the text to be displayed in the menu

Parameters:
Name Type Description
f ol.Feature

the feature

Overrides:
Returns:

the text to be displayed in the index

Type
string

requestData(s)

Parameters:
Name Type Description
s string

the search string

Returns:

request data (as key:value)

Type
Object

restoreHistory()

Restore history (from the localstorage)

Inherited From:

saveHistory()

Save history (in the localstorage)

Inherited From:

Force search to refresh

Inherited From:

select(f)

A ligne has been clicked in the menu > dispatch event

Parameters:
Name Type Description
f any

the feature, as passed in the autocomplete

Overrides:

setInput(value, search)

Set the input value in the form (for initialisation purpose)

Parameters:
Name Type Description
value string
search boolean

to start a search

Inherited From: