Skip to content

fix(processing): honor WASM tool defaults and offer attribute pickers for field parameters - #1464

Merged
giswqs merged 2 commits into
mainfrom
fix/issue-1458-1459-field-picker-and-wasm-defaults
Jul 27, 2026
Merged

fix(processing): honor WASM tool defaults and offer attribute pickers for field parameters#1464
giswqs merged 2 commits into
mainfrom
fix/issue-1458-1459-field-picker-and-wasm-defaults

Conversation

@giswqs

@giswqs giswqs commented Jul 27, 2026

Copy link
Copy Markdown
Member

Fixes #1458
Fixes #1459

Both issues are in the Processing toolbox's local (WASM) mode, and both are fixed here.

#1458 — Points Along Lines returns too few points

Two causes, one of them a real bug.

The documented default was thrown away. manifestToWhiteboxTool discarded the WASM manifest's defaults map, so defaultParameterValue fell back to false for every bool. points_along_lines documents "Include line endpoints (default true)" but rendered as an unchecked box and ran with --include_end=false. On the reporter's 8 points (a 0.36-degree line), that is exactly the reported behaviour:

include_end spacing 0.1 spacing 0.2
false (what shipped) 3 points 1 point — "nothing happens"
true (documented) 4 points 2 points

The fix lifts the manifest's defaults onto each parameter: 1028 optional parameters across the catalog now open with the value their tool documents, 103 of them bools documented as true.

The map doubles as each tool's example invocation, so dataset and required entries are dropped — points_along_lines lists input: "lines.shp" and spacing: 50 alongside the one real default, and prefilling those would offer a path that does not exist on the user's machine and an arbitrary value for a required distance. A parameter the manifest leaves undefaulted falls back to the catalog's default, so WASM mode opens a tool with the same values the sidecar would.

The units were never stated. Vector inputs reach the WASM runner as GeoJSON, which RFC 7946 fixes to WGS84, so a distance/spacing/tolerance parameter is in degrees. Nothing said so, which is why a spacing of 0.1 (≈ 11 km) yielded a handful of points on a city-scale line. The parameter list now carries a note with the degree-to-metre scale, which is also what the issue asked for ("it could be useful that on the Spacing distance between points to be written also the measurement unit").

#1459 — Selectable columns on Points to Line

line_field and sort_field are plain string parameters, so the dialog rendered them as free text and the column name had to be recalled exactly.

A *_field / *_attribute string parameter now offers the columns of the layer chosen for the tool's vector input. Matching on the name suffix covers ~170 tools rather than a hard-coded list; the kind check keeps a same-named dataset parameter out (join_tables' primary_key_field is a vector input). For a tool with several vector inputs the source is resolved by longest leading name segment (target_match_fieldtarget, tolerating a plural origin_id_fieldorigins), falling back to the union of every selected input's columns when the names do not line up, so the right column is always in the list.

The text box stays editable next to the picker, so a file-path input (sidecar mode) or a column the property sample missed still works.

Verification

Driven in the browser against the reporter's coordinates, in both light and dark themes:

  • Points To Line lists Lat / Lon / Label / DT for both attribute parameters; picking DT fills the field and the run succeeds.
  • Points Along Lines opens with "Include line endpoints" checked, and spacing 0.1 now returns 4 points (confirmed in the attribute table) instead of 3.
  • The units note renders above the parameter list for every tool with a vector input.

New unit tests cover manifestScalarDefaults, the catalog-default fallback in mergeWasmToolManifests, and the field-parameter name rules. npm run test:frontend (3962 tests), npm run build and pre-commit all pass.

Not fixed here

points_along_lines still measures spacing in the layer's coordinate units. Offering meters would need a change in wbtools_oss (opengeos/whitebox-wasm), upstream of geolibre-wasm; this PR makes the current units explicit rather than silently surprising.

