Layer display and view
A layer is a JSON object in locale.layers, keyed by its layer key. The XYZ API assigns the key as layer.key and, without a name, as the name. The MAPP library decorates the layer when it is added to a mapview.[1]
displayshows the layer when the mapview is created. In a mapview with URL hooks, alayersURL parameter decides instead.hiddencreates no layer view in the layers list. The layer is still inmapview.layersand can be shown programmatically.nameis the header of the layer view.metais HTML shown in the view.groupputs layer views with the same value into one group drawer;groupmetais HTML shown in the group.groupClassListadds CSS classes to the group drawer; the first layer of the group creates the drawer, so only its value applies.[2]attributionmaps source names to URLs, shown in the map attribution while the layer is displayed.zIndexorders the layer canvas. Without one, layers get increasing values in locale order, so later layers draw on top.promoteDisplaydraws the layer above all displayed layers whenever it is shown.
Layer view
viewConfig controls the layer view in the layers list:[3]
displayToggle,zoomToFilteredExtentBtnandpopoutBtnadd header buttons;headerOrderorders them.zoomBtnandhideDisabledonly apply to layers withtables, which have a zoom range: a zoom button, and hiding the view outside the range.panelOrdersorts the view drawers by their data-id, eg.filter-drawer.keyOrderorders the layer keys whose panel methods create the drawers.classListis added to the view drawer element.
panelOrder, zoomBtn, popout and drawer directly on the layer are legacy forms which the ui copies into viewConfig.
Any layer key which matches a mapp.layer method or a mapp.plugins method calls that method with the decorated layer, so a plugin is configured by adding its key to the layer.[1:1]
Pitfalls
- A layer whose
formatis not a registered format is skipped with a console warning; see layer formats. - A plugin key with a typo is ignored silently.
Examples
Two layers in one group; the second is not displayed when the map opens.
json
{
"dbs": "DEVDB",
"locale": {
"layers": {
"locations": {
"name": "Capitals",
"group": "Examples",
"display": true,
"format": "wkt",
"table": "example.locations",
"geom": "geom",
"srid": "4326",
"qID": "id"
},
"features": {
"name": "Features",
"group": "Examples",
"meta": "Polygons and lines in EPSG:3857.",
"display": false,
"format": "wkt",
"table": "example.features",
"geom": "geom",
"srid": "3857",
"qID": "id"
}
}
}
}