Class: SearchGeoportail

ol.control. SearchGeoportail


new SearchGeoportail(options)

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

Parameters:
Name Type Description
options any

extend ol.control.SearchJSON options

Properties
Name Type Description
className string

control class name

apiKey boolean | undefined

the service api key.

authentication: string | undefined

basic authentication for the service API as btoa("login:pwd")

target Element | string | undefined

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

label string | undefined

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

placeholder string | undefined

placeholder, default "Search..."

typing number | undefined

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

minLength integer | undefined

minimum length to start searching, default 3

maxItems integer | undefined

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

type StreetAddress | PositionOfInterest | CadastralParcel | Commune

type of search. Using Commune will return the INSEE code, default StreetAddress,PositionOfInterest

See:
Fires:
  • event:select

Extends

Methods


ajax(url, onsuccess, onerror)

Send an ajax request (GET)

Parameters:
Name Type Description
url string
onsuccess function

callback

onerror function

callback

Inherited From:

autocomplete(s, cback)

Autocomplete function (ajax request to the server)

Parameters:
Name Type Description
s string

search string

cback function

a callback function that takes an array of {name, feature} to display in the autocomplete field

Inherited From:

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

handleResponse(response)

Handle server response to pass the features array to the display list

Parameters:
Name Type Description
response any

server response

Overrides:
Returns:

an array of feature

Type
Array.<any>

requestData(s)

Parameters:
Name Type Description
s string

the search string

Overrides:
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:

searchCommune(s)

Search if no position and get the INSEE code

Parameters:
Name Type Description
s string

le nom de la commune


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: