Repository navigation
Description
Before you start
- I searched the existing issues and did not find a duplicate.
- This is a bug report, not a usage question (questions belong in Discussions).
What happened?
layout.addElement of a grid or an extentIndicator accepts parameters those kinds don't read and drops them without a word: the command succeeds and the result is the same as without them. Both go on a map frame and have no box or text of their own, so a script that gives x, y, w and h to place one sees a success and nothing placed.
The general notice for unread parameters (#154) doesn't cover this. It names the keys that no kind reads (layout.addElement ignores 'bogus' (it reads …)), and x, text or angle are read by other kinds. A few keys are refused kind by kind (color, fill and outline since #1455, font, radius, dash, rotation, wrap, the chart options, background on these two), and the rest are not.
In crates/engine/src/cmd/layout.rs the two arms return before place(...), so the box is never read.
Found in the review of #2872 (#2872 (comment)), which fixes it for its own new kind, the section line.
Steps to reproduce
With RustGIS 0.8.0:
rustgis-cli run --sample --cmd 'layout.new={"name":"L"}' --cmd 'layout.addElement={"kind":"grid","step":20}' --save g0.rgis
rustgis-cli run --sample --cmd 'layout.new={"name":"L"}' --cmd 'layout.addElement={"kind":"grid","step":20,"x":10,"y":10,"w":50,"h":50,"text":"hi","angle":30,"divisions":4}' --save g1.rgis
Both print {"element": 1} and nothing else, and the layouts of the two files are equal. The same happens with an extent indicator (layout.duplicateElement gives the second frame, 7):
rustgis-cli run --sample --cmd 'layout.new={"name":"L"}' --cmd 'layout.duplicateElement={"element":1}' --cmd 'layout.addElement={"kind":"extentIndicator","frame":7,"of":1,"x":10,"w":50,"text":"hi","step":5,"bold":true}' --save e1.rgis
Expected behavior
A key that the kind doesn't read is refused before anything changes, with a message that names it and lists what the kind reads, as layout.update does for a section object in #2872:
layout.addElement: a grid takes no "x" (it reads layout, kind, frame, type, crs, step, …)
A null value counts as not given, as it does for the keys refused today. Clean calls say nothing.
Choices in this proposal:
- Refuse, not warn. The keys already checked by kind are refused, and a placed grid that isn't placed is an unusable result rather than an approximate one.
- One list of keys per kind, next to its arm, rather than one more constant per key: a key added later to another kind is then refused here too.
- These two kinds first. The others drop keys too: on 0.8.0,
{"kind":"rectangle","text":"hi","angle":30,"divisions":4,"step":5,"units":"miles"}and{"kind":"text","text":"a","step":5,"divisions":4,"ticks":3,"angle":20,"head":"end"}both succeed with no notice. They read more keys each, so their lists are better done on their own afterwards, the same way.
How are you running RustGIS?
Command line (rustgis-cli)
Version
v0.8.0. The two arms read the same on main (7ecae77), where I read the code but didn't run it.
Operating system, browser and graphics
Windows 11
Activity
ninhhaidang commentedon Nov 27, 2026
I'll take this.
fix(engine): refuse unread parameters on layout.addElement grid and e…