Skip to content

Location editing ​

An entry with edit shows an input instead of its value; edit: true is the same as edit: {}. Changed values are saved together: the location sends them to the location_update query, then shows them as saved.[1] Updates of one location run one after another, in order.

Restrict layers with editable entries to the users who edit them with layer roles.

Inputs ​

  • Text: placeholder, maxlength. options turns the input into a dropdown, or radio buttons with radio. An empty options array, or dynamic: true, loads the options with edit.query, distinct_values of the field by default.[2] arraySeparator splits text into an array.
  • Numbers: min and max bound the value, step sets the increment, and range adds a slider.[3]
  • Geometry entries: draw enables drawing a new geometry, modify_btn editing the existing one, delete removing it, and snap snapping to other features; modify_label and delete_label label the buttons.
  • entry.default fills a new location's value; see location infoj.

After saving ​

  • dependents lists fields of the location which are reloaded after this entry is saved, eg. values computed by a trigger.
  • dependents_layers lists layer keys which are reloaded.
  • layer.deleteLocation adds a delete button to the location view.
  • layer.toggleLocationViewEdits starts the view read-only, with a button to switch editing on.[4]

Pitfalls ​

  • entry.step sets the step to 1 whenever it is set, because of operator precedence in the numeric entry. Use edit.step.
  • layer.edit.delete and layer.draw.delete are legacy forms of deleteLocation.

Examples ​

Retailer chosen from the values in the table, and a bounded size field. The example layer is read in tests; editing writes to the devdb only in a running view.

json
{
  "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",
        "toggleLocationViewEdits": true,
        "infoj": [
          { "title": "Retailer", "field": "retailer", "edit": { "options": [] } },
          { "title": "Name", "field": "store_name", "edit": { "maxlength": 80 } },
          { "title": "Size band", "field": "size_band", "edit": { "options": [], "radio": true }, "dependents": ["pqi"] },
          { "title": "PQI", "field": "pqi" }
        ]
      }
    }
  }
}

  1. mapp location/decorate.mjs update and syncFields ↩︎

  2. ui entries/text.mjs textoptions ↩︎

  3. ui entries/numeric.mjs edit ↩︎

  4. ui locations/view.mjs ↩︎

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