One line: the smallest, most demo-able project, an interactive web app that takes warped/distorted geographic coordinates, estimates the distortion field, and iteratively "un-warps" them back onto a clean map projection, with an optional LLM/image layer that narrates and renders the fix.
Honest status up front. This is a single-file interactive MVP (server.py, 457 LOC) + a browser front-end, not a trained model. The distortion-and-correction math is real and deterministic (it runs); the distortion itself is a synthetic, parametric model (a "Mercator repair" profile with curve/shear knobs), so it demonstrates the method on controllable distortion rather than on real misregistered maps. The OpenAI calls (/api/correct text analysis, /api/render-map image) are an optional flavor layer; without a key it falls back to a deterministic summary. In short: "a working interactive demo of distortion estimation + fixed-point correction on a parametric distortion model; the engine is real, the distortion is synthetic, and the LLM layer is optional polish."
Geospatial coordinates arrive distorted all the time: bad georeferencing, projection mismatches, sensor warp. MapFix is the interactive teaching/demo version of "detect and undo that distortion." You give it points, it models the distortion as a smooth field, inverts it by fixed-point iteration, and shows you the residual error and how much area it recovered, live in the browser. It's the lightweight, clickable face of the same distortion-aware theme that runs through sat-splat (camera Jacobians) and darkvessel (sensor co-registration).
input points ──► normalize to [0,1] (bounds_for / normalize_point)
│
├─► apply_distortion: synthetic warp via distortion_vector(curve, shear, noise, seed)
▼
correct_point: fixed-point iteration to invert the distortion
│
├─► gradient_at: finite-difference the distortion field (Jacobian probe)
▼
metrics_for / coordinate_rows: residual px, % area recovered, per-point table
│
└─► /api/correct (OpenAI text analysis) + /api/render-map (image) [optional]
server.py)PROJECTION_TUNING — named distortion profiles, e.g. "mercator": {curve: 0.74, shear: 0.42}. These parameterize the synthetic warp.bounds_for / normalize_point / denormalize_point — map raw lon/lat into a unit square and back, so the distortion math is scale-free.distortion_vector(point, noise, projection, seed) — the forward distortion model: a smooth field combining a shear term (linear in the off-axis coordinate) and a curve term (a sinusoidal wave), scaled by the projection's curve/shear and a noise level. This is "how the map got warped."apply_distortion — adds the distortion vector to a clean point (produces the warped input).correct_point — the inverse: a fixed-point iteration that repeatedly subtracts the estimated distortion at the current estimate to recover the original clean point (estimate ← raw − distortion(estimate)), the standard way to invert a contraction map.gradient_at — finite-differences the distortion field in x and y (a numerical 2×2 Jacobian probe), used for diagnostics / convergence.metrics_for — residual statistics: mean residual in pixels, % area recovered.coordinate_rows — a per-point table (clean vs raw vs corrected, residual).build_correction — orchestrates the whole pipeline for a request./api/correct and /api/render-map — the optional OpenAI layer: a concise geospatial diagnosis and a rendered clean-projection preview. default_ai_summary is the no-key deterministic fallback (so it works offline).Inverting a distortion by fixed-point iteration. If the warp is raw = clean + D(clean) for a small smooth field D, you can't solve for clean directly, but if D is a contraction you can iterate clean ← raw − D(clean_estimate) until it converges. That's exactly correct_point. The gradient_at finite-difference gives the local Jacobian of D, which both diagnoses convergence and connects conceptually to the analytic Jacobians in sat-splat (there, derived in closed form; here, probed numerically).
The honest limitation: the distortion is a known parametric model the app both applies and inverts, so it's a controlled demonstration, not a learned correction of real-world warp. That's the right scope for an interactive MVP.
| Piece | Status |
|---|---|
| Distortion model + fixed-point correction + metrics | Real, deterministic, runs |
| Interactive browser demo (GitHub Pages) | Real, live |
| OpenAI text + image layer | Real but optional (falls back without a key) |
| Correction of real misregistered maps | Not yet (distortion is synthetic/parametric) |