Geoportal Extension for OpenLayers API Reference

Class: SearchEngine

ol.control.SearchEngine

SearchEngine control

new SearchEngine(options)

OpenLayers/Controls/SearchEngine.js, line 75
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 Boolean true optional

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

collapsed Boolean true optional

collapse mode, true by default

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

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)

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

geocodeOptions Object {} optional

options of geocode service

Name Type Default Description
apiKey Object optional

to overload the check of rights (only) on the given apiKey for the geocode service

filterOptions Object {} optional

filteroptions of the geocode service

Name Type Default Description
type Array [] optional

to overload the check of rights (only) on the given type of resources used by the geocode service.

serviceOptions Object optional

overload other options : options of geocode service from the access-lib API (see Gp.Services.geocode)

autocompleteOptions Object {} optional

options of autocomplete service

Name Type Default Description
apiKey Object optional

to overload the check of rights (only) on the given apiKey for the the autocomplete service

filterOptions Object {} optional

filteroptions of the autocomplete service

Name Type Default Description
type Array [] optional

to overload the check of rights (only) on the given type of resources used by the autocomplete service

serviceOptions Object optional

overload other options : options of autocomplete service from the access-lib API (see Gp.Services.autoComplete)

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

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 147

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

Returns:
- true if widget is collapsed

setCollapsed(collapsed)

OpenLayers/Controls/SearchEngine.js, line 156

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 133

Overwrite OpenLayers setMap method

Name Type Description
map ol.Map

Map.