Configuration
Configuration is defined in localConfig.json under the panel_editor plugin.
1) Global plugin configuration (cfg)
| Key | Type | Required | Description |
|---|---|---|---|
title |
string |
no | Panel title. |
tooltip |
string |
no | Plugin button tooltip. |
icon |
string |
no | Default MapStore icon (Glyphicon). |
iconByContext |
object |
no | Icon override based on the current context. Keys can be the context id or context name, with an optional default key. |
size |
number |
no | Base panel width (plugin adds +100 px). |
serverUrl |
string |
no | Base GeoServer URL used to build the WFS endpoint when wfsUrl is not set. |
wfsUrl |
string |
no | Explicit global WFS URL, higher priority than serverUrl. |
layers |
object |
yes | Per-layer rules (workspace:layer). |
Sidebar button icon by context
The SidebarMenu button can use a different icon depending on the current context.
Resolution order:
cfg.iconByContext[context.resource.id]cfg.iconByContext[context.resource.name]cfg.iconByContext.defaultcfg.icon- internal fallback:
list-alt
Example:
"cfg": {
"icon": "list-alt",
"iconByContext": {
"12": "pencil",
"Urban planning context": "folder-open",
"default": "map"
}
}
2) Layer configuration (cfg.layers["workspace:layer"])
| Key | Type | Required | Description |
|---|---|---|---|
featureFieldLabel |
string |
no | Field used in feature selector labels. |
featureFielLabel |
string |
no | Tolerated alias (compatibility). |
hidden |
string[] |
no | Fields hidden in read mode. In edit mode, a hidden field stays hidden unless it is also declared in fields. |
fields |
array |
no | Detailed field definition (see next table). |
auto |
array |
no | Fields filled automatically on save. |
allowEdit |
boolean |
no | If false, completely disables layer editing regardless of roles. |
allowEditRoles |
string[] |
no | If provided, priority list of roles allowed to edit the layer. |
edit / editingRoles |
string[] |
no | Roles allowed to edit the layer. |
allowDelete |
boolean |
no | Shows the delete button only when set to true. |
delete / deletionRoles |
string[] |
no | Roles allowed to delete. |
serverUrl |
string |
no | Layer-specific base GeoServer URL, used only if no layer or global wfsUrl is defined. |
wfsUrl |
string |
no | Layer-specific WFS URL, higher priority than layer serverUrl and global settings. |
idField |
string |
no | Identifier field name (default: id). |
restrictedArea |
object |
no | Spatial edit restriction (area of competence) based on either a wkt or the JSON returned by a url. |
WFS URL resolution order:
cfg.layers["workspace:layer"].wfsUrlcfg.wfsUrlcfg.layers["workspace:layer"].serverUrlcfg.serverUrl
Implication:
wfsUrlandserverUrlare not complementary at the same configuration scope;wfsUrloverridesserverUrl.- If
wfsUrlis set,serverUrlis ignored for that scope. serverUrlis only a fallback used to derive a WFS URL from a base GeoServer URL.
3) Field configuration (fields)
Each fields entry accepts compact format:
[name, label, type, editable, required, roles, options]
| Position | Name | Type | Description |
|---|---|---|---|
0 |
name |
string |
Attribute key. |
1 |
label |
string |
Display label. |
2 |
type |
string |
UI type (string, number, date, list, etc.). |
3 |
editable |
boolean |
Editable or read-only. |
4 |
required |
boolean |
Required field. |
5 |
roles |
string[] |
Roles allowed to edit this field. In edit mode, if the user does not have one of these roles, the field stays visible but read-only. |
6 |
options |
array \| object |
Values for list inputs from a static array, a remote JSON URL, or an empty array for automatic layer-based values. |
Supported cases for type: "list"
- Static list
["dpt", "Department", "list", true, false, [], [75, 77, 78, 91, 92, 93, 94, 95]]
- Automatic values from existing field values in the current layer
["dpt", "Department", "list", true, false, [], []]
- Remote values from a WFS or OGC API Features JSON URL
[
"dpt",
"Department",
"list",
true,
false,
[],
{
"url": "https://example.org/collections/idf:admin_dpt_idf/items?f=application/json&properties=DPT",
"field": "DPT"
}
]
Rules:
- If
optionsis a non-empty array, that array is used as-is. - If
optionsis an object{ "url": "...", "field": "..." }, the plugin reads the JSON response and extracts unique values from the configured field. - If
optionsis empty or missing for alistfield, the plugin proposes unique values already present for that field in the loaded layer features. - Duplicate and empty values are filtered out.
- A field listed in
hiddencan be shown again in edit mode when it is explicitly declared infields.
4) Automatic field configuration (auto)
Each auto entry accepts compact format:
[name, type, source]
| Position | Name | Type | Description |
|---|---|---|---|
0 |
name |
string |
Field name to populate. |
1 |
type |
string |
Automatic type. Supported values: header, date, area, length, value. |
2 |
source |
string |
Source to use. For header, only name and role are documented, read from currentUser. For date, desired display format. For value, fixed value to inject. Not used for area and length. |
Rules:
- A field declared in
autois never editable in the form. - The panel always displays the last known value.
- If
typeisheader, the value is read fromcurrentUser. - Documented values for
header:name,role. - If
typeisdate, the value is replaced with the current date on save. - If
typeisvalue, the configured value is injected as-is on save. - If
typeisarea, the value is computed from the feature geometry. Default unit is square meters (m²). - If
typeislength, the value is computed from the feature geometry. For a line, this is the length. For a polygon, this is the perimeter. Default unit is meters (m). autofields are injected into the WFS-T transaction even if they are also listed inhidden.
5) Spatial restriction (restrictedArea)
The restrictedArea key limits access to edit mode using a spatial comparison between the selected feature geometry and an area of competence.
Example with a JSON URL:
"restrictedArea": {
"url": "/my/custom/area",
"operation": "INTERSECTS"
}
Example with a WKT provided in configuration:
"restrictedArea": {
"wkt": "POLYGON((...))",
"operation": "WITHIN"
}
Supported keys:
url: any URL returning JSON that the plugin can parsewkt: geometry provided directly in configurationoperation:WITHIN,INTERSECTS, orCONTAINSallowedRoles: roles that bypass this spatial restriction
Rules:
- The control geometry comes either from
wktor from the JSON returned byurl. - No HTTP call is made if a
wktis provided. - If no
urlorwktis provided, no control geometry is loaded. wktis interpreted asEPSG:4326.- When needed, that geometry is reprojected to the Identify features CRS before spatial comparison.
- If the spatial check fails for the configured operation, the UI shows a
recordstatus button with a dedicated tooltip. - If the user has a role listed in
allowedRoles, the spatial restriction is bypassed.
Complete example (global + layer + fields)
{
"name": "panel_editor",
"cfg": {
"title": "Reviewed projects",
"tooltip": "Reviewed projects",
"icon": "map",
"iconByContext": {
"12": "pencil",
"Urban planning context": "folder-open",
"default": "map"
},
"size": 420,
"serverUrl": "http://localhost/geoserver",
"layers": {
"test:reviewed_projects": {
"featureFieldLabel": "name",
"idField": "id",
"hidden": [
"geom",
"log_date_crea",
"log_date_modi",
"log_user_crea",
"log_user_modi"
],
"auto": [
["type_saisie", "value", "manual"],
["log_user_modi", "header", "name"],
["log_date_modi", "date", "DD/MM/YYYY"],
["surface_carto", "area"],
["longueur_carto", "length"]
],
"allowEdit": true,
"allowEditRoles": ["EDITOR", "ADMIN"],
"allowDelete": true,
"delete": ["ADMIN"],
"restrictedArea": {
"url": "/console/account/areaofcompetence",
"operation": "INTERSECTS"
},
"fields": [
["identifier", "Identifier", "string", true, true],
["name", "Name", "string", false, true],
["status", "Status", "list", true, false, ["EDITOR", "ADMIN"], ["New", "Validated", "Rejected"]],
["dpt", "Department", "list", true, false, [], []],
["comment", "Comment", "string", true, false]
]
}
}
}
}
Important notes
- Feature selector labels follow:
[number] - (field_name) field_value. ADMIN/ROLE_ADMINhas full permissions.- If a field is
requiredand empty, it stays editable even ifeditableisfalseor editing is restricted to specific roles. autofields stay read-only and are populated at save time.hiddenfields are always hidden in read mode.- In edit mode, a
hiddenfield is shown only if it is declared infields. - In read mode, the UI shows either the pencil button or status buttons:
lockfor role denial,recordfor spatial denial, or both when needed. - If
allowEditisfalse, no role, includingADMIN, can enter edit mode. - If
allowEditRolesis defined, it takes precedence overedit/editingRoles. - In edit mode, layer and feature selectors are locked until
SaveorCancel. - The delete button is shown only when
allowDeleteistrue. - Default units for geometry-based calculations are
m²forareaandmforlength. - Spatial restriction key supported by the plugin is
restrictedArea. - A WFS-T HTTP
200response that contains an XML error is treated as a failure and shows an error notification.