Skip to content

Workspace and locales ​

Workspace Key draft workspace locale xyz mapp

The workspace root keys, the default locale and named locales, nested locales and layer defaults; use as the frame of every workspace.

Resource and sources

A workspace is one JSON document. Its root keys are dbs, the default connection; locale, the default locale; locales, the named locales; and templates, see templates. The workspace source says where it is loaded from.

A locale configures one mapview: its layers, extent and tools. Without a locale the workspace cache uses { "layers": {} }; without locales a single locale entry is listed.[1]

Resolution ​

A locale request names a key of workspace.locales, or a template; locale is the default key. A clone of workspace.locale is the base: the locale's template, then its own keys, are merged over it before composition, and the locale's templates and roles merge on top. Nested locales and the locale key itself get no defaults. The locale is named after its key unless it has a name.[2]

Deep merging replaces strings and numbers and merges objects key by key. An array whose items are all in the existing array replaces it, eg. to reorder or shorten it; otherwise the whole array is appended to the existing one.

  • locale.layers maps layer keys to layers; see layer keys.
  • locale.layer is the default for every layer of the locale: each layer is merged into a clone of it.[3]
  • locale.queryparams are merged into each layer's queryparams.
  • locale.dbs is the connection for layers without their own dbs.

Nested locales ​

A request for several keys, eg. locale=europe,france, merges each following locale into the one before. locale.locales lists the template keys which can be nested into a locale. Roles of nested locales combine into a scope; see roles.

Constraints ​

  • Composition removes locales and layers the requesting user may not access. The presence of a key does not mean every user sees it.
  • Check nested composition against the getLocale tests before generating complex workspaces.
  • The strict schema checks layers before they are merged. locale.layer may be a partial layer, and the layers of a locale with a locale.layer, its own or that of workspace.locale, or with a template are exempt from the required layer keys. Validating the composed layer is not implemented.

Examples ​

A default locale with a shared layer, and two named locales.

json
{
  "dbs": "DEVDB",
  "locale": {
    "layer": { "attribution": { "Natural Earth": "https://www.naturalearthdata.com" } },
    "layers": {
      "countries": {
        "display": true,
        "format": "geojson",
        "table": "naturalearth.countries",
        "geom": "geom_4326",
        "srid": "4326",
        "qID": "id"
      }
    }
  },
  "locales": {
    "world": { "name": "World" },
    "retail": {
      "name": "UK retail",
      "layers": {
        "retail_points": {
          "display": true,
          "format": "wkt",
          "table": "geodata.uk_glx_open_retail_points",
          "geom": "geom_p_4326",
          "srid": "4326",
          "qID": "id"
        }
      }
    }
  }
}

  1. workspace/cache.js ↩︎

  2. workspace/getLocale.js ↩︎

  3. workspace/getLayer.js ↩︎

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