Single Search Add-on

Single Search addon control provides a single box for all search types.

SingleSearch

Single Search Addon

new SingleSearch(options: Object)

Extends TrimbleMaps.Evented

Parameters
options (Object)
Name Type Description
options.placeholderText string (default: 'Address...') Placeholder text for the search box.
options.doneTypingInterval number (default: 700) The debounce value in milliseconds. The search web service request fire rate limit to this value.
options.minSearchTextLength number (default: 3) If search text is longer than this value, then search can be started.
options.locationRelevance string (default: null) Available values are “mapCenter”, “device”, or null. If it is set, map view center or device location will be used to assist search.
options.hideResults boolean (default: false) Hide results list or not when a result item is clicked on or enter key is pressed on a focused item.
options.searchOption SearchOption Optional. See the section below.
options.markerStyle MarkerStyle Optional. See the section below.
options.markerConfig MarkerConfig Optional. See the section below.
options.popupConfig PopupConfig Optional. See the section below.
Instance Members
setSearchOption(key, value)
setMarkerStyle(key, value)
setMarkerConfig(key, value)
setPopupConfig(key, value)
removeMarker()
Events
inputfocus
inputblur
locationselected
searchcomplete
geolocationfailed
popupClosed

Option Types

Types used in the options property of the add-on

SearchOption

SearchOption

Type: Object

Properties
query (string?) : If it is not null, the search input box value will be ignored by the control. It is optional.
maxResults (number?) : Maximum returned results.
currentLonLat (LngLat?) : Search near the location provided. Latitude and longitude values are in degrees. It is optional. The control can set current location based on navigator.geolocation location or map view center. They are optional too.
excludedSearchTypes (string?) : Comma-separated list of types to exclude from the search.
poiCategories (string?) : Comma-separated list of POI category names by which you want to filter all POI results.
countries (string?) : Comma-separated list of country abbreviations by which you want to filter all results.
countryType (("ISO" | "FIPS" | "GENC2" | "GENC3")?)
states (string?) : Comma-separated list of state abbreviations by which you want to filter all results.
region ((Common.Region.NA | Common.Region.EU | Common.Region.WW)) : Required.
success (Function) : If it is provided, it will replace the control built-in handler method.
failure (Function) : If it is provided, it will replace the control built-in handler method.

MarkerConfig

MarkerConfig

Type: Object

Properties
exclusive (boolean?) : If true, erases all other makers first.
centerOnMap (boolean?) : Center the marker on the map.
zoomLevel (number?) : Centers the marker at the zoom level.

MarkerStyle

MarkerStyle

Type: Object

Properties
externalGraphic (string?) : If the URL is supplied, it will replace the default icon. If null, the control will choose icon for the marker based on result type.
graphicHeight (number?) : Marker height in pixels.
graphicWidth (number?) : Marker width in pixels.
graphicXOffset (number?) : Marker x-direction offset.
graphicYOffset (number?) : Marker y-direction offset.

PopupConfig

PopupConfig

Type: Object

Properties
show (boolean?) : If true, shows popup with the marker.
className (string?) : CSS class name. If you change this value, you need to add your CSS class to your style file.
offset (number?) : Popup location offset.
closeBox (boolean?) : If true, shows the close button on the popup.