Gazetteer
locale.gazetteer shows a search box in the default view. A search queries the qterm column of the layer's table for values starting with the term and lists up to limit results; selecting one opens the location.[1]
layeris a key oflocale.layers; its current filter applies.tablesearches another table.labelis the column shown in the results,qtermby default.titlelabels the results, defaulting to the layer name.leading_wildcardalso matches the term inside values.no_resultreplaces the "no results" text;nullhides it.maxZoomlimits the zoom when the map moves to a result.queryreplaces thegaz_querytemplate, which matchesqterm::text ILIKEthe term.[2]datasetsadds searches. Each inherits the gazetteer keys and overrides some, eg. anotherqtermandtitle.providersearches an external service through a plugin, eg. Google Places; such plugins have their own keys and API keys.
Pitfalls
- A gazetteer
layerwhich is not in the mapview logs a warning and finds nothing. - Without
qtermthe gazetteer only searches itsdatasetsand provider. limitis the SQLLIMIT;0falls back to 10 and a negative limit fails the query.
Examples
Search retail points by store name and by postcode.
json
{
"dbs": "DEVDB",
"locale": {
"gazetteer": {
"layer": "retail_points",
"qterm": "store_name",
"placeholder": "Search stores or postcodes",
"limit": 5,
"datasets": [{ "title": "Postcode", "qterm": "postcode" }]
},
"layers": {
"retail_points": {
"display": true,
"format": "wkt",
"table": "geodata.uk_glx_open_retail_points",
"geom": "geom_p_4326",
"srid": "4326",
"qID": "id"
}
}
}
}