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]
| Key | Draws |
|---|---|
point, line, polygon | A point, a line or a polygon |
rectangle | A rectangle from two corners |
circle_2pt | A circle from its centre and a point on its edge |
circle | A circle with a radius entered in the drawer, with units |
locator | A 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]
hiddencreates no drawer;drawer: falseshows the buttons without a drawer;dialogshows them in a dialog;popoutandclassListchange the drawer.- A geometry infoj entry has its own
drawconfiguration 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
geomgets no drawer, with a console warning. layer.draw.deleteis a legacy form oflayer.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 }
}
}
}
}