Geoportal Extension for OpenLayers 3 API Reference

Class: SearchEngine


SearchEngine control

new SearchEngine(options)

Ol3/Controls/SearchEngine.js, line 73
Name Type Description
options Object

control options

Name Type Default Description
apiKey String optional

API key, mandatory if autoconf service has not been charged in advance

collapsed Boolean true optional

collapse mode, true by default

resources Object optional

resources to be used by geocode and autocompletion services :

Name Type Description
geocode Array optional

resources geocoding, by default : ["PositionOfInterest", "StreetAddress"]

autocomplete Array optional

resources autocompletion, by default : ["PositionOfInterest", "StreetAddress"]

displayAdvancedSearch Boolean true optional

False to disable advanced search tools (it will not be displayed). Default is true (displayed)

advancedSearch Object optional

advanced search options for geocoding (filters). Properties can be found among geocode options.filterOptions (see Gp.Services.geocode)

geocodeOptions Object {} optional

options of geocode service (see Gp.Services.geocode)

autocompleteOptions Object {} optional

options of autocomplete service (see Gp.Services.autoComplete

Name Type Default Description
serviceOptions Object optional

options of autocomplete service

triggerGeocode Boolean false optional

trigger a geocoding request if the autocompletion does not return any suggestions, false by default

triggerDelay Number 1000 optional

waiting time before sending the geocoding request, 1000ms by default

zoomTo Sting | Numeric | function optional

zoom to results, by default, current zoom.
Value possible : auto or zoom level.
Possible to overload it with a function :
zoomTo : function (info) {
// do some stuff...
return zoom;

placeholder String optional

Placeholder in search bar. Default is "Rechercher un lieu, une adresse".

displayMarker Boolean true optional

set a marker on search result, defaults to true.

markerStyle String "lightOrange" optional

Marker style. Currently possible values are "lightOrange" (default value), "darkOrange", "red" and "turquoiseBlue".

var SearchEngine = ol.control.SearchEngine({
     apiKey : "CLEAPI",
     collapsed : true,
     resources : {
         geocode : ["StreetAddress", "PositionOfInterest"],
         autocomplete : ["StreetAddress"]
     advancedSearch : {
         PositionOfInterest : [{name : "municipality", title : "Ville"}],
         StreetAddress : [{...}]
     geocodeOptions : {},
     autocompleteOptions : {}


  • ol.control.Control



{Boolean} specify if searchEngine control is collapsed (true) or not (false)



Ol3/Controls/SearchEngine.js, line 150

Returns true if widget is collapsed (minimized), false otherwise

- true if widget is collapsed


Ol3/Controls/SearchEngine.js, line 159

Collapse or display widget main container

Name Type Description
collapsed Boolean

True to collapse widget, False to display it


Ol3/Controls/SearchEngine.js, line 134

Overwrite OpenLayers setMap method

Name Type Description
map ol.Map