Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,16 @@ export function ProcessingMenu({
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuLabel className="text-xs text-muted-foreground">
{t("toolbar.item.subGroupH3")}
{t("toolbar.item.subGroupDggs")}
</DropdownMenuLabel>
<DropdownMenuItem onSelect={() => setVectorToolOpen("h3-grid")}>
{t("toolbar.vectorTool.h3Grid")}
<DropdownMenuItem onSelect={() => setVectorToolOpen("dggs-grid")}>
{t("toolbar.vectorTool.dggsGenerator")}
</DropdownMenuItem>
<DropdownMenuItem onSelect={() => setVectorToolOpen("h3-bin-points")}>
{t("toolbar.vectorTool.h3BinPoints")}
<DropdownMenuItem onSelect={() => setVectorToolOpen("dggs-bin")}>
{t("toolbar.vectorTool.dggsBinning")}
</DropdownMenuItem>
<DropdownMenuItem onSelect={() => setVectorToolOpen("dggs-compact")}>
{t("toolbar.vectorTool.dggsCompact")}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuLabel className="text-xs text-muted-foreground">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ export const VECTOR_TOOL_COMMANDS: Array<{
{ kind: "smooth", titleKey: "toolbar.vectorTool.smooth" },
{ kind: "grid", titleKey: "toolbar.vectorTool.grid" },
{ kind: "voronoi", titleKey: "toolbar.vectorTool.voronoi" },
{ kind: "h3-grid", titleKey: "toolbar.vectorTool.h3Grid" },
{ kind: "h3-bin-points", titleKey: "toolbar.vectorTool.h3BinPoints" },
{ kind: "dggs-grid", titleKey: "toolbar.vectorTool.dggsGenerator" },
{ kind: "dggs-bin", titleKey: "toolbar.vectorTool.dggsBinning" },
{ kind: "dggs-compact", titleKey: "toolbar.vectorTool.dggsCompact" },
];

export const RASTER_TOOL_COMMANDS: Array<{
Expand Down
25 changes: 15 additions & 10 deletions apps/geolibre-desktop/src/components/processing/ParameterField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,21 @@ export function ParameterField({

if (param.type === "boolean") {
return (
<label className="flex items-center gap-2 text-sm" htmlFor={param.id}>
<input
id={param.id}
type="checkbox"
checked={Boolean(value)}
onChange={(e) => onChange(e.target.checked)}
className="h-4 w-4 rounded border-input"
/>
{param.label}
</label>
<div className="flex flex-col gap-1">
<label className="flex items-center gap-2 text-sm" htmlFor={param.id}>
<input
id={param.id}
type="checkbox"
checked={Boolean(value)}
onChange={(e) => onChange(e.target.checked)}
className="h-4 w-4 rounded border-input"
/>
{param.label}
</label>
{param.description ? (
<p className="text-xs text-muted-foreground ps-6">{param.description}</p>
) : null}
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getVectorTool,
runVectorTool,
fetchVectorStatus,
maxResolutionForDggs,
type AlgorithmParameter,
type GeometryFamily,
type ProcessingAlgorithm,
Expand Down Expand Up @@ -130,12 +131,12 @@ export function VectorToolsDialog({ mapControllerRef }: VectorToolsDialogProps):
if (rerun.autoRun) setAutoRunPending(true);
}, [open, rerun, tool, setProcessingRerun, t]);

// Prefill the H3 grid's manual bounding-box fields from the current map
// Prefill the DGGS Generator's manual bounding-box fields from the current map
// viewport when the user first switches to that source, so they can tweak the
// box rather than type it from scratch. Only fills empty fields, so it never
// clobbers manual edits. Keyed on the source value, not every keystroke.
useEffect(() => {
if (selectedId !== "h3-grid" || params.source !== "bbox") return;
if (selectedId !== "dggs-grid" || params.source !== "bbox") return;
if (
params.west !== undefined ||
params.south !== undefined ||
Expand Down Expand Up @@ -475,16 +476,42 @@ export function VectorToolsDialog({ mapControllerRef }: VectorToolsDialogProps):
<p className="text-sm text-muted-foreground">{tool.description}</p>

<div className="flex flex-col gap-3">
{tool.parameters.filter(isParamVisible).map((param) => (
<ParameterField
key={param.id}
param={param}
value={params[param.id]}
layerOptions={layerOptions(param.geometryFilter)}
fieldOptions={param.type === "field" ? fieldOptions(param) : undefined}
onChange={(value) => handleParamChange(param.id, value)}
/>
))}
{tool.parameters.filter(isParamVisible).map((param) => {
// Narrow the resolution spinner to the selected DGGS type's range.
const fieldParam =
(tool.id === "dggs-grid" ||
tool.id === "dggs-bin" ||
tool.id === "dggs-compact") &&
param.id === "resolution"
? (() => {
const dggsType =
params.dggsType === "s2" ||
params.dggsType === "a5" ||
params.dggsType === "dggrid" ||
params.dggsType === "dggal"
? params.dggsType
: "h3";
const subtype =
dggsType === "dggal" ? params.dggalType : params.dggridType;
const max = maxResolutionForDggs(dggsType, subtype);
return {
...param,
max,
label: `Resolution (0-${max})`,
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
})()
: param;
return (
<ParameterField
key={param.id}
param={fieldParam}
value={params[param.id]}
layerOptions={layerOptions(param.geometryFilter)}
fieldOptions={param.type === "field" ? fieldOptions(param) : undefined}
onChange={(value) => handleParamChange(param.id, value)}
/>
);
})}
</div>

{tool.supportsSidecar || tool.requiresSidecar ? (
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2398,8 +2398,6 @@
"grid": "شبكة منتظمة",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "تغطية المواقع الخلوية",
"h3Grid": "إنشاء شبكة H3",
"h3BinPoints": "تجميع النقاط في خلايا H3",
"trajectorySpeed": "سرعة مسار الحركة",
"detectStops": "اكتشاف التوقفات",
"spaceTimeProximity": "التقارب الزماني المكاني",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Regelmäßiges Raster",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Mobilfunkzellen-Abdeckung",
"h3Grid": "H3-Raster erstellen",
"h3BinPoints": "Punkte zu H3 binnen",
"trajectorySpeed": "Trajektoriengeschwindigkeit",
"detectStops": "Stopps erkennen",
"spaceTimeProximity": "Raum-Zeit-Nähe",
Expand Down
20 changes: 11 additions & 9 deletions apps/geolibre-desktop/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2232,8 +2232,9 @@
"grid": "Regular grid",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cell-site coverage",
"h3Grid": "Create H3 grid",
"h3BinPoints": "Bin points to H3",
"dggsGenerator": "DGGS Generator",
"dggsBinning": "DGGS Binning",
"dggsCompact": "DGGS Compact",
"trajectorySpeed": "Trajectory speed",
"detectStops": "Detect stops",
"spaceTimeProximity": "Space-time proximity",
Expand Down Expand Up @@ -2418,7 +2419,8 @@
"subGroupOverlay": "Overlay",
"subGroupJoin": "Join",
"subGroupSelect": "Select",
"subGroupH3": "H3",
"subGroupDggs": "DGGS",
"subGroupH3": "DGGS",
"subGroupMovement": "Movement & time",
"subGroupDataQuality": "Data quality",
"subGroupTerrain": "Terrain",
Expand Down Expand Up @@ -2999,9 +3001,9 @@
"title": "OLC",
"controlTitle": "OLC settings",
"autoResolution": "Automatic resolution",
"resolution": "Code length",
"resolution": "Resolution",
"cellCount": "{{count}} cells in view",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the code length.",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the resolution.",
"fillColor": "Fill color",
"fillOpacity": "Fill opacity",
"lineColor": "Outline color",
Expand All @@ -3026,9 +3028,9 @@
"title": "Geohash",
"controlTitle": "Geohash settings",
"autoResolution": "Automatic resolution",
"resolution": "Precision",
"resolution": "Resolution",
"cellCount": "{{count}} cells in view",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the precision.",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the resolution.",
"fillColor": "Fill color",
"fillOpacity": "Fill opacity",
"lineColor": "Outline color",
Expand All @@ -3053,9 +3055,9 @@
"title": "Tilecode",
"controlTitle": "Tilecode settings",
"autoResolution": "Automatic resolution",
"resolution": "Zoom level",
"resolution": "Resolution",
"cellCount": "{{count}} tiles in view",
"tooManyCells": "This view exceeds the {{limit}} tile limit. Zoom in or lower the zoom level.",
"tooManyCells": "This view exceeds the {{limit}} tile limit. Zoom in or lower the resolution.",
"fillColor": "Fill color",
"fillOpacity": "Fill opacity",
"lineColor": "Outline color",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Cuadrícula regular",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cobertura de sitios celulares",
"h3Grid": "Crear cuadrícula H3",
"h3BinPoints": "Agrupar puntos en H3",
"trajectorySpeed": "Velocidad de trayectoria",
"detectStops": "Detectar paradas",
"spaceTimeProximity": "Proximidad espacio-temporal",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Grille régulière",
"voronoi": "Voronoï / Delaunay",
"cellSectors": "Couverture de site cellulaire",
"h3Grid": "Créer une grille H3",
"h3BinPoints": "Regrouper les points en H3",
"trajectorySpeed": "Vitesse de trajectoire",
"detectStops": "Détecter les arrêts",
"spaceTimeProximity": "Proximité spatio-temporelle",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "नियमित ग्रिड",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "सेल-साइट कवरेज",
"h3Grid": "H3 ग्रिड बनाएं",
"h3BinPoints": "बिंदुओं को H3 में बिन करें",
"trajectorySpeed": "प्रक्षेपवक्र गति",
"detectStops": "रुकावटें पहचानें",
"spaceTimeProximity": "स्थान-समय निकटता",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,6 @@
"grid": "Grid teratur",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cakupan sel BTS",
"h3Grid": "Buat grid H3",
"h3BinPoints": "Bin titik ke H3",
"trajectorySpeed": "Kecepatan lintasan",
"detectStops": "Deteksi pemberhentian",
"spaceTimeProximity": "Kedekatan ruang-waktu",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Griglia regolare",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Copertura delle celle radio",
"h3Grid": "Crea griglia H3",
"h3BinPoints": "Assegna punti a celle H3",
"trajectorySpeed": "Velocità di traiettoria",
"detectStops": "Rileva soste",
"spaceTimeProximity": "Prossimità spazio-temporale",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,6 @@
"grid": "正方格子",
"voronoi": "ボロノイ / ドロネー",
"cellSectors": "セルサイトのカバレッジ",
"h3Grid": "H3グリッドを作成",
"h3BinPoints": "ポイントをH3にビン化",
"trajectorySpeed": "軌跡速度",
"detectStops": "停止を検出",
"spaceTimeProximity": "時空間近接",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ka.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "რეგულარული ბადე",
"voronoi": "ვორონოი / დელონე",
"cellSectors": "ფიჭური საიტის დაფარვა",
"h3Grid": "H3 ბადის შექმნა",
"h3BinPoints": "წერტილების დაჯგუფება H3-ში",
"trajectorySpeed": "ტრაექტორიის სიჩქარე",
"detectStops": "გაჩერებების ამოცნობა",
"spaceTimeProximity": "სივრცე-დროითი სიახლოვე",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,6 @@
"grid": "정규 격자",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "기지국 커버리지",
"h3Grid": "H3 격자 생성",
"h3BinPoints": "포인트를 H3 셀로 구간화",
"trajectorySpeed": "궤적 속도",
"detectStops": "정지 지점 감지",
"spaceTimeProximity": "시공간 근접성",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Regelmatig raster",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Dekkingsgebied zendmast",
"h3Grid": "H3-raster maken",
"h3BinPoints": "Punten binnen in H3",
"trajectorySpeed": "Trajectsnelheid",
"detectStops": "Stops detecteren",
"spaceTimeProximity": "Ruimte-tijdnabijheid",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Grade regular",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cobertura de estações de célula",
"h3Grid": "Criar grade H3",
"h3BinPoints": "Agrupar pontos em H3",
"trajectorySpeed": "Velocidade da trajetória",
"detectStops": "Detectar paradas",
"spaceTimeProximity": "Proximidade espaço-temporal",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -2315,8 +2315,6 @@
"grid": "Регулярная сетка",
"voronoi": "Вороного / Делоне",
"cellSectors": "Зоны покрытия базовых станций",
"h3Grid": "Создать сетку H3",
"h3BinPoints": "Группировать точки в H3",
"trajectorySpeed": "Скорость траектории",
"detectStops": "Определить остановки",
"spaceTimeProximity": "Пространственно-временная близость",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Düzenli ızgara",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Baz istasyonu kapsama alanı",
"h3Grid": "H3 ızgarası oluştur",
"h3BinPoints": "Noktaları H3'e grupla",
"trajectorySpeed": "Güzergah hızı",
"detectStops": "Durakları algıla",
"spaceTimeProximity": "Uzay-zaman yakınlığı",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,6 @@
"grid": "规则格网",
"voronoi": "泰森多边形 / 德劳内三角网",
"cellSectors": "基站覆盖扇区",
"h3Grid": "创建 H3 网格",
"h3BinPoints": "将点聚合到 H3",
"trajectorySpeed": "轨迹速度",
"detectStops": "检测停留点",
"spaceTimeProximity": "时空邻近性",
Expand Down
4 changes: 4 additions & 0 deletions apps/geolibre-desktop/src/lib/duckdb-processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type { DuckDbCapability, DuckDbGeoJsonSource } from "@geolibre/processing
import type { FeatureCollection } from "geojson";
import { stripAutoFidColumn } from "./duckdb-geometry";
import {
ensureA5Extension,
ensureDuckDggsExtension,
ensureH3Extension,
ensureSpatialExtension,
getDatabase,
Expand All @@ -25,6 +27,8 @@ export function createDuckDbCapability(): DuckDbCapability {
try {
if (names.includes("spatial")) await ensureSpatialExtension(db, connection);
if (names.includes("h3")) await ensureH3Extension(connection);
if (names.includes("a5")) await ensureA5Extension(connection);
if (names.includes("duck_dggs")) await ensureDuckDggsExtension(connection);
} finally {
await connection.close();
}
Expand Down
Loading
Loading