new SearchEngine(options)
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object |
control options
|
Fires:
- searchengine:autocomplete:click
- searchengine:geocode:click
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 : {}
});
SearchEngine.on("searchengine:autocomplete:click", function (e) {
console.warn("autocomplete", e.location);
});
SearchEngine.on("searchengine:geocode:click", function (e) {
console.warn("geocode", e.location);
});
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 161 -
Returns true if widget is collapsed (minimized), false otherwise
Returns:
- true if widget is collapsed
-
getData(){Object}
OpenLayers/Controls/SearchEngine.js, line 188 -
Get locations data from geocode service
Returns:
- locations
-
setCollapsed(collapsed)
OpenLayers/Controls/SearchEngine.js, line 170 -
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 147 -
Overwrite OpenLayers setMap method
Name Type Description map ol.Map Map.