Layer filter
layer.filter combines two things: a fixed server-side filter, and the filter panel through which users narrow a layer in the layer view. Both use filter expressions.
Server side
defaultis read by the XYZ API from the workspace layer, not from the request, and is applied to every layer query with${filter}. A client cannot change or remove it.[1] It may be an expression object, an array (OR), or a SQL string. A string is inserted as SQL unchanged, so it must only come from the workspace.currentis the filter the user applied. The MAPP library sends it with layer queries and the API adds it todefaultwithAND.
Client side
The MAPP library decorates every layer with filter: { current: {} } merged with the configured object. viewport is set to true when layer.params or layer.queryparams restrict queries to the viewport.[2]
The panel lists a filter for each layer.infoj entry which has a filter (true, a type string, or an object with type). Without one, an entry is listed when includeAll is set or its field is in include. Entries with skipEntry, without field, with filter: false, or whose field is in exclude are never listed.[3] The filter types and the keys inside entry.filter are described in entry filters.
hiddensuppresses the panel;drawerdefaults todisableOnHide, which disables the drawer while the layer is hidden.popout: trueadds a button which opens the drawer in a dialog;dialog(true or dialog options) shows the panel in a dialog;classListis added to the drawer.count_metaandviewport_descriptionoverride the dictionary texts next to the location count.
Pitfalls
includeandexcludelist entry fields, not entry keys.popoutis a flag; an object is replaced by the drawer.- The legacy
layer.multi_filterplugin key rewrites the filter configuration before the panel is built. Its other keys, such astarget, are read by the plugin, not by the filter panel.[3:1]
Examples
The devdb retail points with a fixed default filter and a panel offering retailer, fascia and missing open date filters. Address fields are excluded.
{
"dbs": "DEVDB",
"locale": {
"layers": {
"retail_points": {
"display": true,
"format": "wkt",
"table": "geodata.uk_glx_open_retail_points",
"geom": "geom_p_4326",
"srid": "4326",
"qID": "id",
"filter": {
"default": { "size_band": { "ni": ["< 3,013 ft2 (280m2)"] } },
"exclude": ["add_one", "add_two"]
},
"infoj": [
{ "type": "key" },
{ "title": "Retailer", "field": "retailer", "filter": "in" },
{ "title": "Fascia", "field": "fascia", "filter": { "type": "in", "dropdown": true } },
{ "title": "Open Date", "field": "open_date", "type": "date", "filter": { "type": "null", "label": "No open date" } },
{ "field": "add_one" },
{ "field": "add_two" }
]
}
}
}
}