Table of Contents

Playground: "map first", minimal API without a frontend build, UI from explicit algorithm descriptors

The playground is an ASP.NET Core minimal API (net10.0) with a single static page in plain JavaScript (ES modules, no npm/build). Leaflet 1.9 and Leaflet-Geoman free live locally in wwwroot/lib. The UI follows the prototype variant "map first": a full-screen map, a command palette (Ctrl+K) with the parameters of the selected algorithm below it, chips for computation CRS, layers and figures, and at the bottom a bar with preview cards of the sample geometries. The UI knows no algorithm by heart but builds itself from GET /api/algorithms. For this, every algorithm has an explicit descriptor in the playground (IPlaygroundAlgorithm: id, name, group, inputs with allowed types, parameters with type, default, unit crs and German label, Run(...)), found by assembly scan. Reflection over the extension methods with attributes in SpatialNET.Extensions was rejected because it carries playground concerns into the library.

German version: 0011-playground-karte-zuerst-deskriptor-registry.de.md

Consequences

  • Completeness test: every public method of SpatialNET.Extensions must have a playground descriptor (analogous to the reflection test from ADR 0008).
  • GET /api/fixtures?algorithm= reads samples/ (copied to the output directory) and converts WKT to GeoJSON with SpatialNET.IO. Fixtures with crs are projected to WGS84, local planar ones arrive raw with the flag local (ADR 0010). By default only fixtures with the tag playground appear; a switch shows all.
  • POST /api/run computes automatically on every change (300 ms debounce). The response contains the result as GeoJSON (WGS84 or local), the computation CRS, figures (area, length, vertices, parts) and warnings. List results such as Cut are colored and numbered per piece. Errors appear as a chip; the last result stays in place.
  • Inputs come from drawing with Geoman (target A/B selectable), GeoJSON upload (GeoJson.ReadAll, ADR 0009) or sample geometries.
  • Language (later change). The UI is in English: labels, groups, messages and the names of the examples (the name and description of the fixtures). The documentation is bilingual, the playground is a tool and has one language, like the code and the API reference.
  • WKT and M (later addition, ADR 0015). GeoJSON cannot carry M, so each input also has a collapsible WKT field (Z and M included), and every geometry result comes with its WKT and a copy button. POST /api/run takes an optional wkt per input that wins over the GeoJSON of the same input; the response has wkt (or wkts for list results), back-projected like the GeoJSON. POST /api/convert turns WKT into GeoJSON for the map and GeoJSON into WKT for the field. The projection keeps Z and M. Examples with M (tag m) arrive with their WKT (aWkt, bWkt), and InterpolateByM, ProjectToM and SubstringByM show the m examples of their length variants with their own default parameters. The map still draws X and Y only; editing a geometry on the map drops its M, because the map only knows GeoJSON.
  • The node_modules/ entry in .gitignore is dropped.

Considered Options

  • Variants "workbench" (3 columns) and "catalog" (fixture table with text editor) – prototype on branch prototype/playground-ux
  • Frontend with an npm/Vite build, Blazor (rejected: tooling ballast for one page)
  • Reflection plus attributes in SpatialNET.Extensions (rejected: playground concerns in the library)