Skip to content

Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)

Integrate map selector with validated CONUS bounds and attribution

Cinna Davis90030954abde
diff --cc pyproject.toml
index 256b512,77da516..6ee112f
--- a/pyproject.toml
+++ b/pyproject.toml
@@@ -6,8 -6,7 +6,8 @@@ build-backend = "setuptools.build_meta
name = "dopplergeist"
version = "0.1.0"
description = "Reproducible physics-based aircraft acoustic geolocation"
-license = {text = "MIT"}
+license = "PolyForm-Noncommercial-1.0.0"
- license-files = ["LICENSE", "licenses/MIT-legacy.txt"]
++license-files = ["LICENSE", "licenses/MIT-legacy.txt", "src/dopplergeist/web/leaflet-license.txt"]
requires-python = ">=3.11"
dependencies = ["numpy", "scipy", "pandas", "soundfile", "pyproj", "rasterio", "matplotlib", "requests", "pyarrow"]
@@@ -21,7 -20,7 +21,7 @@@ dopplergeist = "dopplergeist.cli:main
where = ["src"]
[tool.setuptools.package-data]
--"dopplergeist.web" = ["*.html", "*.js", "*.css"]
++"dopplergeist.web" = ["*.html", "*.js", "*.css", "leaflet-license.txt"]
[tool.pytest.ini_options]
testpaths = ["tests"]
diff --cc src/dopplergeist/contracts.py
index c2c3295,834af0f..e4a69b3
--- a/src/dopplergeist/contracts.py
+++ b/src/dopplergeist/contracts.py
@@@ -169,8 -169,8 +169,8 @@@ def validate_request(value)
_text(window["source_detail"], "source_detail")
request["time_window"] = window
search = _record(request.get("search", {"coverage": "conus"}), ("coverage",), ("bounds_wsen",))
- if search["coverage"] not in {"conus", "custom", "bbox"}:
- raise ValueError("Unsupported coverage; version one supports CONUS or custom bounding box")
+ if search["coverage"] != "conus":
- raise ValueError("Version one supports declared CONUS coverage only")
++ raise ValueError("Version one supports CONUS coverage; supply bounds_wsen for a CONUS subset")
if "bounds_wsen" in search:
bounds = search["bounds_wsen"]
if not isinstance(bounds, list) or len(bounds) != 4:
@@@ -179,6 -179,6 +179,8 @@@
_number(number, "bounds_wsen", -180 if i % 2 == 0 else -90, 180 if i % 2 == 0 else 90)
if bounds[0] >= bounds[2] or bounds[1] >= bounds[3]:
raise ValueError("Bounds must be increasing; antimeridian crossing is unsupported")
++ if not (-125 <= bounds[0] < bounds[2] <= -66 and 24 <= bounds[1] < bounds[3] <= 50):
++ raise ValueError("bounds_wsen must stay within CONUS: west -125, south 24, east -66, north 50")
request["search"] = search
return request
diff --cc src/dopplergeist/service.py
index 75d2959,9fc5c4e..59ab60e
--- a/src/dopplergeist/service.py
+++ b/src/dopplergeist/service.py
@@@ -85,7 -85,8 +85,9 @@@ class Handler(BaseHTTPRequestHandler)
raise KeyError("Unknown artifact")
return self._file(path, download=path.suffix not in {".png", ".svg"})
if self.command == "GET":
- asset = {"/": "index.html", "/app.js": "app.js", "/style.css": "style.css"}.get(urlsplit(self.path).path)
+ asset = {"/": "index.html", "/app.js": "app.js", "/style.css": "style.css",
- "/leaflet.js": "leaflet.js", "/leaflet.css": "leaflet.css"}.get(urlsplit(self.path).path)
++ "/leaflet.js": "leaflet.js", "/leaflet.css": "leaflet.css",
++ "/leaflet-license.txt": "leaflet-license.txt"}.get(urlsplit(self.path).path)
if asset:
return self._file(files("dopplergeist.web").joinpath(asset))
raise KeyError("Unknown endpoint")
@@@ -95,7 -96,7 +97,7 @@@
self.send_header("Content-Type", mimetypes.guess_type(str(path))[0] or "application/octet-stream")
self.send_header("Content-Length", str(path.stat().st_size))
self.send_header("X-Content-Type-Options", "nosniff")
- self.send_header("Content-Security-Policy", "default-src 'self'; img-src 'self'; style-src 'self'; script-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'")
- self.send_header("Content-Security-Policy", "default-src 'self'; img-src 'self' data: https://*.tile.openstreetmap.org https://tile.openstreetmap.org; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'")
++ self.send_header("Content-Security-Policy", "default-src 'self'; img-src 'self' data: https://tile.openstreetmap.org; style-src 'self'; script-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'")
if download:
self.send_header("Content-Disposition", f'attachment; filename="{path.name.replace(chr(34), "")}"')
self.end_headers()
diff --cc src/dopplergeist/web/app.js
index 771ff6a,5e49f09..f54affb
--- a/src/dopplergeist/web/app.js
+++ b/src/dopplergeist/web/app.js
@@@ -61,7 -61,11 +61,11 @@@ function render(value)
const card = node('div', undefined, 'candidate');
card.append(node('strong', 'Search & data coverage'));
const bounds = coverage.requested_area?.bounds_wsen;
- card.append(node('p', bounds ? `Requested CONUS subset (west, south, east, north): ${bounds.join(', ')}` : 'Requested area: contiguous United States (CONUS)'));
+ const isFullConus = bounds && bounds[0] === -125 && bounds[1] === 24 && bounds[2] === -66 && bounds[3] === 50;
+ const boundsLabel = bounds
- ? (isFullConus ? 'Requested area: Contiguous United States (CONUS)' : `Requested search bounds (west, south, east, north): ${bounds.map(x => typeof x === 'number' ? x.toFixed(2) : x).join(', ')}`)
++ ? (isFullConus ? 'Requested area: Contiguous United States (CONUS)' : `Requested CONUS subset (west, south, east, north): ${bounds.map(x => typeof x === 'number' ? x.toFixed(6) : x).join(', ')}`)
+ : 'Requested area: Contiguous United States (CONUS)';
+ card.append(node('p', boundsLabel));
card.append(node('p', `Search ${coverage.search_complete ? 'complete' : 'incomplete'} · Data ${coverage.data_status}`));
for (const limitation of coverage.limitations || []) card.append(node('p', limitation));
if (coverage.missing_data?.length) card.append(node('p', `Missing: ${coverage.missing_data.join('; ')}`));
@@@ -125,7 -129,18 +129,10 @@@ $('upload-form').addEventListener('subm
const start = $('start').value, end = $('end').value;
if (end && !start) { $('upload-error').textContent = 'Enter the earliest recording start as well.'; return; }
if (start && end && end < start) { $('upload-error').textContent = 'The latest start must be at or after the earliest start.'; return; }
- const request = {schema_version: 1, search: {coverage: 'conus'}};
- const w = parseFloat($('bbox-w')?.value || '-125.0');
- const s = parseFloat($('bbox-s')?.value || '24.0');
- const e = parseFloat($('bbox-e')?.value || '-66.0');
- const n = parseFloat($('bbox-n')?.value || '50.0');
- const isConus = (Math.abs(w - (-125.0)) < 0.01 && Math.abs(s - 24.0) < 0.01 && Math.abs(e - (-66.0)) < 0.01 && Math.abs(n - 50.0) < 0.01);
- const request = {
- schema_version: 1,
- search: {
- coverage: isConus ? 'conus' : 'custom',
- bounds_wsen: [w, s, e, n]
- }
- };
++ let bounds;
++ try { bounds = readSearchBounds(); }
++ catch (error) { $('upload-error').textContent = error.message; return; }
++ const request = {schema_version: 1, search: {coverage: 'conus', bounds_wsen: bounds}};
if (start) {
request.time_window = {start_utc: start + 'Z', end_utc: (end || start) + 'Z', source: 'user'};
if ($('time-source').value.trim()) request.time_window.source_detail = $('time-source').value.trim();
@@@ -161,3 -176,198 +168,136 @@@ api('/api/capabilities').then(value =>
renderRecent();
const savedJob = new URLSearchParams(location.search).get('job');
if (savedJob && /^[0-9a-f]{32}$/.test(savedJob)) selectJob(savedJob);
+
-// Interactive World Map & Boundary Box Selector (Defaults to CONUS, Drag to draw)
-const CONUS_BOUNDS = [-125.0, 24.0, -66.0, 50.0];
++// The automatic pipeline currently supports CONUS and explicit subsets of it.
++const CONUS_BOUNDS = [-125, 24, -66, 50];
++const BOUND_INPUTS = ['bbox-w', 'bbox-s', 'bbox-e', 'bbox-n'];
+
-function wrapLng(lng) {
- return (((lng + 180) % 360 + 360) % 360) - 180;
++function validateSearchBounds(bounds) {
++ if (bounds.length !== 4 || bounds.some(value => !Number.isFinite(value))) {
++ throw new Error('Enter all four search coordinates as finite numbers.');
++ }
++ const [w, s, e, n] = bounds;
++ if (w >= e || s >= n) {
++ throw new Error('West must be less than east and south less than north. Antimeridian crossing is unsupported.');
++ }
++ if (w < CONUS_BOUNDS[0] || s < CONUS_BOUNDS[1] || e > CONUS_BOUNDS[2] || n > CONUS_BOUNDS[3]) {
++ throw new Error('Choose an area within CONUS: west −125°, south 24°, east −66°, north 50°.');
++ }
++ return bounds;
+ }
-function clampLat(lat) {
- return Math.max(-85.0, Math.min(85.0, lat));
++
++function readSearchBounds() {
++ const values = BOUND_INPUTS.map(id => $(id).value.trim());
++ if (values.some(value => value === '')) throw new Error('Enter all four search coordinates.');
++ return validateSearchBounds(values.map(Number));
+ }
-function normalizeBounds(w, s, e, n) {
- let nw = wrapLng(w);
- let ne = wrapLng(e);
- if (nw > ne) [nw, ne] = [ne, nw];
- let ns = clampLat(Math.min(s, n));
- let nn = clampLat(Math.max(s, n));
- if (ne - nw < 0.05) ne = Math.min(180, nw + 0.1);
- if (nn - ns < 0.05) nn = Math.min(85, ns + 0.1);
- return [nw, ns, ne, nn];
++
++function boundsMessage(message = '') {
++ $('bounds-error').textContent = message;
++ $('bounds-error').hidden = !message;
+ }
+
-function normalizeDragBounds(p1, p2) {
- const s = clampLat(Math.min(p1.lat, p2.lat));
- const n = clampLat(Math.max(p1.lat, p2.lat));
- const rawMin = Math.min(p1.lng, p2.lng);
- const rawMax = Math.max(p1.lng, p2.lng);
- const width = Math.min(360, Math.max(0.05, rawMax - rawMin));
++function initMap() {
++ let map, rectangle, preview, drawOrigin, panStart;
++ let selectedBounds = CONUS_BOUNDS.slice();
+
- let w = wrapLng(rawMin);
- let e = w + width;
- if (e > 180) {
- if (w < 180) {
- e = 180;
- } else {
- w = -180;
- e = Math.min(180, -180 + width);
++ function setBounds(bounds, fit = false, updateInputs = true) {
++ selectedBounds = validateSearchBounds(bounds.slice());
++ if (updateInputs) BOUND_INPUTS.forEach((id, index) => { $(id).value = String(selectedBounds[index]); });
++ if (map) {
++ const [w, s, e, n] = selectedBounds;
++ const corners = [[s, w], [n, e]];
++ if (rectangle) rectangle.setBounds(corners);
++ else rectangle = L.rectangle(corners, {
++ color: '#baf078', weight: 2, fillColor: '#baf078', fillOpacity: 0.18, interactive: false
++ }).addTo(map);
++ if (fit) map.fitBounds(corners, {padding: [20, 20]});
+ }
++ boundsMessage();
+ }
- if (e - w < 0.05) e = Math.min(180, w + 0.1);
- return [w, s, e, n];
-}
+
-let map, rectGroup;
-let currentW = CONUS_BOUNDS[0], currentS = CONUS_BOUNDS[1], currentE = CONUS_BOUNDS[2], currentN = CONUS_BOUNDS[3];
-let isDrawing = false, drawOrigin = null, tempRect = null;
-let isPanning = false, panStart = null;
++ BOUND_INPUTS.forEach(id => {
++ $(id).addEventListener('input', () => {
++ try { setBounds(readSearchBounds(), false, false); }
++ catch (error) { boundsMessage(error.message); }
++ });
++ });
++ $('reset-bounds').addEventListener('click', () => setBounds(CONUS_BOUNDS, true));
+
-function initMap() {
+ if (typeof L === 'undefined') {
- setTimeout(initMap, 50);
++ $('map-container').hidden = true;
++ $('map-status').textContent = 'The map could not load. Enter search coordinates below.';
+ return;
+ }
- const mapElem = $('map');
- if (!mapElem) return;
-
+ map = L.map('map', {
- center: [38.5, -96.0],
- zoom: 4,
- worldCopyJump: true,
- attributionControl: false
++ center: [38.5, -96], zoom: 4,
++ maxBounds: [[20, -130], [54, -61]], maxBoundsViscosity: 1
+ });
-
+ L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
- maxZoom: 18
++ maxZoom: 18, noWrap: true,
++ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
++ }).on('tileerror', () => {
++ $('map-status').textContent = 'Map tiles are unavailable. Coordinates and the selection rectangle still work.';
+ }).addTo(map);
++ map.dragging.disable(); // Left-drag draws; right-drag or Shift-drag pans.
++ setBounds(selectedBounds, true);
+
- map.dragging.disable(); // Left-drag draws bounding box
-
- // Right-click drag (or Shift + Left-click drag) to pan the map
+ const container = map.getContainer();
- container.addEventListener('contextmenu', e => e.preventDefault());
-
- container.addEventListener('mousedown', e => {
- if (e.button === 2 || (e.button === 0 && e.shiftKey)) {
- isPanning = true;
- panStart = { x: e.clientX, y: e.clientY };
- container.style.cursor = 'grab';
- e.preventDefault();
- e.stopPropagation();
++ container.addEventListener('contextmenu', event => event.preventDefault());
++ container.addEventListener('mousedown', event => {
++ if (event.button === 2 || (event.button === 0 && event.shiftKey)) {
++ panStart = {x: event.clientX, y: event.clientY};
++ container.style.cursor = 'grabbing';
++ event.preventDefault();
++ event.stopPropagation();
+ }
+ });
-
- window.addEventListener('mousemove', e => {
- if (!isPanning || !panStart) return;
- const dx = e.clientX - panStart.x;
- const dy = e.clientY - panStart.y;
- panStart = { x: e.clientX, y: e.clientY };
- map.panBy([-dx, -dy], { animate: false });
- });
-
- window.addEventListener('mouseup', e => {
- if (isPanning) {
- isPanning = false;
- panStart = null;
- container.style.cursor = '';
- }
- if (isDrawing && tempRect) {
- map.removeLayer(tempRect);
- tempRect = null;
- isDrawing = false;
- drawOrigin = null;
- }
++ window.addEventListener('mousemove', event => {
++ if (!panStart) return;
++ map.panBy([panStart.x - event.clientX, panStart.y - event.clientY], {animate: false});
++ panStart = {x: event.clientX, y: event.clientY};
+ });
+
- function updateInputs() {
- $('bbox-w').value = currentW.toFixed(2);
- $('bbox-s').value = currentS.toFixed(2);
- $('bbox-e').value = currentE.toFixed(2);
- $('bbox-n').value = currentN.toFixed(2);
- }
-
- function renderRectLayers(w, s, e, n) {
- if (!rectGroup) {
- rectGroup = L.layerGroup().addTo(map);
- }
- rectGroup.clearLayers();
- [-720, -360, 0, 360, 720].forEach(offset => {
- L.rectangle([[s, w + offset], [n, e + offset]], {
- color: '#baf078',
- weight: 2,
- fillColor: '#baf078',
- fillOpacity: 0.18,
- interactive: false
- }).addTo(rectGroup);
- });
- }
-
- function setBounds(w, s, e, n, fit) {
- [currentW, currentS, currentE, currentN] = normalizeBounds(w, s, e, n);
- updateInputs();
- renderRectLayers(currentW, currentS, currentE, currentN);
- if (fit) {
- map.fitBounds([[currentS, currentW], [currentN, currentE]], { padding: [20, 20] });
- }
++ function clearDrawing() {
++ if (preview) map.removeLayer(preview);
++ preview = null;
++ drawOrigin = null;
+ }
-
- setBounds(...CONUS_BOUNDS, true);
- setTimeout(() => map.invalidateSize(), 150);
-
- // Coordinate input changes with auto-modulo normalization
- ['bbox-w', 'bbox-s', 'bbox-e', 'bbox-n'].forEach(id => {
- $(id).addEventListener('change', () => {
- const w = parseFloat($('bbox-w').value);
- const s = parseFloat($('bbox-s').value);
- const e = parseFloat($('bbox-e').value);
- const n = parseFloat($('bbox-n').value);
- if (!isNaN(w) && !isNaN(s) && !isNaN(e) && !isNaN(n)) {
- setBounds(w, s, e, n, false);
- }
- });
++ window.addEventListener('mouseup', () => {
++ panStart = null;
++ container.style.cursor = '';
++ // Releasing outside the map cancels an unfinished selection.
++ clearDrawing();
++ });
++ window.addEventListener('blur', () => {
++ panStart = null;
++ container.style.cursor = '';
++ clearDrawing();
+ });
+
- // Left-click drag anywhere on the map draws a new bounding box
- map.on('mousedown', e => {
- if (e.originalEvent.button !== 0 || e.originalEvent.shiftKey) return;
- isDrawing = true;
- drawOrigin = e.latlng;
- if (tempRect) map.removeLayer(tempRect);
- tempRect = L.rectangle([drawOrigin, drawOrigin], {
- color: '#baf078',
- weight: 2,
- dashArray: '4, 4',
- fillColor: '#baf078',
- fillOpacity: 0.25,
- interactive: false
++ map.on('mousedown', event => {
++ if (event.originalEvent.button !== 0 || event.originalEvent.shiftKey) return;
++ drawOrigin = event.latlng;
++ preview = L.rectangle([drawOrigin, drawOrigin], {
++ color: '#baf078', weight: 2, dashArray: '4, 4', fillOpacity: 0.25, interactive: false
+ }).addTo(map);
+ });
-
- map.on('mousemove', e => {
- if (!isDrawing || !drawOrigin || !tempRect) return;
- tempRect.setBounds([drawOrigin, e.latlng]);
++ map.on('mousemove', event => {
++ if (preview && drawOrigin) preview.setBounds([drawOrigin, event.latlng]);
+ });
-
- map.on('mouseup', e => {
- if (!isDrawing || !drawOrigin || !tempRect) return;
- const current = e.latlng;
- map.removeLayer(tempRect);
- tempRect = null;
- isDrawing = false;
-
- const [w, s, e_coord, n] = normalizeDragBounds(drawOrigin, current);
- drawOrigin = null;
-
- // Only update if dragged area is meaningful (> 0.05 deg)
- if (e_coord - w > 0.05 && n - s > 0.05) {
- setBounds(w, s, e_coord, n, false);
- }
++ map.on('mouseup', event => {
++ if (!drawOrigin || !preview) return;
++ const origin = drawOrigin;
++ clearDrawing();
++ if (origin.equals(event.latlng)) return;
++ const bounds = [Math.min(origin.lng, event.latlng.lng), Math.min(origin.lat, event.latlng.lat),
++ Math.max(origin.lng, event.latlng.lng), Math.max(origin.lat, event.latlng.lat)]
++ .map(value => Number(value.toFixed(6)));
++ try { setBounds(bounds); }
++ catch (error) { boundsMessage('Search area was not changed. ' + error.message); }
+ });
+ }
+
-if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', initMap);
-} else {
- initMap();
-}
++if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initMap);
++else initMap();
diff --cc src/dopplergeist/web/index.html
index b499d69,d34967d..7cfba27
--- a/src/dopplergeist/web/index.html
+++ b/src/dopplergeist/web/index.html
@@@ -4,12 -4,13 +4,27 @@@
<body>
<header><a href="/" class="brand">DOPPLER<span>GEIST</span></a><span class="tag">Aircraft sound → location evidence</span></header>
<main>
- <section class="intro"><p class="eyebrow">ACOUSTIC GEOLOCATION</p><h1>Find the flights.<br>Test the location.</h1><p>Upload a recording to discover aircraft Doppler curves, search historical flight tracks, and inspect the evidence. When the evidence cannot support a location, the result is inconclusive.</p><p class="scope">Search coverage: <strong>contiguous United States (CONUS)</strong>. Location goal: 100–500 m or better preferred; up to 1,000 m acceptable. Nationwide accuracy remains under evaluation.</p></section>
-<section class="intro"><p class="eyebrow">ACOUSTIC GEOLOCATION</p><h1>Find the flights.<br>Test the location.</h1><p>Upload a recording to discover aircraft Doppler curves, search historical flight tracks, and inspect the evidence. When the evidence cannot support a location, the result is inconclusive.</p><p class="scope">Search coverage: <strong>contiguous United States (CONUS) or custom bounding box</strong>. Location goal: 100–500 m or better preferred; up to 1,000 m acceptable. Nationwide accuracy remains under evaluation.</p></section>
++<section class="intro"><p class="eyebrow">ACOUSTIC GEOLOCATION</p><h1>Find the flights.<br>Test the location.</h1><p>Upload a recording to discover aircraft Doppler curves, search historical flight tracks, and inspect the evidence. When the evidence cannot support a location, the result is inconclusive.</p><p class="scope">Search coverage: <strong>contiguous United States (CONUS), including smaller selected areas</strong>. Location goal: 100–500 m or better preferred; up to 1,000 m acceptable. Nationwide accuracy remains under evaluation.</p></section>
<div class="layout">
<section class="panel" aria-labelledby="upload-heading"><h2 id="upload-heading">New analysis</h2><form id="upload-form">
<p id="data-setup" class="notice" hidden></p>
<label class="drop" for="audio"><span class="upload-symbol" aria-hidden="true">↑</span><strong>Choose an MP3 recording</strong><span id="file-label">Your original file is preserved with the job.</span><input id="audio" name="audio" type="file" accept=".mp3,audio/mpeg,.wav,.flac,.m4a,.ogg" required></label>
<fieldset><legend>When did the recording start?</legend><p class="help">Enter UTC, including the date. A window is allowed. File creation and upload times do not establish recording time. Leave blank if unknown; analysis will request this evidence before searching.</p><label for="start">Earliest start (UTC)</label><input id="start" type="datetime-local" step="1"><label for="end">Latest start (UTC)</label><input id="end" type="datetime-local" step="1"><label for="time-source">How is this time known? <span class="muted">Optional</span></label><input id="time-source" type="text" maxlength="500" placeholder="For example, recorder clock synchronized before recording"></fieldset>
-<fieldset style="max-width:100%;overflow:hidden;"><legend>Search Region & Boundaries</legend><p class="help">Left-click &amp; drag anywhere on the map to draw your search area. Right-click (or Shift-drag) to pan. Scroll to zoom.</p><div id="map-container" style="width:100%;max-width:100%;height:260px;overflow:hidden;border-radius:8px;border:1px solid var(--edge);margin-bottom:10px;position:relative;"><div id="map" style="width:100%;height:100%;max-width:100%;"></div></div><div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;font-size:11px;"><div><label style="margin:0 0 2px;">West (Min Lon)</label><input id="bbox-w" type="number" step="0.01" style="padding:6px;font-size:12px;"></div><div><label style="margin:0 0 2px;">East (Max Lon)</label><input id="bbox-e" type="number" step="0.01" style="padding:6px;font-size:12px;"></div><div><label style="margin:0 0 2px;">South (Min Lat)</label><input id="bbox-s" type="number" step="0.01" style="padding:6px;font-size:12px;"></div><div><label style="margin:0 0 2px;">North (Max Lat)</label><input id="bbox-n" type="number" step="0.01" style="padding:6px;font-size:12px;"></div></div></fieldset>
++<fieldset class="search-region">
++<legend>Search area</legend>
++<p class="help">Choose all of CONUS or a smaller area. Enter coordinates, or left-drag on the map to draw a box. Right-drag or Shift-drag pans; scroll zooms. Areas outside CONUS and antimeridian crossings are unsupported.</p>
++<div id="map-container"><div id="map" aria-label="Search area map"></div></div>
++<p id="map-status" class="help" role="status"></p>
++<div class="bounds-grid">
++<div><label for="bbox-w">West longitude</label><input id="bbox-w" type="number" step="any" min="-125" max="-66" value="-125" required></div>
++<div><label for="bbox-e">East longitude</label><input id="bbox-e" type="number" step="any" min="-125" max="-66" value="-66" required></div>
++<div><label for="bbox-s">South latitude</label><input id="bbox-s" type="number" step="any" min="24" max="50" value="24" required></div>
++<div><label for="bbox-n">North latitude</label><input id="bbox-n" type="number" step="any" min="24" max="50" value="50" required></div>
++</div>
++<p id="bounds-error" class="validation-error" role="alert" hidden></p>
++<button id="reset-bounds" class="secondary" type="button">Reset to CONUS</button>
++<p class="help"><a href="/leaflet-license.txt">Leaflet license</a>. Map tiles &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors.</p>
++</fieldset>
<p id="limits" class="help"></p><button id="submit" type="submit">Upload &amp; analyze <span aria-hidden="true">→</span></button><p id="upload-error" role="alert"></p>
</form></section>
<section class="panel results" aria-labelledby="results-heading"><div class="section-row"><h2 id="results-heading">Analysis</h2><button id="cancel" class="secondary" hidden>Stop job</button><button id="resume" class="secondary" hidden>Resume job</button></div><div id="empty"><div class="wave" aria-hidden="true">∿∿∿</div><h3>Your evidence will appear here</h3><p>Detected curves, location hypotheses, uncertainty, and downloadable artifacts stay attached to each job.</p></div><div id="job" hidden><p id="job-id" class="mono"></p><div class="section-row"><strong id="status" role="status" aria-live="polite"></strong><span id="stage" class="muted"></span></div><progress id="progress" max="1" value="0" aria-label="Analysis progress"></progress><p id="message"></p><p id="required" class="notice" hidden></p><div id="coverage"></div><div id="candidates"></div><div id="events"></div><div id="diagnostics"></div><details id="downloads"><summary>Download run artifacts</summary><ul id="artifacts"></ul></details><p id="connection" role="alert"></p></div></section>
diff --cc src/dopplergeist/web/leaflet-license.txt
index 0000000,0000000..7b41f20
new file mode 100644
--- /dev/null
+++ b/src/dopplergeist/web/leaflet-license.txt
@@@ -1,0 -1,0 +1,26 @@@
++BSD 2-Clause License
++
++Copyright (c) 2010-2023, Volodymyr Agafonkin
++Copyright (c) 2010-2011, CloudMade
++All rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions are met:
++
++1. Redistributions of source code must retain the above copyright notice, this
++ list of conditions and the following disclaimer.
++
++2. Redistributions in binary form must reproduce the above copyright notice,
++ this list of conditions and the following disclaimer in the documentation
++ and/or other materials provided with the distribution.
++
++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
++AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
++SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
++CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --cc src/dopplergeist/web/style.css
index 68dbd8c,f36df56..82088d3
--- a/src/dopplergeist/web/style.css
+++ b/src/dopplergeist/web/style.css
@@@ -1,1 -1,4 +1,11 @@@
:root{color-scheme:dark;--bg:#101719;--panel:#192326;--edge:#334247;--muted:#a6b8bd;--accent:#baf078;--ink:#f3f8f5;font-family:Inter,ui-sans-serif,system-ui,sans-serif;font-size:15px}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink)}header{min-height:85px;display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid var(--edge);padding:20px max(6vw,24px)}a{color:var(--accent);text-underline-offset:3px}.brand{font-weight:850;font-size:21px;letter-spacing:.04em;text-decoration:none;color:var(--ink)}.brand span{color:var(--accent)}.tag,.muted,.help,footer{color:var(--muted)}.tag{font-size:13px}main{max-width:1350px;margin:auto;padding:52px max(6vw,24px) 24px}.intro{max-width:820px;margin-bottom:36px}.eyebrow{color:var(--accent);font-size:11px;font-weight:700;letter-spacing:.18em}h1{font-size:clamp(34px,5vw,58px);line-height:1.04;letter-spacing:-.045em;margin:18px 0 22px}.intro>p:not(.eyebrow){font-size:16px;line-height:1.65;color:#bccbd0}.intro .scope{font-size:13px!important;border-left:2px solid var(--accent);padding-left:14px}.layout{display:grid;grid-template-columns:minmax(300px,1fr) minmax(320px,1.3fr);gap:22px;align-items:start}.panel{border:1px solid var(--edge);background:var(--panel);border-radius:14px;padding:26px;min-width:0}h2{font-size:18px;letter-spacing:-.02em;margin:0 0 24px}h3{font-size:16px;margin:25px 0 12px}.drop{display:flex;align-items:center;text-align:center;gap:10px;flex-direction:column;padding:22px;border:1px dashed #72898e;border-radius:10px;cursor:pointer;background:#142023}.drop span:last-of-type{font-size:12px;color:var(--muted)}.upload-symbol{color:var(--accent);font-size:28px}.drop input{font-size:12px;width:100%;max-width:290px;margin-top:5px}fieldset{padding:0;margin:30px 0 20px;border:0}legend{font-size:15px;font-weight:650;padding:0}.help{font-size:12px;line-height:1.6}label:not(.drop){display:block;font-size:12px;font-weight:600;margin:16px 0 7px}input:not([type=file]){width:100%;border:1px solid #52666c;border-radius:6px;background:#111c1f;color:var(--ink);padding:11px;font:inherit;font-size:13px}input:focus,button:focus,a:focus{outline:2px solid var(--accent);outline-offset:3px}button{font:inherit;font-size:13px;font-weight:700;border:0;border-radius:7px;padding:13px 17px;color:#1b2916;background:var(--accent);cursor:pointer}button:disabled{opacity:.5;cursor:wait}button[type=submit]{width:100%;display:flex;justify-content:space-between}.secondary{border:1px solid var(--edge);background:transparent;color:var(--ink);padding:8px 11px;font-size:11px}.section-row{display:flex;justify-content:space-between;align-items:center;gap:12px}.section-row h2{margin:0}.results>.section-row{margin-bottom:24px}.results{min-height:400px}.mono{font-family:ui-monospace,monospace;font-size:11px;color:var(--muted);overflow-wrap:anywhere}.wave{font-size:65px;color:#739b64;letter-spacing:6px;margin-bottom:20px}#empty{text-align:center;padding:50px 18px}#empty p{font-size:13px;line-height:1.7;color:var(--muted)}progress{display:block;width:100%;height:7px;margin:18px 0;accent-color:var(--accent)}#message{font-size:14px;line-height:1.65}#status{text-transform:capitalize;color:var(--accent)}#stage{font-size:11px}.notice{background:#393222;border:1px solid #72613b;color:#f1dfaf;border-radius:7px;padding:13px;font-size:13px}.candidate{overflow-wrap:anywhere;padding:15px;background:#111b1e;border:1px solid var(--edge);border-radius:8px;margin:10px 0;font-size:13px;line-height:1.7}.candidate strong{font-size:16px;display:block}.candidate p{margin:5px 0;color:var(--muted)}.event{border-top:1px solid var(--edge);padding:12px 0;font-size:12px;color:var(--muted)}.diagnostic{margin:15px 0}.diagnostic img{display:block;width:100%;border-radius:5px;background:#111}.diagnostic figcaption{font-size:11px;margin-top:7px;color:var(--muted)}details{border-top:1px solid var(--edge);padding-top:18px;margin-top:24px;font-size:12px}summary{cursor:pointer;color:var(--accent)}ul{padding-left:20px}li{margin:9px 0;overflow-wrap:anywhere}#upload-error,#connection{color:#ffb9ac;font-size:13px}.recent{margin-top:30px}.recent h2{font-size:14px}.recent ul{display:flex;flex-wrap:wrap;gap:15px;list-style:none;padding:0;font-size:12px}footer{border-top:1px solid var(--edge);margin-top:42px;padding-top:22px;font-size:11px;line-height:1.7}[hidden]{display:none!important}@media(max-width:760px){header{padding:20px 22px}.tag{display:none}main{padding:30px 18px}.layout{grid-template-columns:1fr}.panel{padding:22px}h1{font-size:42px}.results{min-height:300px}#empty{padding:20px 8px}}
+
-#map-container,#map{max-width:100%!important;overflow:hidden!important}
-.leaflet-container{max-width:100%!important}
++.search-region{max-width:100%;overflow:hidden}
++#map-container{width:100%;height:260px;overflow:hidden;border-radius:8px;border:1px solid var(--edge);margin:12px 0;position:relative}
++#map{width:100%;height:100%;max-width:100%}
++.bounds-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
++.bounds-grid label{margin:0 0 4px}
++.bounds-grid input{padding:8px}
++.validation-error{color:#ffb9ac;font-size:12px;line-height:1.6}
++.leaflet-control-attribution,.leaflet-control-attribution a{color:#16334b}
++.leaflet-container a.leaflet-control-zoom-in,.leaflet-container a.leaflet-control-zoom-out{color:#16334b}
diff --cc tests/test_map_region.py
index 0000000,0000000..cb40a58
new file mode 100644
--- /dev/null
+++ b/tests/test_map_region.py
@@@ -1,0 -1,0 +1,69 @@@
++"""Search-area input and packaged-map transport checks; no audio or tracks."""
++from copy import deepcopy
++from http.server import ThreadingHTTPServer
++from importlib.resources import files
++import threading
++from types import SimpleNamespace
++from urllib.request import urlopen
++
++import pytest
++
++from dopplergeist.contracts import validate_request
++from dopplergeist.service import Handler
++
++
++def request_for(search):
++ return {"schema_version": 1, "audio_path": "recording.mp3", "search": search}
++
++
++def test_real_regional_bounds_preserve_precision_and_canonical_coverage():
++ # Published Rochester experiment bounds; these only validate input geometry.
++ original = request_for({"coverage": "conus", "bounds_wsen": [-77.90, 43.08, -77.50, 43.30]})
++ before = deepcopy(original)
++ assert validate_request(original) == original
++ assert original == before
++ assert validate_request(request_for({"coverage": "conus"}))["search"] == {"coverage": "conus"}
++
++
[email protected]("coverage", ["custom", "bbox", "global"])
++def test_unsupported_coverage_never_defaults_to_national_search(coverage):
++ with pytest.raises(ValueError, match="CONUS"):
++ validate_request(request_for({"coverage": coverage}))
++ with pytest.raises(ValueError, match="CONUS"):
++ validate_request(request_for({"coverage": coverage, "bounds_wsen": [-77.90, 43.08, -77.50, 43.30]}))
++
++
[email protected]("bounds", [
++ [], [-77.90, 43.08, -77.50], [-77.90, 43.08, None, 43.30],
++ [-77.90, 43.08, float("nan"), 43.30], [-77.90, 43.08, float("inf"), 43.30],
++ [-77.50, 43.08, -77.90, 43.30], [170, 24, -170, 50],
++ [-126, 24, -66, 50], [-125, 23, -66, 50],
++ [-125, 24, -65, 50], [-125, 24, -66, 51],
++])
++def test_invalid_or_unsupported_bounds_are_rejected_without_repair(bounds):
++ with pytest.raises(ValueError):
++ validate_request(request_for({"coverage": "conus", "bounds_wsen": bounds}))
++
++
++def test_map_assets_and_license_are_served_with_restricted_script_policy():
++ # A static-only server avoids job submission, decoder work and test recordings.
++ with ThreadingHTTPServer(("127.0.0.1", 0), Handler) as server:
++ server.manager = SimpleNamespace()
++ worker = threading.Thread(target=server.serve_forever, daemon=True)
++ worker.start()
++ try:
++ root = f"http://127.0.0.1:{server.server_port}"
++ for name in ("leaflet.js", "leaflet.css", "leaflet-license.txt"):
++ with urlopen(f"{root}/{name}", timeout=5) as response:
++ assert response.read() == files("dopplergeist.web").joinpath(name).read_bytes()
++ policy = response.headers["Content-Security-Policy"]
++ assert "script-src 'self';" in policy
++ assert "'unsafe-inline'" not in policy
++ assert "https://tile.openstreetmap.org" in policy
++ with urlopen(root, timeout=5) as response:
++ html = response.read().decode()
++ assert 'href="/leaflet-license.txt"' in html
++ assert 'href="https://www.openstreetmap.org/copyright"' in html
++ finally:
++ server.shutdown()
++ worker.join()