Repository navigation
v.kernel: Allow -q without an output map name - #8075
Conversation
The -q flag only computes the optimal radius and exits without writing a map, but the parser still required output or net_output. Because output is a new raster, an existing name was also rejected unless --overwrite was given. Count -q as satisfying the requirement. In network mode, skip the input/output name check when no net_output is given, otherwise v.kernel crashes on the NULL name. Add pytest tests for -q in raster and network mode. Fixes OSGeo#3192
petrasovaa
left a comment
There was a problem hiding this comment.
This does not fix #3192. The command from the issue still fails identically:
v.kernel -q input=points output=dens radius=30
ERROR: option <output>: <dens> exists. To overwrite, use the --overwrite flag
The problem is the parser's overwrite check on output, which -q never writes. The parser has a field for this; add it to the flag definition:
flag_q->suppress_overwrite = YES;Also needed:
if (flag_q->answer) flag_o->answer = 1;runs after the-ovalidation block (gaussian kernel, node=none), so-qbypasses that validation. Move it above the block.- Docs: say that
-qimplies-o.
|
Addressed in 5955cd2. I set lag_q->suppress_overwrite = YES, moved the -q to -o implication before the optimal-radius validation, updated both docs to state that -q implies -o, and added a regression test for -q with an existing output map. Thanks for the review. |
|
GitHub reports the current PR checks as passing: |
That was a message for you @mallesh-bot , not us |
|
Understood, sorry for the noise. I shared that status for my own context and should have kept it out of the PR discussion. |
Description
v.kernel -qonly computes the optimal radius and exits, but the parserstill required
outputornet_output, and rejected an existing namewithout
--overwrite. Now-qcounts as satisfying that requirement.In network mode, the input/output name check is skipped when no
net_outputis given. Without this,-qwithnet=and nonet_outputsegfaults on the NULL name.Also adds a short note about
-qto the manual (md and html).Motivation and context
Fixes #3192
How has this been tested?
Added
vector/v.kernel/tests/v_kernel_test.py(v.kernel had no tests):-qwithout output in raster mode: runs, no raster is created-qwithout net_output in network mode: runs, no vector is created-q, an output is still requiredBuilt with CMake on Ubuntu 24.04 and ran the tests: all 3 pass with the
change. With
main.creverted, the two-qtests fail withAt least one of the following options is required: <output> and <net_output>.With only the parser change (no name check guard), the network test
crashes with SIGSEGV. pre-commit passes on the changed files.
Types of changes
functionality to not work as before)
Checklist
pre-defined prefixes
of this project.