Workspace and locales
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.layersmaps layer keys to layers; see layer keys.locale.layeris the default for every layer of the locale: each layer is merged into a clone of it.[3]locale.queryparamsare merged into each layer'squeryparams.locale.dbsis the connection for layers without their owndbs.
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.layermay be a partial layer, and the layers of a locale with alocale.layer, its own or that ofworkspace.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.
{
"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"
}
}
}
}
}