Class: GeocoderComboBox

GeocoderComboBox()

new GeocoderComboBox()

Creates a combo box that handles results from a geocoding service. By default it uses OSM Nominatim, but the component offers all config options to overwrite in order to other custom services. If the user enters a valid address in the search box, the combo's store will be populated with records that match the address. By default, records have the following fields: * name - `String` The formatted address. * extent - `ol.Extent` The extent of the matching address * bounds - `ol.Coordinate` The point coordinate of the matching address **CAUTION: This class is only usable in applications using the classic toolkit of ExtJS 6.**
Source:

Members

(static) displayField

The field to display in the combobox result. Default is "name" for instant use with the default store for this component.
Source:

(static) displayValueMapping

The field in the GeoCoder service repsonse to be used as mapping for the 'name' field in the #store. Ignored when a store is passed in.
Source:

(static) emptyText

'Search' Text to display for an empty field.
Source:

(static) locationLayer

Vector layer to visualize the selected address. Will be created if not provided.
Properties:
Name Type Description
locationLayer ol.layer.Vector The layer used for displaying the selected address.
Source:

(static) locationLayerStyle

The style of the #locationLayer. Only has an effect if the layer is not passed in while creation.
Source:

(static) map

The OpenLayers map to work on. If not provided the selection of an address would have no effect.
Source:

(static) minChars

Minimum number of entered characters to trigger a search.
Source:

(static) proxyRootProperty

The property in the JSON response of the geocoding service used in the store's proxy as root object.
Source:

(static) queryDelay

Delay before the search occurs in ms.
Source:

(static) queryParam

The query parameter for the user entered search text. Default is 'q' for instant use with OSM Nominatim.
Source:

(static) restrictToMapExtent

Flag to restrict nomination query to current map extent
Source:

(static) showLocationOnMap

Flag to steer if selected address feature is drawn on #map (by #locationLayer).
Source:

(static) srs

The SRS used by the geocoder service.
Source:

(static) store

The store used for this combo box. Default is a store with the url configured as #url config.
Properties:
Name Type Description
store Ext.data.JsonStore The store used for this combo box.
Source:

(static) url

URL template for querying the geocoding service. If a store is configured, this will be ignored. Note that the #queryParam will be used to append the user's combo box input to the url.
Source:

(static) valueField

Field from selected record to use when the combo's #getValue method is called. Default is "extent". This field is supposed to contain an ol.Extent. By setting this to 'coordinate' a field holding an ol.Coordinate is used.
Source:

(static) zoom

Zoom level when zooming to a location (#valueField='coordinate') Not used when zooming to extent.
Source:

Methods

(static) addMapExtentParams(extent, projection)

Update map extent params of AJAX proxy. By default, 'viewbox' and 'bounded' are updated since Nominatim is the default geocoder in this class. If no projection is passed the one of the map view is used.
Parameters:
Name Type Description
extent ol.Extent The extend to restrict the geocoder to
projection ol.proj.Projection The projection of given extent
Source:

(static) convertToCoordinate(v, rec) → {ol.Coordinate}

Function to convert the data delivered by the geocoder service to an ol.Coordinate ([x, y]). Default implementation converts the Nominatim response. Can be overwritten to work with other services.
Parameters:
Name Type Description
v Mixed The data value as read by the Reader
rec Ext.data.Model The data record containing raw data
Source:
Returns:
The created ol.Coordinate
Type
ol.Coordinate

(static) convertToExtent(v, rec) → {ol.Extent}

Function to convert the data delivered by the geocoder service to an ol.Extent ([minx, miny, maxx, maxy]). Default implementation converts the Nominatim response. Can be overwritten to work with other services.
Parameters:
Name Type Description
v Mixed The data value as read by the Reader
rec Ext.data.Model The data record containing raw data
Source:
Returns:
The created ol.Extent
Type
ol.Extent

(static) drawLocationFeatureOnMap(coordOrExtent)

Draws the selected address feature on the map.
Parameters:
Name Type Description
coordOrExtent ol.Coordinate | ol.Extent Location feature to be drawn on the map
Source:

(static) onFocus()

Handles the 'focus' event of this ComboBox.
Source:

(static) removeLocationFeature()

Removes the drawn address feature from the map.
Source:

(static) removeMapExtentParams()

Remove restriction to viewbox, in particular remove viewbox and bounded parameters from AJAX proxy for nominatim queries
Source:

(static) restrictExtent()

Handle restriction to viewbox: register moveend event and update params of AJAX proxy
Source:

(static) unRestrictExtent()

Cleanup if extent restriction is omitted. -> moveend event from map -> call removeMapExtentParams to reset params set in store
Source:

(static) updateExtraParams()

Update viewbox parameter based on the current map extent
Source: