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§
- Host
- What the host lends a run: a place over the one the script’s
outputgives ((lat, lng): the command line’s--lat/--lngand--address;worldanswers for it), and the styles views can name. - Script
Error
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.
Functions§
- evaluate
- Run
sourceand return the graph it built, validated. The place is the one its ownoutputgives, and views can name no style. - evaluate_
draft - A draft of
source’s graph, for a page following a drag: the same graph but with everyremapwarp left out, since sampling one runs the script’s function hundreds of times.truewith it when something was left out, so the page knows to run the script in full once the drag settles. - evaluate_
in - Run
sourcewith whathostlends it. - library_
names - Every function the library defines, as
areas.unionordraw, sorted (properties such aspage.widthare not calls, and not listed): whatdrawland.d.tsmust declare.
Type Aliases§
- Styles
- Where
view(spec, "name")finds the script that draws in stylename: the host’s own (the command line readsname.jsbeside the profile, the web page its presets).Errsays why there is none.