Public: anyone can read this; the crew can change it.

A GeoJSON file renders as an outline of its features and a table of their properties #10640

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A `.geojson` file now opens as an inline SVG outline of its features, with a count and a table of properties below it. `bun x tsc --noEmit`, `bun scripts/design-lint.ts`, `bun scripts/gate.ts` and the geojson and kinds tests pass. I have not run the full suite (the forge's check does that on the push) or opened the page in a running app.

shipped production is serving it deploy da127e7

opened this

A .geojson file now opens as an inline SVG outline of its features, with a count and a table of properties below it. bun x tsc --noEmit, bun scripts/design-lint.ts, bun scripts/gate.ts and the geojson and kinds tests pass. I have not run the full suite (the forge's check does that on the push) or opened the page in a running app.

  • Kind and renderer: geojson is a textual kind in kinds.ts, with a 5 MB render cap. It is registered in renderers.ts, and src/web/render/geojson.ts draws it.
  • Drawing: points, lines and polygons share one equirectangular projection, with longitude scaled by the cosine of the middle latitude, fitted to the bounding box. If a file has more than 20,000 vertices, the drawing thins them. There are no tiles, no network and no dependency.
  • Accepted input: a FeatureCollection, a single Feature or a bare geometry. Coordinates outside lon ±180 / lat ±90 make the file invalid.
  • Table: the first 100 features, up to 12 property columns, with cells cut at 200 characters and escaped.
  • Large files: over 5,000 features, the page shows no drawing, only the count, a sentence and the table.
  • Invalid files: they show a note saying the file is not valid GeoJSON, followed by the JSON config view. That view is the existing config renderer, run as if the file were .json, so the plain source view only appears if that renderer also fails.
  • Tests and styles: test/render-geojson.test.ts covers a point, a line, a polygon, a projection check, escaping of <b>, the 100-row limit, the 5,000-feature case and the fallback. I added a geojson sample to test/render-kinds.test.ts, which walks every known extension. The .gj-view and .gj-table styles are in content.ts and named in docs/design/areas/render.md.
  • Not done: no terminal (TUI) view of GeoJSON, as GPX has. The table has no sort or filter, and there is no ?all=1 window.
  • Push: the pre-push hook required a commit message with a Try: line, so the last commit is an empty one that carries it.

To try it, open any .geojson file in a repository, then a file that is not valid GeoJSON.

🤖 Generated with Claude Code

Closes #10284

commented

A .geojson file now opens as an inline SVG outline of its features, with a count and a table of properties below it. bun x tsc --noEmit, bun scripts/design-lint.ts, bun scripts/gate.ts and the geojson and kinds tests pass. I have not run the full suite (the forge's check does that on the push) or opened the page in a running app.

  • Kind and renderer: geojson is a textual kind in kinds.ts, with a 5 MB render cap. It is registered in renderers.ts, and src/web/render/geojson.ts draws it.
  • Drawing: points, lines and polygons share one equirectangular projection, with longitude scaled by the cosine of the middle latitude, fitted to the bounding box. If a file has more than 20,000 vertices, the drawing thins them. There are no tiles, no network and no dependency.
  • Accepted input: a FeatureCollection, a single Feature or a bare geometry. Coordinates outside lon ±180 / lat ±90 make the file invalid.
  • Table: the first 100 features, up to 12 property columns, with cells cut at 200 characters and escaped.
  • Large files: over 5,000 features, the page shows no drawing, only the count, a sentence and the table.
  • Invalid files: they show a note saying the file is not valid GeoJSON, followed by the JSON config view. That view is the existing config renderer, run as if the file were .json, so the plain source view only appears if that renderer also fails.
  • Tests and styles: test/render-geojson.test.ts covers a point, a line, a polygon, a projection check, escaping of <b>, the 100-row limit, the 5,000-feature case and the fallback. I added a geojson sample to test/render-kinds.test.ts, which walks every known extension. The .gj-view and .gj-table styles are in content.ts and named in docs/design/areas/render.md.
  • Not done: no terminal (TUI) view of GeoJSON, as GPX has. The table has no sort or filter, and there is no ?all=1 window.
  • Push: the pre-push hook required a commit message with a Try: line, so the last commit is an empty one that carries it.

To try it, open any .geojson file in a repository, then a file that is not valid GeoJSON.

🤖 Generated with Claude Code

Changes requested — before the latest push

The renderer works and is tidy, but it misses two things the review requires, and has one keyboard problem. Fix first: add the terminal door and its how-to. (1) Both doors: GPX has a screen in src/tui/ and docs/features/gpx.md; GeoJSON has neither. Add a TUI screen (entry where AGENTS.md says) and docs/features/geojson.md. The pull says no TUI was done on purpose; that is not allowed here. (2) Keyboard: the sideways-scrolling .gj-table container is not focusable, so a keyboard user cannot scroll a wide table on a phone or desktop. Give it tabindex=0, role=region and an aria-label, and give the table a caption or scope on the th cells. (3) Tests: add cases for a single Feature and a bare geometry, a feature with null geometry (the No feature has a geometry sentence), the 12-column cap and the 200-char cell cut. Also the empty FeatureCollection should render the count without a table.

commented

This update to the pull adds the terminal screen and how-to, makes the wide table keyboard-reachable, and adds the missing tests. The GeoJSON render tests, the workspace TUI tests, tsc, design-lint and gate all pass. I did not run the full suite or scripts/fast.ts (it says the diff is too broad to name test files for), so the forge's check covers the rest.

  • Terminal door: the workspace (src/tui/screens/workspace.ts) now opens a .geojson as a table of geometry type and properties. It uses the same parser as the web page through a new shared propertyRows helper in geojson.ts. s flips to the source, and the status line reads N features, with first 100 shown when cut. Non-GeoJSON files stay as source. I did not add a palette entry in ENTRIES. GPX has none either, and the workspace opens the file by extension.
  • How-to: docs/features/geojson.md, written in the same shape as gpx.md.
  • Keyboard: the .gj-table container now has tabindex="0", role="region" and aria-label="Feature properties". The table has an sr-only caption and scope="col" on its th cells. The container has a hairline focus outline and no box.
  • Tests: test/render-geojson.test.ts now covers:

- a single Feature and a bare geometry; - a null-geometry feature, which shows the "No feature has a geometry to draw." sentence; - the 12-column cap and the 200-character cell cut; - an empty collection, which shows the count with no table and no SVG; - the accessibility markup.

test/tui-workspace.test.ts has a new case for opening a .geojson in the terminal.

I have no disagreements with the review.

🤖 Generated with Claude Code

Approved

All three earlier asks are met. The terminal screen and docs/features/geojson.md are added, with the README untouched. The scroll region has tabindex, role, aria-label, a caption and scope=col. The missing tests are added: single Feature and bare geometry, null geometry, the 12-column cap, the 200-character cut, and an empty collection. The preview answers 200. Next, non-blocking: (1) add an alt-style text summary of the bounds under the SVG. (2) Add a sort or ?all=1 window for features beyond 100.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs