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), the styles views can name, and whether the script is TypeScript. - Script
Error
Constants§
- LIBRARY
- The library’s JavaScript face: a function of the library’s calls (
dl) that returns the namespaces a script calls. The Node package runs it too. - 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, read from the library as a script sees it. - run_
into - Run
sourceintograph, as more calls to the same graph: how a Python or Rust profile draws a view in a JavaScript style by name. The graph back, and whether the script ran. - strip_
types sourcewithout its TypeScript types: the same text where they were blanks, so positions in it are positions in the original (drawland-ts).
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.