Heron.widgets.search.NominatimSearchCombo¶
-
class
Heron.widgets.search.NominatimSearchCombo(config)¶
Create a ComboBox that provides a “search and zoom” function using OpenStreetMap Nominatim search. To use this class you need to include additional JS files in your page. See also the example HTML file under examples/namesearch.
- If your map is not in EPSG:4326 (WGS84) you need to import Proj4JS, e.g. http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js
- You need a proxy server that should proxy the domain open.mapquestapi.com.
Example Use¶
Sample code showing how to include Nominatim search in your MapPanel toolbar, not URL to restrict search in e.g. country.
Heron.layout = {
xtype: 'hr_mappanel',
hropts: {
layers: [
new OpenLayers.Layer.WMS( "World Map",
"http://tilecache.osgeo.org/wms-c/Basic.py?", {layers: 'basic', format: 'image/png' } )
],
toolbar : [
{type: "pan"},
{type: "zoomin"},
{type: "zoomout"},
{type: "-"},
{type: "search_nominatim",
options : {
url: 'http://open.mapquestapi.com/nominatim/v1/search?countrycodes=CO&format=json',
}}
]
}
};
Config Options¶
Configuration properties in addition to those listed for Ext.form.ComboBox.
-
charset String Defines the encoding used for the document returned by the web service, defaults to ‘UTF8’. See: http://www.geonames.org/export/geonames-search.html
-
displayTpl Ext.XTemplate or StringTemplate for presenting the result in the field (see http://www.dev.sencha.com/deploy/dev/docs/output/Ext.XTemplate.html), if not set this default value is provided. If null “displayField” is used.
-
emptyText See http://www.dev.sencha.com/deploy/dev/docs/source/TextField.html#cfg-Ext.form.TextField-emptyText, default value is “Search location in Nominatim”.
-
extent stringConfines the search to the given extent, defaults to false. See: http://www.geonames.org/export/geonames-search.html
-
lang StringPlace name and country name will be returned in the specified language. Default is English (en). See: http://www.geonames.org/export/geonames-search.html
-
listWidth See http://www.dev.sencha.com/deploy/dev/docs/source/Combo.html#cfg-Ext.form.ComboBox-listWidth, default value is 350.
-
loadingText See http://www.dev.sencha.com/deploy/dev/docs/source/Combo.html#cfg-Ext.form.ComboBox-loadingText, default value is “Search in Nominatim…”.
-
map OpenLayers.Map or ObjectA configured map or a configuration object for the map constructor, required only ifzoomis set to value greater than or equal to 0.
-
maxRows String The maximum number of rows in the responses, defaults to 20, maximum allowed value is 1000. See: http://www.geonames.org/export/geonames-search.html
-
minChars NumberMinimum number of characters to be typed before search occurs, defaults to 1.
-
queryDelay NumberDelay before the search occurs, defaults to 50 ms.
-
tpl Ext.XTemplate or StringTemplate for presenting the result in the list (see http://www.dev.sencha.com/deploy/dev/docs/output/Ext.XTemplate.html), if not set this default value is provided. If null “displayField” is used.
-
width See http://www.dev.sencha.com/deploy/dev/docs/source/BoxComponent.html#cfg-Ext.BoxComponent-width, default value is 350.
-
zoom NumberZoom level for recentering the map after search, if set to a negative number the map isn’t recentered, defaults to 8. OBSOLETE, as ‘boundingbox’ from result is used.