Files
a-plot-of-plants/AGENTS.md
T
aaron.axvig c833f5ee84 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	AGENTS.md
#	README.md
#	index.html
#	package.json
#	src/data/buildings.js
#	src/data/grid.js
#	src/data/pavement.js
#	src/data/plants.js
#	src/data/yard.js
#	src/lib/feature-types.js
#	src/lib/yard-features.js
#	src/main.js
#	styles.css
2026-07-25 21:59:24 -05:00

104 lines
3.7 KiB
Markdown

# A Plot of Plants Agent Notes
This file is a fast handoff for future coding agents working in this repo.
## What this project is
Static client-side yard mapping app.
- Rendering: MapLibre GL JS.
- Basemap: committed Mandan-area Protomaps vector tiles in `tiles/mandan.pmtiles`.
- Yard data: authored in JavaScript modules, converted to GeoJSON in the browser.
- Runtime: plain ES modules, no bundler.
## Current architecture
Core files:
- `src/lib/geometry.js`: absolute points, local offsets, feet conversion, per-anchor rotation support.
- `src/lib/feature-types.js`: feature-kind labels, geometry constraints, detail field schemas, and style defaults.
- `src/lib/yard-features.js`: typed feature classes, stable ids, groups, parent-child relationships, schema metadata, GeoJSON export.
- `src/data/*.js`: yard content split by domain.
- `src/main.js`: MapLibre map, visibility controls, popup rendering.
Top-level exported data shape from `src/data/yard.js`:
- `type: "FeatureCollection"`
- `schemaVersion: 4`
- `lifecycleFields: { plantedDate: "date", removedDate: "date" }`
- `featureTypes: [...]`
- `featureCategories: [...]`
- `features: [...]`
- `groups: [...]`
Each feature currently exports:
- `properties.id`
- `properties.kind`
- `properties.label`
- `properties.name`
- `properties.plantedDate`
- `properties.removedDate`
- `properties.parentId`
- `properties.groupIds`
- `properties.details`
## Important decisions already made
1. Data is JS-authored on purpose.
This allows mixing exact imported geometry with expressions like `offset(anchor, east(ft(10)))`.
2. Styling belongs to feature types, not individual features by default.
If you need a new semantic type, prefer adding a new typed feature or feature-type definition rather than hand-styling scattered instances.
3. Local rotation is per anchor.
`offset(...)` reads `assumedNorthClockwiseDegrees` from the anchor point used as the origin. Do not reintroduce a global lot rotation unless there is a strong reason.
4. Feature categories, grouping, and parent-child metadata are part of the data model.
Top-level visibility categories come from `featureCategories` and each feature type's `categoryId`. Visibility controls consume those schemas and `groupIds` rather than inventing a second relationship system.
5. The GPKG was only a seed source.
The app does not depend on GIS tooling at runtime.
## Known data caveat
`buildings.gpkg` has a CRS issue in `lot_boundary`.
- The usable lot polygon was `fid = 2`.
- It had to be treated as `EPSG:26914` during extraction.
- Do not trust that layer's metadata blindly if you re-import from the GPKG.
## What is already modeled
- Porch and deck are children of the main house and also part of the `House Parts` group.
- Medora junipers are bushes in the `Junipers` group.
- A test tree exists that is offset from the top-left lot corner using per-anchor rotation.
## Likely next steps
1. Decide whether parent-child feature relationships should also affect the visibility hierarchy.
2. The basemap uses local vector tiles and is overzoomed from source zoom 15
through the yard map's maximum zoom of 24. Symbol layers are deliberately
omitted so the map has no remote font or sprite dependency.
## Useful validation commands
Validate data export:
```bash
node -e "import('./src/data/yard.js').then(({ yardGeoJSON }) => console.log(yardGeoJSON.features.length))"
```
Run local server:
```bash
python3 -m http.server 4173
```
## Editing guidance
- Preserve the typed-feature pattern.
- Prefer adding semantic types or groups over ad hoc properties when possible.
- Keep authored geometry readable; avoid generated noise unless the user explicitly wants bulk-import output.
- If adding new anchors, attach rotation metadata to the anchor itself.