Summary by CodeRabbit

  • New Features
    • Field parameters now populate a dropdown of attribute names from selected vector layers, while still allowing manual editing.
    • Processing tools can now prefill supported optional scalar parameters using documented defaults.
  • Localization
    • Added field-selection labels and a vector-units note (degrees in WGS84 mode) across supported languages.
  • Bug Fixes
    • Improved parameter default reconciliation: preserved defaults already defined by the WASM manifest and avoided applying defaults to dataset inputs.

… for field parameters

Fixes #1458
Fixes #1459

Points Along Lines dropped every line's endpoint and gave no hint that its
spacing is measured in degrees, and Points To Line made the user type a column
name from memory. Both are Processing toolbox issues in local (WASM) mode.

Honor the WASM manifest's defaults. `manifestToWhiteboxTool` discarded the
manifest's `defaults` map, so the dialog fell back to `false` for every bool.
`points_along_lines` documents "Include line endpoints (default true)" but
rendered as an unchecked box and sent `--include_end=false`: on the reporter's
0.36-degree line, spacing 0.1 produced 3 points instead of 4, and 0.2 produced a
single point, which reads as "nothing happens". 1028 optional parameters across
the catalog gain their documented default, 103 of them bools documented as true.

The map doubles as the tool's example invocation, so dataset and required
entries are dropped: `points_along_lines` lists `input: "lines.shp"` and
`spacing: 50` next to the one real default, and prefilling those would offer a
path that does not exist and an arbitrary value for a required distance. A
parameter the manifest leaves undefaulted now falls back to the catalog's
default, so WASM mode opens a tool with the same values the sidecar would.

State the coordinate units. Vector inputs reach the WASM runner as GeoJSON,
which RFC 7946 fixes to WGS84, so a distance, spacing or tolerance parameter is
in degrees. Nothing said so, which is how a spacing of 0.1 (about 11 km) yielded
a handful of points on a city-scale line. The parameter list now carries a note
with the degree-to-metre scale.

Offer the layer's columns for a field parameter. A `*_field` / `*_attribute`
string parameter names a column of one of the tool's vector inputs, matched on
the name suffix so this covers ~170 tools rather than a hard-coded list. The
picker is filled from the layer chosen for the vector input the parameter names,
resolved by longest leading name segment for a multi-input tool and falling back
to the union of every selected input's columns when the names do not line up.
The text box stays editable alongside it, so a file-path input or a column the
property sample missed still works.

Verified in the browser against the reporter's coordinates, in both themes:
Points To Line now lists Lat/Lon/Label/DT for both attribute parameters, and
Points Along Lines opens with "Include line endpoints" checked and returns 4
points at spacing 0.1.
Copilot AI review requested due to automatic review settings July 27, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8999f1b5-deb4-4597-81d0-38026beb4c0b

📥 Commits

Reviewing files that changed from the base of the PR and between d96f8c7 and 562f254.

📒 Files selected for processing (2)
  • apps/geolibre-desktop/src/i18n/locales/ar.json
  • apps/geolibre-desktop/src/i18n/locales/de.json

📝 Walkthrough

Walkthrough

Changes

The processing toolbox now supports scalar defaults from WASM manifests and catalog reconciliation. Vector field parameters derive attribute names from loaded GeoJSON layers, offer selectable yet editable fields, and display localized WGS84 unit guidance.

Processing defaults and reconciliation

Layer / File(s) Summary
WASM manifest defaults
packages/processing/src/wasm-client.ts, packages/processing/src/index.ts, tests/wasm-tool-manifests.test.ts
WASM manifests expose optional defaults, scalar defaults populate tools, missing non-dataset defaults are reconciled from the catalog, and tests cover precedence and exclusions.

Vector field selection

