Skip to content

Layer drawing ​

layer.draw adds a "new location" drawer to the layer view with a button for each drawing key.[1] Drawing a geometry creates a new record in the layer table through the location_new query, stores the geometry in layer.geom, and opens the new location.[2]

KeyDraws
point, line, polygonA point, a line or a polygon
rectangleA rectangle from two corners
circle_2ptA circle from its centre and a point on its edge
circleA circle with a radius entered in the drawer, with units
locatorA point at the user's current position

A key set to true uses the defaults; an object configures the drawing interaction; its label is the button text. Keys which are not drawing methods are ignored.[3]

  • hidden creates no drawer; drawer: false shows the buttons without a drawer; dialog shows them in a dialog; popout and classList change the drawer.
  • A geometry infoj entry has its own draw configuration for the geometry it edits; see location editing.
  • New records get the default values of infoj entries with default; see location infoj.

Pitfalls ​

  • A layer without geom gets no drawer, with a console warning.
  • layer.draw.delete is a legacy form of layer.deleteLocation.
  • Restrict layers with drawing to the users who add locations with layer roles.

Examples ​

Point and current-position drawing on the retail points.

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",
        "draw": { "point": true, "locator": true }
      }
    }
  }
}

  1. ui layers/panels/draw.mjs ↩︎

  2. mapp location/create.mjs ↩︎

  3. ui elements/drawing.mjs ↩︎

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