new SearchEngine(options)
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object |
control options
|
- TODO
-
- option : direction (start|end) de la position du picto (loupe)
- option : choix du target pour les fenetres geocodage ou recherche par coordonnées
Fires:
- searchengine:autocomplete:click
- searchengine:geocode:click
- searchengine:search:click
- searchengine:geolocation:click
- searchengine:coordinates:click
Example
var SearchEngine = ol.control.SearchEngine({
apiKey : "CLEAPI",
collapsed : true,
collapsible : true,
displayButtonAdvancedSearch : true,
displayButtonGeolocate : true,
displayButtonCoordinateSearch : true,
markerStyle : "lightOrange" // "http://..." or "data/base64..."
resources : {
geocode : ["StreetAddress", "PositionOfInterest"],
autocomplete : ["StreetAddress"],
search : false
},
advancedSearch : {
target : document.getElementById("dialog"),
PositionOfInterest : [{name : "municipality", title : "Ville"}],
StreetAddress : [{...}]
},
coordinateSearch : {
target : null
systems : [
{
"crs" : "EPSG:3857",
"label" : "Web Mercator",
"type" : "Metric"
},
{
"crs" : "EPSG:4326",
"label" : "Géographiques",
"type" : "Geographical"
}
],
units : ["DEC", "DMS"]
},
geocodeOptions : {},
autocompleteOptions : {},
searchOptions : {}
});
SearchEngine.on("searchengine:autocomplete:click", function (e) {
console.warn("autocomplete", e.location);
});
SearchEngine.on("searchengine:search:click", function (e) {
console.warn("search", e.suggest);
});
SearchEngine.on("searchengine:geocode:click", function (e) {
console.warn("geocode", e.location);
});
SearchEngine.on("searchengine:geolocation:click", function (e) {
console.warn("geolocation", e.);
});
SearchEngine.on("searchengine:coordinate:click", function (e) {
console.warn("coordinate", e.);
});
Extends
- ol.control.Control
Members
-
collapsed
-
{Boolean} specify if searchEngine control is collapsed (true) or not (false)
Methods
-
_setSystem(system)
Controls/SearchEngine/SearchEngine.js, line 1441 -
Set additional projection system
Name Type Description system Object projection system
Name Type Description crs String Proj4 crs alias (from proj4 defs) e.g. "EPSG:4326"
label String optional CRS label to be displayed in control. Default is system.crs alias
type String optional CRS units type for coordinates conversion (one of control options.units). Default is "Metric"
-
getCollapsed(){Boolean}
Controls/SearchEngine/SearchEngine.js, line 242 -
Returns true if widget is collapsed (minimized), false otherwise
Returns:
- true if widget is collapsed
-
getContainer(){DOMElement}
Controls/SearchEngine/SearchEngine.js, line 283 -
Get container
-
getData(){Object}
Controls/SearchEngine/SearchEngine.js, line 274 -
Get locations data from geocode service
Returns:
- locations
-
setCollapsed(collapsed)
Controls/SearchEngine/SearchEngine.js, line 251 -
Collapse or display widget main container
Name Type Description collapsed Boolean True to collapse widget, False to display it
-
setMap(map)
Controls/SearchEngine/SearchEngine.js, line 213 -
Overwrite OpenLayers setMap method
Name Type Description map ol.Map Map.