Instead of encouraging use of the internal Processing modules
(e.g. from processing.tools.general import run , import processing, ...)
instead expose all Python specific STABLE processing additions
to the qgis.processing module.
Instead, scripts and plugins should now use
from qgis.processing import run, algorithmHelp,...
This makes a clear distinction between internal Processing python
modules (i.e., everything else!) and the parts of Processing
which are stable and designed to be used by plugins and scripts.
TODO: QGIS 4.0 -- move the internal Processing plugin modules
to __processing, to clearer indicate that this is all internal
stuff.
Adds X and Y (or latitude/longitude) fields to a point layer.
The X/Y fields can be calculated in a different CRS to the
layer (e.g. creating latitude/longitude fields for a layer in
a project CRS).
Sponsored by SMEC/SJ
Even though not all errors are caught by these new tests, it could
expose if otb is broken or if processing api is changed to adopt
optional status of parameters at run-time.
`alg.processAlgorithm()` is running and failing correctly.
But `parameter.checkValueIsAcceptable()` and `alg.checkParameterValues()`
aren't working as expected.
Parameters are marked required in descriptor file for certian
applications but they are only required if a parent parameter has a
"certain" value. So initial idea was to make all of those parameters
optional from OTB part. So that qgis can work correctly and was a easy
fix. But.. we (me and Antonie) decided not to take that route and
found a better fix.
`OtbParameterChoice` and its wrapper will update optional status of
all sub-parameters depending on the value of a choice parameter.
A test has been added to check this issue and will be available in
next commit.
getWindowsCodePage is taken from Grass7Utils.py
Instead of writing a cli_file at startup, provider now pass all
required env_variables directly to subprocess.popen. This has known to
cause issues when handling with windows path names. subprocess.Popen
handles it correctly depending on platform
Logging of output from otbalgorithm and updating progress bar is
slightly updated.
Algoirthm is now launched directly using otbApplicationLauncherCommandLine
`encoding` (on windows) and env arguments passed to subprocess is
logged in QgsMessageLog
This adds a new parameter type specifically for map scales,
QgsProcessingParameterScale. The values are evaluated using
self.parameterAsDouble, which returns the map scale
denominator (matching the standard in other parts of the
QGIS API).
Scale parameters are displayed to users using the standard
QgsScaleWidget, which includes the combo box of predefined
scales and a shortcut button to match the current map scale.
These algorithms calculate the boolean OR or AND for a set of input
rasters. For AND, if all of the input rasters have a non-zero value
for a pixel, that pixel will be set to 1 in the output raster, otherwise
it will be set to 0. For OR, if ANY of the input rasters have a non-zero
value for a pixel, that pixel will be set to 1 in the output raster,
else 0.
A reference layer parameter specifies an existing raster layer to use
as a reference when creating the output raster. The output raster will
have the same extent, CRS, and pixel dimensions as this layer
By default, a nodata pixel in ANY of the input layers will result in
a nodata pixel in the output raster. If the 'Treat nodata values
as false' option is checked, then nodata inputs will be treated the
same as a 0 input value.
Makes for much simpler raster boolean logic calculation without
the complexity of using the raster calculator (and that's not
always possible to do anyway, e.g. when ANY of the input rasters
has a nodata pixel). It's also scalable dynamic to any number of
input rasters (unlike raster calc), so is more flexible when
used within models.
Fixes:
- enum parameters set to "allow multiple" only allow a single
value selection when used in modeler
- optional enum parameters cannot be set to no value when
used outside of modeler
Fixes#20406
And add a Processing setting to allow these to be shown. When shown, they
are highlighted in red with a tooltip explaining that the algorithm
has known issues