This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
GeoFiddle is a client-side web application for plotting, sharing, and converting geometries using different formats and projections. No backend server is required - all processing happens in the browser. Live at https://geofiddle.com.
npm install # Install dependencies
npm start # Dev server with hot reload
npm test # Run all tests with coverage
npm run lint # Check code style
npm run lint:fix # Auto-fix linting issues
npm run build # Production build
npm run package # Full release (clean, build, copy static)Run a single test file:
npx jest tests/formats.test.jsRun tests matching a pattern:
npx jest -t "auto-detect"User Input → Views → ConvertModel → Core Logic → Google Maps
↓
URL State (Router)
ConvertModel (src/models/convert.js) is the central state holder:
text: raw input geometryformat: detected or selected formatprojection: detected or selected projection- Views listen to model changes and update accordingly
- formats.js: Parse and format geometries (GeoJSON, WKT, EWKT, DSV, Polyline)
- projections.js: Convert between WGS84 (EPSG:4326) and BNG (EPSG:27700)
- geofiddle-util.js: DSV parsing utilities
All geometry processing uses the Wicket library as intermediate representation.
ConvertFormView: Input textarea with format/projection selectorsConvertResultView: Output display with converted geometryGoogleMapView: Map rendering with geometry overlayTopBarView: Application header
The router (src/router.js) encodes format/projection/geometry in the URL hash for deep linking and sharing.
Formats: GeoJSON, WKT, EWKT, DSV, Polyline (precision 5 & 6)
Projections: WGS84 (lat/lon degrees), BNG (easting/northing meters)
Note: Polyline format only supports WGS84 projection.
ESLint enforces: 4-space indent, single quotes, semicolons required, Unix line endings.
Create PRIVATE.json in root with your API key:
{
"apiKey": "YOUR_API_KEY",
"mapId": "YOUR_MAP_ID"
}- wicket: WKT/GeoJSON parsing
- geodesy: Projection math (WGS84 ↔ BNG)
- backbone/jquery/lodash: MVC framework
- @material/*: UI components