Give satellite imagery, terrain data, buildings, streetview photos to your LLM
Add warning to capture too
Belluxxfb27c622fa5a
diff --git a/src/dashboard.py b/src/dashboard.pyindex 60003a0..d321305 100644--- a/src/dashboard.py+++ b/src/dashboard.py@@ -110,6 +110,7 @@ def preview(run):stages[mode] = dict(nodes=len(stage["nodes"]), level=stage["level"])else:stages[mode] = {}+ stages[mode]["seconds"] = capture.estimate(dict(stages=[stage], options=run["options"]))["seconds"]return dict(bounds=area, options=run["options"], seconds=capture.estimate(run)["seconds"], stages=stages,layers=plan_layers(run))diff --git a/src/web/app.js b/src/web/app.jsindex 4ea8db6..4c78095 100644--- a/src/web/app.js+++ b/src/web/app.js@@ -45,6 +45,10 @@ const SPEEDS = [{limit: 30, name: "seconds", icon: "bolt"}, {limit: 1800, name:{limit: 15 * 86400, name: "weeks", icon: "error", alert: true},{limit: Infinity, name: "months", icon: "error", alert: true}];const SLOW_PLAN = SPEEDS[1].limit;+const SLOW_CAPTURE = SPEEDS[2].limit; // Captures are expected to take a while; days or more ask before starting.+// Settings that shorten a slow capture, by source.+const SHORTER = {streetview: "wider Street View spacing", satellite: "a lower satellite zoom", terrain: "a lower terrain zoom",+ mesh: "lower 3D mesh detail"};// Progress phases that a capture stage row already shows.const DOWNLOADS = new Set(["Street View", "Satellite", "Downloading terrain tiles", "3D mesh"]);@@ -627,7 +631,9 @@ function renderPreview() {return `<li>${icon(mode)}<strong>${NAMES[mode]}</strong><span class="value">${esc(value)}</span><span class="detail">${esc(detail)}</span></li>`;}).join("");- $("#plan-time").textContent = `~ ${duration(state.preview.seconds)}`;+ const pace = speed(state.preview.seconds);+ $("#plan-time").innerHTML = `${pace.alert ? icon(pace.icon) : ""}~ ${duration(state.preview.seconds)}`;+ $("#plan-time").classList.toggle("alert", !!pace.alert);}async function previewPlan(event) {@@ -651,27 +657,43 @@ async function previewPlan(event) {poll();}-// Ask before planning that takes hours or days; resolves true to plan anyway.+// Ask before planning that takes hours or more; resolves true to plan anyway.function confirmPlan(planning, options) {const total = Object.values(planning).reduce((sum, seconds) => sum + seconds, 0);if (total < SLOW_PLAN) return Promise.resolve(true);// Levels above 20 also list every level-20 node, which multiplies the lookups.const level = planning.mesh >= SLOW_PLAN && options.mesh_level > 20;- const dialog = $("#slow-plan");- const pace = speed(total);- $("h2", dialog).innerHTML = `${icon(pace.icon)}Planning will take ${pace.name}`;+ const lookups = [planning.streetview != null && "panoramas", planning.mesh != null && "mesh nodes"].filter(Boolean).join(" and ");+ return confirmSlow("Planning", planning, `Every one of the area's ${lookups} is looked up before the preview appears. ${+ level ? "Try 3D mesh detail 20 or lower, or a smaller area." : "Try a smaller area."}`, "Preview anyway");+}++// Ask before a capture that takes days or more; resolves true to start anyway.+function confirmCapture(preview) {+ const times = Object.fromEntries(Object.entries(preview.stages).map(([mode, stage]) => [mode, stage.seconds]));+ if (preview.seconds < SLOW_CAPTURE) return Promise.resolve(true);+ const slow = Object.keys(times).filter(mode => mode in SHORTER && times[mode] >= SLOW_CAPTURE);+ const tips = ["a smaller area", ...slow.map(mode => SHORTER[mode])];+ return confirmSlow("This capture", times, `Downloads can be stopped and resumed later. To shorten it, try ${+ tips.length > 1 ? `${tips.slice(0, -1).join(", ")} or ${tips.at(-1)}` : tips[0]}.`, "Start anyway");+}++// Time per source, why it is slow and what helps; resolves true to go ahead.+function confirmSlow(subject, times, text, anyway) {+ const dialog = $("#slow");+ const pace = speed(Object.values(times).reduce((sum, seconds) => sum + seconds, 0));+ $("h2", dialog).innerHTML = `${icon(pace.icon)}${subject} will take ${pace.name}`;$("h2", dialog).classList.toggle("alert", !!pace.alert);- $("ul", dialog).innerHTML = Object.entries(planning).map(([mode, seconds]) => {+ $("ul", dialog).innerHTML = Object.entries(times).map(([mode, seconds]) => {const {icon: name, alert} = speed(seconds);return `<li>${icon(mode)}<span>${NAMES[mode]}</span><span class="estimate ${alert ? "alert" : ""}">${icon(name)}${speed(seconds).name}</span></li>`;}).join("");- const lookups = [planning.streetview != null && "panoramas", planning.mesh != null && "mesh nodes"].filter(Boolean).join(" and ");- $("p", dialog).textContent = `Every one of the area's ${lookups} is looked up before the preview appears. ${- level ? "Try 3D mesh detail 20 or lower, or a smaller area." : "Try a smaller area."}`;+ $("p", dialog).textContent = text;+ $("[value=go]", dialog).textContent = anyway;dialog.returnValue = "";dialog.showModal();- return new Promise(resolve => dialog.addEventListener("close", () => resolve(dialog.returnValue === "plan"), {once: true}));+ return new Promise(resolve => dialog.addEventListener("close", () => resolve(dialog.returnValue === "go"), {once: true}));}function showPlan() {@@ -981,6 +1003,10 @@ function bind() {renderPreview();});$("#start").addEventListener("click", async () => {+ if (!await confirmCapture(state.preview)) {+ location.hash = "#/new";+ return;+ }$("#start").disabled = true;try {state.job = await api("/api/capture", {plan: state.preview.plan});diff --git a/src/web/index.html b/src/web/index.htmlindex 19601d5..2a39509 100644--- a/src/web/index.html+++ b/src/web/index.html@@ -210,13 +210,13 @@</section></aside>- <dialog id="slow-plan">+ <dialog id="slow"><form method="dialog"><h2></h2><ul class="stages compact"></ul><p class="detail"></p><div class="buttons">- <button value="plan" class="subtle">Preview anyway</button>+ <button value="go" class="subtle"></button><button value="" class="primary" autofocus>Change settings</button></div></form>diff --git a/src/web/style.css b/src/web/style.cssindex 6f5bc5b..ef592d8 100644--- a/src/web/style.css+++ b/src/web/style.css@@ -305,7 +305,9 @@ input[type=range]::-moz-range-thumb { width: 24px; height: 18px; border: 0; bord}.estimate { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--muted); font: 400 11px var(--mono); }.estimate .icon { width: 13px; height: 13px; }-.estimate.alert, dialog h2.alert { color: var(--accent); }+.estimate.alert, dialog h2.alert, #plan-time.alert { color: var(--accent); }+#plan-time { display: flex; align-items: center; gap: 8px; }+#plan-time .icon { width: 26px; height: 26px; }.source .fields { display: none; padding: 0 0 14px 23px; }.source.on .fields { display: grid; gap: 9px; }