Layer / File(s) Summary
Field detection and option plumbing
apps/geolibre-desktop/src/lib/whitebox-field-params.ts, apps/geolibre-desktop/src/components/processing/ProcessingDialog.tsx, tests/whitebox-field-params.test.ts
Field parameters are classified and matched to vector inputs; sampled GeoJSON properties populate selectable field options while preserving manual editing.
Localized processing guidance
apps/geolibre-desktop/src/i18n/locales/*
Processing UI translations add field-selection labels and vector-unit guidance for WGS84 degree-based measurements.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProcessingDialog
  participant LoadedGeoJSON
  participant ParameterField
  ProcessingDialog->>LoadedGeoJSON: sample feature properties
  LoadedGeoJSON-->>ProcessingDialog: return attribute names
  ProcessingDialog->>ParameterField: provide fieldOptions
  ParameterField-->>ProcessingDialog: update selected or typed field
Loading

Poem

A rabbit hops through fields so bright,
Picks column names with pure delight.
WASM defaults softly land,
WGS84 notes explain the land.
Type or choose—both paths are clear,
Processing blooms from burrow to gear.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main Processing fixes: honoring WASM defaults and adding attribute pickers.
Linked Issues check ✅ Passed The defaults, unit note, and selectable field pickers address the behaviors requested in #1458 and #1459.
Out of Scope Changes check ✅ Passed The locale, helper, and test changes support the requested Processing fixes and do not introduce unrelated scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1458-1459-field-picker-and-wasm-defaults

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/geolibre-desktop/src/i18n/locales/ar.json`:
- Line 3334: Update the Arabic translation for vectorUnitsNote to use the
established GIS term “الطبقات المتجهة” instead of “الطبقات الشعاعية”, preserving
the rest of the note unchanged.

In `@apps/geolibre-desktop/src/i18n/locales/de.json`:
- Line 3119: Update the German vectorUnitsNote translation to use the
established “Abstand” wording for the spacing parameter instead of “Raster,”
while preserving the existing WGS84, degree, and conversion details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d42c4e94-952d-426e-b0e6-56047668e5c0

📥 Commits

Reviewing files that changed from the base of the PR and between 011bdaa and d96f8c7.

📒 Files selected for processing (22)
  • apps/geolibre-desktop/src/components/processing/ProcessingDialog.tsx
  • apps/geolibre-desktop/src/i18n/locales/ar.json
  • apps/geolibre-desktop/src/i18n/locales/de.json
  • apps/geolibre-desktop/src/i18n/locales/en.json
  • apps/geolibre-desktop/src/i18n/locales/es.json
  • apps/geolibre-desktop/src/i18n/locales/fr.json
  • apps/geolibre-desktop/src/i18n/locales/hi.json
  • apps/geolibre-desktop/src/i18n/locales/id.json
  • apps/geolibre-desktop/src/i18n/locales/it.json
  • apps/geolibre-desktop/src/i18n/locales/ja.json
  • apps/geolibre-desktop/src/i18n/locales/ka.json
  • apps/geolibre-desktop/src/i18n/locales/ko.json
  • apps/geolibre-desktop/src/i18n/locales/nl.json
  • apps/geolibre-desktop/src/i18n/locales/pt.json
  • apps/geolibre-desktop/src/i18n/locales/ru.json
  • apps/geolibre-desktop/src/i18n/locales/tr.json
  • apps/geolibre-desktop/src/i18n/locales/zh.json
  • apps/geolibre-desktop/src/lib/whitebox-field-params.ts
  • packages/processing/src/index.ts
  • packages/processing/src/wasm-client.ts
  • tests/wasm-tool-manifests.test.ts
  • tests/whitebox-field-params.test.ts

Comment thread apps/geolibre-desktop/src/i18n/locales/ar.json Outdated
Comment thread apps/geolibre-desktop/src/i18n/locales/de.json Outdated
- ar.json: use the established GIS term for a vector layer in
  `vectorUnitsNote`. `الطبقات الشعاعية` reads as radial layers; the catalog
  already says `الطبقات المتجهة` in six other strings.
- de.json: translate "distance, spacing" as `Entfernungs-, Abstands-` in
  `vectorUnitsNote`. `Raster` is the project's word for raster/grid imagery, so
  using it for spacing collided with an unrelated concept; `Abstand` is what
  `graticule.spacing` and `style.decorations.spacing` already use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Selectable columns on Points to Line [Bug]: Points along Lines

2 participants