Skip to content

Gazetteer ​

Workspace Key draft workspace locale gazetteer search mapp ui

locale.gazetteer adds a search box which finds locations by a column of a layer table, or through a provider plugin; use to let users search places or records.

Resource and sources

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]

  • layer is a key of locale.layers; its current filter applies. table searches another table.
  • label is the column shown in the results, qterm by default. title labels the results, defaulting to the layer name.
  • leading_wildcard also matches the term inside values.
  • no_result replaces the "no results" text; null hides it.
  • maxZoom limits the zoom when the map moves to a result.
  • query replaces the gaz_query template, which matches qterm::text ILIKE the term.[2]
  • datasets adds searches. Each inherits the gazetteer keys and overrides some, eg. another qterm and title.
  • provider searches an external service through a plugin, eg. Google Places; such plugins have their own keys and API keys.

Pitfalls ​

  • A gazetteer layer which is not in the mapview logs a warning and finds nothing.
  • Without qterm the gazetteer only searches its datasets and provider.
  • limit is the SQL LIMIT; 0 falls 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"
      }
    }
  }
}

  1. mapp utils/gazetteer.mjs datasets and search ↩︎

  2. templates/gaz_query.js ↩︎

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.