Geoportal Extension for OpenLayers API Reference

Class: SearchEngine

ol.control.SearchEngine

SearchEngine control

new SearchEngine(options)

OpenLayers/Controls/SearchEngine.js, line 60
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

ssl String true optional

use of ssl or not (default true, service requested using https protocol)

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

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

Extends

  • ol.control.Control

Members

collapsed

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

Methods

getCollapsed(){Boolean}

OpenLayers/Controls/SearchEngine.js, line 131

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

Returns:
- true if widget is collapsed

setCollapsed(collapsed)

OpenLayers/Controls/SearchEngine.js, line 140

Collapse or display widget main container

Name Type Description
collapsed Boolean

True to collapse widget, False to display it

setMap(map)

OpenLayers/Controls/SearchEngine.js, line 117

Overwrite OpenLayers setMap method

Name Type Description
map ol.Map

Map.