# Kosznajderia — Business requirements

**Document purpose:** a complete handoff for a human or another AI coding assistant (for example Claude) continuing development of the Kosznajderia web map.  
**Status:** proof of concept is live. A full-region painted watercolor basemap is **not** being implemented yet (decision of 27 November 2026).  
**Date:** 27 November 2026, Europe/Warsaw (CET).  
**Live site:** [https://kosznajderia.commonplaceapp.workers.dev](https://kosznajderia.commonplaceapp.workers.dev)  
**This file on the site:** [https://kosznajderia.commonplaceapp.workers.dev/business-requirements.md](https://kosznajderia.commonplaceapp.workers.dev/business-requirements.md)  
**Readable page:** [https://kosznajderia.commonplaceapp.workers.dev/business-requirements/](https://kosznajderia.commonplaceapp.workers.dev/business-requirements/)

Do not invent historical facts. If a date, population figure, name or boundary is not in the sources listed here or in `villages.csv` / heritage files, treat it as an open question.

---

## 1. Vision and use case

Kosznajderia (German: *Koschneiderei*) is an educational, board-game-like web map of a historical rural region in northern Poland (today the border of Pomorskie and Kujawsko-Pomorskie, around Chojnice, Tuchola and Kamień Krajeński). The educational time span in mind is roughly **1400–1945**. The idea was inspired by Andrej Karpathy’s Civ-style map.

The product should feel more like a historic board or atlas you can explore than like a generic modern web map. The owner has said the current MapLibre map still lacks “soul”, and that a watercolor-on-parchment look is the direction he likes. That painted basemap is designed, sampled and estimated, but **explicitly deferred**.

**Who it is for**

- People with a family or local connection to the Koschneider villages
- Students and teachers of regional history
- History enthusiasts exploring the 19 villages and their landscape

**What they do today**

- Open a map of the 19 villages, pan and zoom
- Tap a village, a hex, a heritage site, or (in Ciechocin, at close zoom) a building or other mapped object, and read a short card with sourced facts
- Switch between a flat 2D parchment map and a tilted 3D view of extruded buildings
- Open a painted isometric portrait of Ciechocin (watercolor primary, pixel-art comparison)

**What they should be able to do later**

- Add markers and comments on a hex, down to about 5 metres (H3 resolution 13 is about 3.6 m edge)
- Explore eras / historical context more richly than today’s static cards (not designed in detail yet)

The product is being built by WM in Poland, who also develops the Commonplace app. The working language of this document and of the code comments is English; the live app UI is Polish by default, with an English toggle.

---

## 2. Goals, success criteria, and non-goals

### Goals

- Let a visitor understand, in a few minutes, what Kosznajderia is and where the 19 villages sit in the landscape.
- Make Ciechocin the showcase: at close zoom the village is detailed enough to walk the streets, see the church, cemetery, fields and nearby lake, and tap objects for facts.
- Keep every pin and comment tied to the ground, not to a drawing. Hex IDs must be stable; a later painted or 3D layer must not move them.
- Give the map a distinctive historic character (parchment palette now; watercolor “soul” later), without becoming a generic OSM skin.
- Stay simple enough to ship and to hand off.

### Success criteria (POC, current)

- The 19 villages and the region outline are visible on a public URL, on desktop and mobile.
- Zooming shrinks the hex grid through H3 resolutions 7–13, and a visitor can reach ~5 m cells.
- Tapping a hex or a village opens a card with an H3 ID and any known facts or nearby heritage.
- Ciechocin has a 2D/3D toggle and a separate isometric watercolor page.
- Polish and English UI both work.
- PMTiles load correctly (HTTP 206 Range).

### Non-goals for now

- A full-region painted watercolor (or pixel-art) basemap — **explicitly not now**.
- User accounts, login, or **writable** comments and markers. The memory layer in §4.6 is read-only demonstration data and does not change this.
- A playable game, multiplayer, or Civ-style turn mechanics. “Board-game-like” refers to the feel of the map, not to game rules.
- Survey-accurate historical reconstruction of every building or field as it looked in a given year. Today’s basemap is modern OpenStreetMap.
- Changing any Cloudflare worker other than `kosznajderia`, or the account subdomain.

### Principle: “keep it simple”

This is a standing preference from the owner. Prefer a small, clear change over a large framework. Do not add services (D1, auth, a new build tool) until a feature actually needs them. Do not invent historical content to fill gaps.

---

## 3. Region scope

The map covers the **union of the 19 villages’ present-day cadastral precincts** (*obręby ewidencyjne*), used as a convenient region proxy. **This is not a historical boundary** of Koschneiderei. A simple local-metre estimate of the current `region_obreby.geojson` is about **232 km²**. Earlier working notes used **~218 km²**. Treat the exact area as approximate until it is recomputed in a proper equal-area projection.

**Showcase village:** Ciechocin (German: Deutsch Cekzin). All close-zoom detail, the 3D building work, and the isometric paintings are centred here.

**Nearby towns (shown for orientation, outside the region):** Chojnice (Konitz), Tuchola (Tuchel), Kamień Krajeński (Kamin), Sępólno Krajeńskie (Zempelburg).

### The 19 villages

Compiled in `villages.csv` from Rink 1932 (via Sadurska 2022), Polish and German Wikipedia, OSM Nominatim coordinates, and other sources cited in that file. Some rows are sparse. One identification (Dąbrówka, 1333 Cistercian exchange) is noted in the spreadsheet as not independently checked. Do not treat this table as independently verified history.

| Polish name | German name | Approx. coordinates | First mention / founding (as recorded) | Notes (as recorded) |
|---|---|---|---|---|
| Ostrowite | Osterwick | 53.6327, 17.6713 | 1338, location as “Ostirwig” | Informal capital (Sadurska; pl.wikipedia). Gmina Chojnice. |
| Angowice | Hennigsdorf | 53.6557, 17.5619 | 1357, 48 łany, Chełmno law | |
| Ciechocin | Deutsch Cekzin | 53.6132, 17.7009 | 17 Jan 1342, location charter issued in Tuchola | Showcase village. Early Teutonic Order village. Church of St Martin (*Kościół pw. Świętego Marcina*) is used in the app from OSM. |
| Dąbrówka | Damerau | 53.5774, 17.6204 | 1333 (Cistercian exchange; identification not independently checked) | Gmina Kamień Krajeński. |
| Doręgowice | Döringsdorf | 53.6268, 17.4900 | (not filled) | Sparse facts in the spreadsheet. |
| Duża Cerkwica | Groß Zirkwitz | 53.5319, 17.5641 | 1217; 1454 “Cerekwica privileges” associated with the village | |
| Granowo | Granau | 53.6601, 17.6482 | Before 1356 (privilege confirmed 1356) | Early Teutonic Order village. |
| Jerzmionki | Harmsdorf | 53.6048, 17.5107 | (not filled) | Sparse facts. |
| Lichnowy | Lichnau | 53.6496, 17.6047 | 24 Aug 1338; location charter 4 Mar 1363 | Early Teutonic Order village. |
| Moszczenica | Mosnitz | 53.6420, 17.4971 | Location charter from komtur Dietrich von Lichtenhain (date not in sources consulted) | Birthplace of Joseph Rink (as recorded). |
| Niwy | Blumfelde | 53.5779, 17.4301 | 15 Nov 1354, location charter | OSM point is the sołectwo centre; approximate. |
| Nowa Wieś | Annafeld | 53.5771, 17.4893 | (not filled) | Gmina Kamień Krajeński. |
| Obkas | Obkas | 53.5711, 17.5516 | 1217; located on Chełmno law 1347 | |
| Obrowo | Abrau | 53.5875, 17.6829 | (not filled) | Birthplace of Bishop Augustinus Rosentreter (as recorded). |
| Ogorzeliny | Gersdorf | 53.6020, 17.5558 | 26 Dec 1236; location charter 29 Jun 1338 | |
| Piastoszyn | Petztin | 53.6283, 17.7358 | 1339 court case; 1345 tavern privilege | Early Teutonic Order village. |
| Silno | Frankenhagen | 53.6470, 17.7076 | 1319 | Site of the Kosznajder hut museum area (as recorded). Early Teutonic Order village. |
| Sławęcin | Schlagenthin | 53.6021, 17.6150 | 24 Aug 1338; location charter 15 Jul 1368 | Early Teutonic Order village. |
| Zamarte | Jakobsdorf | 53.6005, 17.4826 | 1354 as “Jacobsdorf” | Gmina Kamień Krajeński. |

Rink 1926 map symbols (wheel = *Koschnäwjerdorf*, double circle = *Koschneiderdorf*) and an “early Teutonic Order village” flag are also stored, with sources, in `villages.csv` and `poc/data/hexinfo.json`.

---

## 4. Functional requirements

### 4.1 Map (implemented)

- Engine: **MapLibre GL JS 5.24.1**, bundled in `poc/lib/`.
- Basemap: a custom parchment style (`poc/style.js`) over vector tiles in `data/koszn.pmtiles` and a terrarium DEM in `data/dem.pmtiles`.
- Layers include: hillshade, landcover, water, roads, rail, the region outline, a 1920–1939 Polish–German border trace, building footprints, Ciechocin close-zoom detail (buildings, barriers, points, street labels), heritage symbols, village and town labels, and the hex grid — which since 1 December 2026 is generated only inside the region, with everything outside washed toward the parchment by a `veil` layer over `data/outside.geojson` — plus the OSM enrichment layers added on 30 November 2026: hamlet marks and labels, tree rows and single trees, former (disused / abandoned) railways, and building footprints OSM flags as historic. Every one of those five is clipped to the 19 cadastral precincts, so nothing of Chojnice or the other surroundings is drawn from them. Added the same day from GUGiK BDOT10k, and clipped the same way: 5 m contours with labelled index contours, scarps and gullies, earthworks and mounds, spot heights, surveyed tree rows and hedges, trees registered as natural monuments, and surveyed building outlines for Ciechocin.
- Zoom: min 8.5, max 20. The opening view is pinned to three towns, one against each edge — Chojnice at the top, Kamień Krajenski at the bottom, Tuchola at the right. Each edge is padded by exactly what that town's own label needs and nothing more, so the names are whole with only a few pixels to spare: 8 px at the top, where the dot is all that has to fit because the label hangs below it, against 60 px at the bottom and 31 px at the right, where the label itself has to clear the edge. Those figures were measured off the render — a frame with the text layers hidden diffed against one with them shown — rather than derived from the style's font sizes, which came out about 13 px short. The bottom is measured at Duża Cerkwica, 160 m further south than Kamień. Any room the window has left over opens westward, away from the sheet's eastern limit; on a window too narrow for that height fit the width fit takes over, anchored at the region's own western edge so Niwy is never lost. `homeCamera()` in `app.js` computes it, and the ⌂ button returns to it. A **Ciechocin ›** button flies to the village (zoom 16.4 in 2D; closer and tilted in 3D).
- Map bounds are clamped to `[[17.10, 53.33], [18.15, 53.89]]`.
- Four zoom “bands” are shown in a small label: Region / Village / Streets / Details (full Ciechocin detail from about zoom 15.5).

### 4.2 Zoomable H3 hexes (implemented)

Hexes are computed **in the browser** with **h3-js 4.5.0** (bundled) for the current viewport only, not pre-generated for the whole region at every resolution. A cap of **4,500 hexes per view** applies; padding is 0.12 of the viewport.

| Map zoom | H3 resolution | Approx. edge |
|---|---|---|
| below 10 | 7 | ~1,221 m |
| 10–11.5 | 8 | ~461 m |
| 11.5–13 | 9 | ~174 m |
| 13–14.5 | 10 | ~66 m |
| 14.5–16 | 11 | ~24.9 m |
| 16–17.5 | 12 | ~9.4 m |
| 17.5 and up | 13 | ~3.6 m |

Counts of cells whose centre falls in the current `region_obreby.geojson`, recomputed 27 November 2026 with the bundled h3-js:

| Resolution | Cells in the region |
|---|---|
| 7 | 50 |
| 8 | 330 |
| 9 | 2,333 |
| 10 | 16,331 |
| 11 | 114,360 |
| 12 | 800,531 |
| 13 | 5,603,722 |

(Earlier notes were 16,329 / 114,347 / 800,506 / 5,603,463 at res 10–13; small differences are expected if the polygon or library patch changes.)

**Stability, important for pins:** an H3 cell ID is permanent and refers to a place on the Earth, not to a pixel on a painting or a MapLibre layer. If the drawing changes, the ID does not. **Parent and child hexes do not nest perfectly.** When a user later pins a comment, store **both** the H3 ID **and** the point coordinates (and probably the resolution).

An older fixed hex grid (`poc/data/hexes.geojson`, 789 cells) is still loaded and used only to attach coarse land-cover / “nearest village” facts to the zooming cells by nearest centre. Village and town membership of a cell is computed live from coordinates.

### 4.3 Tap behaviour (implemented)

Priority of pick (top first): heritage, Ciechocin points, village marks, church tower, Ciechocin buildings, 3D extrusions, other buildings, Ciechocin barriers, roads, tracks, paths, water, landuse, forest, then the hex fill.

- At close zoom in Ciechocin, tapping a building or similar object opens an OSM-tag card (and a link to the OSM object).
- Tapping a village point or a hex opens a hex card: village facts when the cell contains a village, otherwise land cover / nearest village, plus H3 ID, resolution and size, and any heritage in or near the cell. The card already contains the line “Comments coming later.”
- Heritage sites have their own cards (name, category, dating if present, source NID or OSM).
- To get a hex in a dense area, tap a gap between objects.
- Hover tooltips on desktop; touch has a short preview then the card.
- `Escape` or the close button closes the card.

### 4.4 2D / 3D view (implemented)

- Default is flat 2D. A **3D** button (and the deep link `#3d=1`) tilts the map: pitch **58°**, bearing **38°**.
- Buildings use MapLibre `fill-extrusion`. Height comes from an OSM `height` tag if present, else `levels × 3.2 m`, else a default by building type (for example church 12 m, house-like 6.5 m, barn 7 m). **No OSM height tags were present** when this was built; **15 Ciechocin buildings** have a numeric `levels` value. A separate approximate **church tower** extrusion is hard-coded at **32 m**.
- Rotate and pitch gestures are enabled only in 3D; 2D stays north-up.
- Hexes stay on the ground (they are fills, not extruded).
- Flat building fills are hidden in 3D and shown again in 2D.

### 4.5 Isometric painted page (implemented, prototype)

- URL: `/iso/`. Linked from the main map as **Isometric ›**.
- A painted isometric portrait of Ciechocin, including the built-up street, St Martin’s church, the cemetery, Jezioro Ciechocińskie and nearby forest.
- Tabs: village watercolor (primary), church watercolor, church pixel art (comparison), plus the technical dimetric base renders.
- Pipeline used: a true 2:1 dimetric orthographic base is rendered with three.js (pitch `atan(0.5)`, azimuth 135° from the south-west) from OSM-derived `scene.json`; an image-to-image model then paints over that base. An affine lon/lat → pixel transform was fitted so a hex overlay *can* be aligned later. The live `/iso/` page does **not** yet show hexes.
- **Caveats:** the camera is fixed (no rotation); the paintings are not survey-accurate; animals, a boat, laundry, smoke and a stork’s nest are **invented atmosphere**, not historical claims; resolution is modest (the model outputs ~1280×720 or 1024×1024, so sharper views need tiling).

### 4.6 Memory markers — demonstration layer (implemented 1 December 2026), writes still not built

A read-only layer of **200 memories by 25 authors**, served from `site/data/markers.json`. **Everything in it is invented**, including the family letters and diaries quoted; no real person, book or archive is cited. It exists so the marker experience could be designed and measured at realistic density before any store or identity system is chosen. Full reasoning: `docs/ideas/memory-markers.md`.

- The file carries `"fictional": true`. The loader draws nothing unless that flag is a boolean, so the badge on every memory and author card cannot be forgotten by a caller — the data decides, not the code path.
- Each marker stores a point, an **authored H3 resolution** (its *scale of address*: "about the whole region" through "about an exact spot"), subject, body, author, what it is about, when it was added, an attachment flag, and an "I remember this too" count. The cell is derived with `h3.latLngToCell`, never stored, so point and cell cannot drift apart. This satisfies the rule below by construction.
- On screen, markers are grouped into the cell of the **current display resolution**, and a group pin carries its count. Region view: 200 markers → 47 pins. Nothing is hidden at any zoom, and nothing is drawn more precisely than the view justifies.
- Attachments are one shared placeholder plate, `site/img/memory-plate.svg` (1.3 KB), referenced by the 128 markers that have one.
- An author card gives a short bio, where they write from, and a list of their memories. No separate page or router: it is a card type, reached by `#author=<slug>`.
- Regenerate with `python3 docs/make_markers.py`.

Still planned, still **not** implemented:

- Visitors adding their own markers and comments, at any level down to ~5 m.
- Suggested store: **Cloudflare D1**, keyed by **H3 ID + point coordinates** (and resolution). Do not key by H3 ID alone. The JSON row above is shaped to become that table row.
- Moderation and identity remain **open questions**. Nothing can be written today, so there is nothing to moderate.
- "Corroborations" rather than "likes" is a recommendation from the design work, not a decision taken. Liking someone's grandmother's death is the wrong gesture; *I remember this too* is both warmer and factually useful. The count is read-only either way.

### 4.7 Language, deep links, and chrome (implemented)

- Default language is Polish; a header button toggles English. Preference is stored in `localStorage` key `kl`, and `?lang=pl` or `?lang=en` also works.
- Deep links in the URL hash, useful for tests and sharing: `#z=`, `#c=lon,lat`, `#pitch=`, `#bearing=`, `#3d=1`, `#open=lon,lat`, `#tip=lon,lat`, `#touchtip=lon,lat`, `#hex=<h3id>`, `#m=<marker id>`, `#author=<slug>`.
- Reset (⌂) returns to the region, 2D, north-up.

---

## 5. Visual direction

The owner wants the map to have “soul”. He responded strongly to a **watercolor-on-parchment** look (warm ochre fields, ink outlines, paper grain, red-tiled farmsteads, a brick church). The live main map today is a custom parchment MapLibre style (palette taken from an earlier static map): paper `#f0e4c8` / `#efe3c6`, ink `#3b2a18`, forest `#c3cc98`, water `#a8c4c2`, roads `#b98a54`. UI type is Georgia with “EB Garamond” in the stack; map labels use self-hosted **EB Garamond** MapLibre glyphs.

### Watercolor detail levels (explored, not implemented on the main map)

On 27 November 2026 the same ~640 m patch around Ciechocin church (village street, fields, forest edge, west shore of the lake) was painted at three scales, guided by a dimetric base of the real geometry. Files (not deployed) live at `/workspace/kosznajderia/iso/levels/`.

| Level | Scale | What you can read | Notes |
|---|---|---|---|
| 1 — regional | ~1 px/m (600 px wide) | Fields, forest masses, lake, roads, village as red-roof dabs, church as a small spire mark | Painted loose, then downsampled; not a native 600 px painting. |
| 2 — high detail | ~2 px/m (1200 px wide) | Every farmstead, tree lines, fences, furrows, church shape | One painting at the model’s ~1280 px width. At screen size the whole patch looks almost like Level 3. |
| 3 — Ciechocin-level | ~4 px/m (2400 px wide) | Roof tiles, windows, chimneys, gardens, reeds, ripples | Four overlapping tiles, seam-stitched. One seam still slightly clips a building. Fine detail can drift from the base. |

**Recommendation (not a decision):** Level 1 for the countryside, Level 3 for village centres where people will zoom in and pin. A full-region Level 3 would spend most of its effort on empty fields. Rough effort for the whole region was estimated at 1–2 days (Level 1 everywhere), 3–5 days (the recommended mix), 1–2 weeks (Level 2 everywhere), or several weeks (Level 3 everywhere). These are guesses; the first village would set the real pace.

**Owner decision, 27 November 2026:** do **not** implement the painted watercolor basemap yet. Keep the samples and this recommendation for later.

Pixel art was produced only as a comparison on the church close-up; watercolor is the preferred style.

---

## 6. Current state

### Live URLs

- Main map: https://kosznajderia.commonplaceapp.workers.dev/
- Isometric Ciechocin: https://kosznajderia.commonplaceapp.workers.dev/iso/
- This requirements page: https://kosznajderia.commonplaceapp.workers.dev/business-requirements/
- Markdown (for pasting into Claude): https://kosznajderia.commonplaceapp.workers.dev/business-requirements.md

There is no public git remote in the working copy. The development tree is `/workspace/kosznajderia` on the project box. `poc/site/` is the folder that gets uploaded as the Worker’s static assets.

### Hosting

- Cloudflare Worker name: **`kosznajderia`** only.  
- Account: `0f6d764ddfa87c14253ee88d34f54873`.  
- **Do not touch** other workers on this account (`api-grok-bookmark`, `api-grok-scout-instruction`, `servicenow`, `wm`) or the account subdomain.
- Static assets plus a small Worker (`poc/worker.js`) that adds **HTTP Range / 206** support for `*.pmtiles`. After a deploy, verify (1) HTML/CSS/JS/markdown MIME types are not `text/plain`, and (2) a Range request to `data/koszn.pmtiles` returns 206.
- Upload tokens from an assets session must be deleted after deploy.
- `run_worker_first` must include `/data/*.pmtiles` so Range handling actually runs.

### Tech stack

| Piece | Version / note |
|---|---|
| MapLibre GL JS | 5.24.1, vendored in `poc/lib/maplibre-gl.js` |
| PMTiles | 4.5.0 (project notes; vendored `poc/lib/pmtiles.js`) |
| h3-js | 4.5.0 (project notes; vendored `poc/lib/h3-js.js`) |
| tippecanoe | builds `koszn.pmtiles`, zooms 8–14 |
| three.js | 0.170, vendored in `iso/vendor/` for the dimetric renderer (not shipped to the main map) |
| Fonts | EB Garamond as MapLibre glyphs under `poc/fonts/` |
| Hosting | Cloudflare Workers static assets |

`koszn.pmtiles` is about 2.3 MB; `dem.pmtiles` about 1.6 MB.

### Data sources

- **OpenStreetMap** (ODbL), via Geofabrik extracts `pomorskie-latest.osm.pbf` and `kujawsko-pomorskie-latest.osm.pbf` (the region sits on the voivodeship border). Parsed in `poc/extract_poc.py`.
- **GUGiK ULDK** cadastral precincts (`fetch_obreby.py` → `boundary/obreby.json`). Region proxy, not a historical boundary.
- **NID** *rejestr zabytków nieruchomych* (dane.gov.pl) plus OSM historic/heritage tags, combined in `build_heritage.py`. About **60** heritage points in `hexinfo.json` (categories: church, cemetery, wayside, manor, house, archaeology, other; sources NID or OSM).
- **Copernicus GLO-30** DEM (`dem/cop_N53_E017.tif`) → terrarium `dem.pmtiles` (z8–12) and hillshade.
- **Joseph Rink, *Die Koschneiderei* (1926)**, Wikimedia Commons `File:Koschneiderei_1926.gif` (public domain): 1920–1939 Polish–German border trace, affine georeference on 21 control points, RMS about 157 m, stated accuracy about 150–300 m.
- Village facts: `villages.csv` (Rink 1932 via Sadurska 2022; pl/de Wikipedia; Słownik geograficzny for some population figures; de.wikipedia *Koschneiderei* Geschichte for the early-village list). Every fact in the UI should keep its source line.

An older experimental static site under `web/` also mentions SLUB Dresden Virtuelles Kartenforum Messtischblatt / TK100 tiles. Those sheets (especially post-1900) may be rights-reserved and were streamed for viewing, not redistributed. They are **not** part of the live POC Worker.

### OSM enrichment layers, 30 November 2026

Five further classes of OpenStreetMap data were already available for this area but unused. They were added as plain client-side GeoJSON — **no tile rebuild** — and every one is clipped to the region, which for this purpose was rebuilt from GUGiK ULDK as the union of the 19 villages’ precincts (215.8 km² by a local-metre estimate, against the 217.4 km² recorded in `koszn.pmtiles`; the two agree within the accuracy of either figure). OSM snapshot: Overpass `timestamp_osm_base` **2026-11-30T12:52Z**.

| File | What it holds | Count in the region |
|---|---|---|
| `data/hamlets.geojson` | `place=hamlet` / `locality` / `isolated_dwelling`, mostly PRNG-sourced names — the *Wybudowanie* outlying settlements, the mill hamlets (Obkas-Młyn), and the Pierwszy / Drugi pairs | 34 |
| `data/trees.geojson` | `natural=tree_row` lines (clipped at the region boundary) and `natural=tree` points | 60 row segments, 308 trees |
| `data/railhist.geojson` | `railway=disused` / `abandoned` / `razed` / `dismantled` | 2 segments (both unnamed spurs) |
| `data/histbld.geojson` | building footprints carrying any `historic=*` tag | 26 |
| `data/lakelabels.geojson` | gains a `de` field from OSM `old_name:de` / `name:de` | 4 lakes |

Notes, so a successor does not redo the work:

- **The heritage harvest added nothing.** Every OSM object with a `historic` tag inside the region — 9 wayside crosses and shrines, the Obrowo hill fort, the Duża Cerkwica *Stary młyn* — is already in `heritage.geojson` by `osm_id`, and the two named churches that are not (Ogorzeliny, Zamarte) sit 4 m and 13 m from the NID record for the same building. The earlier counts that suggested otherwise were counting Chojnice.
- Three NID records with no geometry of their own were cross-linked to the nearest OSM object of the same kind within 25 m; those carry `osm_match` saying so. `ref:nid` itself is tagged on only one object here, which was already linked.
- The German lake names are **Cekziner See** (Jezioro Ciechocińskie), **Petzliner See** (Jezioro Piastoszyn), **Blumenfelder See** (Jezioro Niwskie) and **Waldsee** (Jezioro Ostrowite). No hamlet inside the region carries a German name in OSM.
- Nothing here is historical: these are present-day OSM features, same as the rest of the basemap. `historic=*` is an OSM assertion about a building, not a dated source, and most of the 26 footprints are unnamed `historic=yes` flags from a geoportal import.
- Not checked, because the build scripts are not in the published site tree: whether `extract_poc.py` picks up `natural=wood` as well as `landuse=forest` (243 `natural=wood` ways exist in the tile clip box).

### BDOT10k (Geoportal) layers, 30 November 2026

A survey of Polish public geodata found a second body of usable material, this time from GUGiK rather than OSM. Four layers were built from **BDOT10k**, the national topographic object database, in the same way as the OSM enrichment above: plain client-side GeoJSON, **no tile rebuild**, everything clipped to the same 19 cadastral precincts. Source files are the open BDOT10k GML for the three powiats the region straddles — chojnicki (2202), sępoleński (0413) and tucholski (0416) — dated 15 October 2026 and downloaded on 30 November 2026. Coordinates were converted from EPSG:2180; lines are cut at the precinct boundary, polygons kept by centroid.

| File | What it holds | Count in the region | Size |
|---|---|---|---|
| `data/bdot_relief.geojson` | contour lines at 5 m (thinned from the native 1.25 m), plus scarps and gullies | 647 contour segments across levels 110–185 m, 236 scarps, 23 gullies | 384 kB |
| `data/bdot_trees.geojson` | surveyed tree rows, hedges and shrub belts, and trees registered as *pomnik przyrody* | 441 tree rows (9 of them protected), 113 hedges, 18 protected trees | 110 kB |
| `data/bdot_earth.geojson` | earthworks and micro-relief: banks, dykes, dry moats and cuttings, mounds, pits, spot heights | 128 banks, 205 moats/cuttings, 51 dykes, 79 mounds, 48 pits, 219 spot heights | 126 kB |
| `data/bdot_bld.geojson` | surveyed building footprints for **Ciechocin only**, with function and floor count | 180 buildings (110 outbuildings, 49 single-family, 11 multi-family, 1 church, 1 production, 1 garage); floors 1–3 | 63 kB |

Notes:

- Contours are simplified (Douglas–Peucker, 6 m) and fragments under 120 m are dropped; without that the file was 2.4 MB. Every 25th metre is drawn as an index contour and labelled from z14.5.
- `bdot_bld.geojson` is **not** drawn as a second set of buildings. It renders as a dashed outline at z15.5+, and an invisible fill layer lets a Ciechocin building card add the surveyed function and floor count beside the OSM tags. This is the first real answer to the "no OSM height tags" limitation below, for one village.
- The BDOT tree rows and the OSM ones are largely **different** objects: of the 60 OSM rows, only 11 have a BDOT row within 25 m along most of their length. Both layers are kept and drawn in the same green bead line.
- **Cemeteries added nothing.** BDOT10k has 15 cemeteries and sacral complexes inside the region; every one of them is already within 120 m of a record in `heritage.geojson`, so no file was written.
- Nothing here is historical either. BDOT10k is a present-day survey; what makes it useful for this project is that it records field banks, moats, mounds and old tree rows that OSM does not, and that its building attributes are surveyed rather than volunteered.

Surveyed but **not** used, with the reason, so a successor does not repeat the search:

- **NMT 1 m** (GUGiK LiDAR terrain model) would replace the Copernicus GLO-30 hillshade and is a far better fit for this map — at 1 m the hollow ways, field banks and lake terraces are legible. It needs a `dem.pmtiles` rebuild with GDAL, so it belongs with `build_dem.py` on the project box, not in this mirror. `WMS/ShadedRelief` serves PNG in EPSG:4326 and works; the WMTS is EPSG:2180 only, so MapLibre cannot use it directly.
- **PRNG** (national register of geographical names, WFS at `mapy.geoportal.gov.pl/wss/service/PZGiK/PRNG/WFS/GeographicalNames`) holds 163 official locality names, 46 standardized physiographic names and 63 minor field, meadow and hill names in the area, including two `uroczysko-dawna miejscowość` (sites of settlements that no longer exist) and one hill recorded as *Brandwiese*. It will **not** supply German names: of 163 localities exactly one carries a `NAZWYHISTORYCZNE` entry, and that is a word-order variant.
- **Archival orthophoto** (`ORTO/WMS/StandardResolutionTime`) does cover the region back to the 1995–2005 window, queried as a date range; single exact dates return blank.
- No nature reserves and no Natura 2000 areas fall inside the region at all.
- **NID publishes no working map service.** Every service path under `mapy.zabytek.gov.pl` returns 404 and `mapserver.zabytek.gov.pl` has a certificate that does not match the host. The dane.gov.pl CSV already in use remains the only route.
- **BDL** (forest data bank) was queried for stand age, which would date the woods; the identify calls returned the forest district and range (Nadleśnictwo Lutówko, leśnictwo Kamionka, RDLP Toruń) rather than stand-level species and age. Not confirmed either way.

### Versioning and changelog, 30 November 2026

The site carries a version number, shown as a **v0.2.0** button under *Requirements ›*, which opens a changelog panel in the same card used for object details.

- `site/changelog.json` is the **single source of truth**. It holds `current` plus a `releases` array, each release carrying `v`, an ISO `date`, a bilingual `title` and bilingual `items`. There is no second copy to keep in sync, and no build step generates anything from it.
- Every string is `{ "pl": …, "en": … }`; the panel re-renders when the language is switched, and dates are formatted per language at display time.
- The app fetches it alongside the other data files, with a `.catch` that returns `null`: if the file is missing or malformed the map still loads, the button reads `v?` and the panel says the changelog could not be loaded.
- **0.1.0** is the proof of concept as mirrored here on 27 November 2026 — the version that is live on the Worker today. **0.2.0** is the first release to include the OSM and BDOT10k layers above.
- To cut a release: add an entry at the top of `releases` and set `current` to match. Nothing else needs touching.

### The Nowy Dwór enclave, 1 December 2026

The region outline had a hole in it. The union of the 19 precincts enclosed, but did not contain, the cadastral precinct of **Nowy Dwór** (TERYT `220203_2.0018`, gmina Chojnice) — about 7.3 km² in the middle of the region, bbox 17.5167–17.5740 × 53.6191–53.6424. MapLibre paints a polygon's interior rings exactly like its outer ring, so that exclusion was drawn with the same bold dashed border as the region edge and read as if it were a highlighted area of its own.

- The region is now the union of **20** precincts and has no interior ring. Area goes from **217.4 km² to 224.6 km²**; the difference is the enclave, which confirms the hole was exactly Nowy Dwór's precinct.
- It is drawn from **`data/region.geojson`**, not from `region_obreby` in `koszn.pmtiles`. The hole is baked into the tiles and tiles cannot be rebuilt from this mirror, so `region-fill` and `region-line` now read the GeoJSON. **The `region_obreby` tile layer is unused.** When the tiles are next rebuilt on the project box, rebuild it from the 20 precincts and the GeoJSON source can go away.
- The union was computed by edge cancellation over the 20 precincts: an edge shared by two of them appears twice and is dropped, and the rest stitches into the outline. The precincts are topologically clean — every boundary vertex has an even number of edges, and the result is a single closed ring of 2,472 vertices.
- `hexes.geojson`: 12 coarse cells inside the enclave had `r: 0` and now have `r: 1`, so their cards no longer say *poza regionem*.

**Nowy Dwór is not a Koschneider village**, and including its precinct changes the region from "the 19 villages' precincts" to "the 19 plus the one they surround". It is drawn as a 20th village point and its card carries a tag saying it is not one of the 19.

**It has no German name in any source this project uses.** OSM carries no `name:de` or `old_name:de` on the place node; PRNG records no historical or variant name for it; the Polish Wikipedia article has no German interwiki and no *niem.* gloss. None was invented. The likely reason is in the article: the village was **formed in 1908**, when the last owner of the Nowodworski estate sold it to the Prussian colonisation commission — a 20th-century foundation, not one of the old Koschneider villages. That founding date is recorded in `hexinfo.json` with its source. If a German form turns up in Rink 1926, a Messtischblatt sheet or Sadurska 2022, add `de` to the village in `villages.geojson` and `hexinfo.json` and both the label and the card will pick it up.

### Known data limitations

- **The vector tiles stop at lon 17.815.** `koszn.pmtiles` and `dem.pmtiles` both cover 17.385–17.815 × 53.495–53.720. Two strips are supplied instead as client-side GeoJSON, east to 18.035 and west to 17.205 — `strip_land`, `strip_water`, `strip_road` and `strip_bld`, 3.1 MB raw and about 487 kB over the wire. The western one is drawn far coarser (no service roads or tracks, 9,000 m² minimum parcel, 16 m simplification) because it never leaves the edge of the screen — so Tuchola, Bladowo and Nowa Tuchola sit on drawn ground. **It is a stand-in, not a fix**: a GeoJSON source downloads whole on every visit while the tiles are read by byte range, there is no hillshade out there because the DEM stops at the same meridian, and buildings are limited to a 1.4 km circle around Tuchola because all 7,479 in the strip came to more than the entire tile set. The proper repair is `docs/rebuild-tiles-eastward.md`, after which these four files and their cloned layers can be deleted. The other neighbours are inside the coverage and sit on real basemap. Which ones are drawn follows a rule: `place=village` within the coverage carrying a population tag, on the eastern approach to Tuchola, plus Grochowo and Raciąż by request. That leaves out Bladowo (330) and Nowa Tuchola (*Neu Tuchel*, 110), which lie on the way but past the tile edge; only Tuchola itself is placed in the margin. Putting Tuchola in place needs the tiles rebuilt with the clip box extended east, on the project box. Step-by-step in `docs/rebuild-tiles-eastward.md`.
- The basemap is **modern OSM**, not a reconstruction of 1400–1945.
- Most buildings are tagged only `building=yes`. In Ciechocin, of 194 flagged buildings, 165 are `yes`; only a handful are typed as house, church, garage, etc.
- **No OSM height tags**; only 15 Ciechocin buildings have `levels`. 3D heights are mostly invented defaults by type. The 32 m tower is approximate. Since 30 November 2026 the card for a Ciechocin building also shows the surveyed floor count from BDOT10k where one covers it (180 buildings), but the 3D extrusions themselves still use the invented defaults.
- Many village fact fields are empty (for example Doręgowice, Jerzmionki, Obrowo first mention).
- Obręby are a modern cadastral proxy, not the historical region.
- The 1920–1939 border is approximate (150–300 m).
- Isometric paintings drift from geometry; some props are fictional atmosphere.
- `hexes.geojson` (789 cells) is a leftover coarse grid for fact attachment, not the live grid.

### File and repo layout (`/workspace/kosznajderia`)

There is no git repository in this working copy.

| Path | Role |
|---|---|
| `poc/` | **Source of the live app.** `index.html`, `app.js`, `app.css`, `style.js`, `worker.js` |
| `poc/lib/` | Vendored MapLibre, PMTiles, h3-js |
| `poc/fonts/` | EB Garamond glyph PBFs for the map |
| `poc/data/` | `koszn.pmtiles`, `dem.pmtiles`, `hexinfo.json`, `hexes.geojson`, heritage/villages/towns/lakes GeoJSON, plus `geo/` and `tc/` build inputs |
| `poc/site/` | Deploy snapshot of the Worker static assets (copy of the app + `/iso/`) |
| `iso/` | Isometric renderer, paintings, viewer, `data/scene.json`, detail-level samples in `iso/levels/` |
| `villages.csv`, `towns.csv` | Master village / town tables |
| `boundary/`, `heritage/`, `dem/`, `facts/`, `hist/` | Source data and historical georeferencing work |
| `data/` | OSM PBF extracts |
| `app/`, `web/` | Earlier prototypes; **not** what is deployed today |
| `BUSINESS_REQUIREMENTS.md` | This document (repo root). Also published as `/business-requirements.md` |

### Build scripts (high level)

1. `fetch_obreby.py` — cadastral precincts from ULDK.  
2. `poc/extract_poc.py` — OSM features from the two PBF extracts into `poc/osm_poc.pkl`.  
3. `poc/build_geojson.py` — layer GeoJSON under `poc/data/geo/` (Ciechocin features flagged `c=1`).  
4. `poc/build_tiles.sh` — tippecanoe → `poc/data/koszn.pmtiles` (z8–14).  
5. `poc/build_dem.py` — Copernicus raster → `dem.pmtiles`.  
6. `build_heritage.py` — NID + OSM heritage points.  
7. Hex info and villages are assembled into `poc/data/hexinfo.json` (see existing build helpers in `poc/`).  
8. Isometric: `iso/prepare_data.py` (and `prepare_data_patch.py`) write `scene.json`; `iso/render.html` + `iso/render.js` render the dimetric base (headless Chrome); paintings are produced separately and stored as images.

Deploy: upload the contents of `poc/site/` as Workers static assets with correct `Content-Type` per file, then PUT the `kosznajderia` script with the assets JWT and `run_worker_first: ['/data/*.pmtiles']`. Delete upload JWTs afterwards. Verify MIME types and Range 206.

---

## 7. Roadmap, open decisions, and next steps

### Already decided

- MapLibre, not another map engine.
- Ciechocin is the POC / showcase village.
- Hexes are H3, zoom-dependent, stable IDs, minimum about 5 m.
- Watercolor is the preferred painted style; pixel art was only a comparison.
- **Do not implement the full painted watercolor basemap yet** (27 November 2026).
- Only deploy to the `kosznajderia` Worker.

### Suggested next steps (when the owner asks)

1. Writable user markers and comments (D1, H3 ID + coordinates), including a simple moderation/identity plan. The read-only layer in §4.6 already fixes the schema and the UI; what is left is the store, identity and moderation.  
2. If and when painting is approved: start with the recommended mix (Level 1 countryside + Level 3 village centres), first village as a pace check, hex overlay via the affine transform.  
3. A sharper tiled isometric Ciechocin with hexes on `/iso/` (watercolor, geometry-guided, 20–30 overlapping tiles was the earlier plan for the village alone).  
4. Fill obvious fact gaps in `villages.csv` from sourced literature — never by invention.  
5. Better building types/heights where OSM or a surveyed source actually has them.  
6. A clearer historical “era” experience (time slider or period layers) — only after the owner defines what an era means here.

### Open questions

- What should a first version of comments and markers include (identity, moderation, public vs private, edits)?
- Should the educational 1400–1945 span appear as switchable era layers, and if so, which years and which sources?
- When, if ever, to replace or overlay the modern OSM basemap with watercolor or historical map sheets.
- Whether modern cadastral obręby remain an acceptable outline, or a historically sourced boundary should replace or accompany them.
- Official naming in UI and documents (Kosznajderia / Koschneiderei / spelling of this page’s title: use **Business requirements**).
- Is there a git host the successor should use? The current tree has no remotes.
- Product language defaults and how much German historical nomenclature to show besides the village names already in the data.

### Rules for a successor assistant

- Keep it simple.  
- Do not invent history. Cite sources already in the project, or mark new claims as needing a source.  
- Invented atmospheric details in paintings (animals, laundry, smoke, boats) must stay labelled as invented.  
- The same applies to the memory layer in §4.6, and more strictly: never attribute an invented quotation to a real book, author or archive. Invent the family letter, not the citation.  
- Deploy only to Worker `kosznajderia`. Never change the other named workers or the account subdomain.  
- After every deploy: check MIME types, check PMTiles Range 206, delete upload tokens.  
- Prefer editing `poc/` (and then refreshing `poc/site/`) rather than the older `app/` or `web/` trees.  
- Ciechocin stays the place for visual experiments unless the owner says otherwise.  
- The owner likes short, proactive progress updates on long tasks.

---

*End of handoff. For the live app, start at the main map URL above. For code, start at `/workspace/kosznajderia/poc/`.*
