Expand description
draw.land profiles in JavaScript.
A profile is a script that calls our library (library.js, over the
natives below); running it builds the operation graph the engine draws.
The script never touches geometry: by the time anything is drawn, the
interpreter is gone and only the graph is left.
const bldg = features.osm({ building: true })
const foot = areas.polygons(bldg)
draw({ id: "bldg_fill", from: fills.fill({ in: foot, pattern: "zigzag", spacing: "0.5mm", per: "feature" }) })Every node remembers the script line that made it, and every error (a
syntax error, a wrong argument, a bad reference found by validation) comes
back as line N column M: …, the form the web editor underlines.
The sandbox is the bare language plus the library: no network, files,
timers or console, no Date or Math.random (the same script always
draws the same map), and loops and recursion are capped.
Structs§
Constants§
- LOOP_
LIMIT - The most loop iterations one loop may run, and the deepest recursion: a
mistaken
while (true)ends with an error instead of hanging the page. - RECURSION_
LIMIT - SCRIPT_
PATH - The name scripts run under; positions in other sources (the library) are not the user’s.
Statics§
- PRESETS
- Built-in presets by id:
(id, source).
Functions§
- evaluate
- Run
sourceand return the graph it built, validated. - library_
names - Every function the library defines, as
areas.unionordraw, sorted: whatdrawland.d.tsmust declare. - preset
- The script of the built-in preset
id("city-grain"), if there is one. - preset_
ids - The built-in presets’ ids, sorted.