5111 Commits

Author SHA1 Message Date
Nyall Dawson
4f8e2317d7 [processing][saga] Fix definition of Multiple regression points/grids alg
Fixes #21146
2019-02-01 21:06:16 +11:00
Nyall Dawson
56e465cc8a [processing][needs-docs] Resurrect ability to convert models to scripts
Brings back QGIS 2.18's ability to directly convert a Processing model
to an equivalent Processing Python script algorithm, correctly
updated and working in the 3.x API.

Available from the model dialog, and from the right-click context
menu on an existing model.

Sponsored by Solspec
2019-02-01 17:54:28 +11:00
Nyall Dawson
f77cf4fae4 [processing] Formalise object design for ContextAction, allow icons to be set 2019-02-01 17:54:28 +11:00
Alexander Bruy
85e3b2db6e [processing] fix v.net.report and v.net.nreport 2019-01-31 16:31:35 +02:00
Alexander Bruy
b9f559ee04 [processing] fix broken stdout handling in GRASS algs (fix #21142) 2019-01-31 15:54:08 +02:00
Alexander Bruy
a911ef3367 [processing] fix output generation in v.net and add test 2019-01-31 15:54:08 +02:00
Alexander Bruy
dbe2cb73ad [processing] add test for v.net.distance algorithm 2019-01-31 15:54:08 +02:00
Alexander Bruy
3abea36000 [processing] snap points to network by default (fix #19904)
Kudos to Pedro Venâncio for finding solution for this bug
2019-01-31 15:54:08 +02:00
Nyall Dawson
4f6df2980f [processing] Fixes to distance inputs for models
- fix parameter can get converted to plain number parameter after edits
- allow parameter to be linked to parent parameters, so that the
correct distance unit and choices are shown for the parameter
2019-01-31 17:53:25 +11:00
Nyall Dawson
5bfec27938 [processing] do not show geometryless layers in extent selector
Fixes #21129
2019-01-31 17:52:29 +11:00
lbartoletti
2e92dabd20 [Processing][Grass] Add the possibility to return a shp if ogr is not compiled with gpkg 2019-01-31 09:55:29 +11:00
Alexander Bruy
19dcfb987b don't export features without category by default 2019-01-30 10:40:29 +02:00
Alexander Bruy
0cc483f621 set default value for newly added parameter 2019-01-30 08:12:22 +02:00
Alexander Bruy
67bc586036 fix formatting 2019-01-30 08:12:22 +02:00
Giovanni Manghi
5f99955b45 do not always use the -c flag to export vectors from GRASS 2019-01-30 08:12:22 +02:00
Juergen E. Fischer
806ae861e1 osgeo4w: rely on GRASS' GISBASE environment variable instead of
detecting the path (ie. use the same version for processing as the
version that the grass plugin uses)
2019-01-29 23:03:58 +01:00
Nyall Dawson
7f7c7a9789 [processing][needs-docs] Add friendlier API for running algorithms as sub-steps
of main algorithm

Using code like:

    buffered_layer = processing.run(..., context, feedback)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}

can cause issues if done as a sub-step of a larger processing algorithm. This
is because ownership of the generated layer is transferred to the caller
(Python) by processing.run. When the algorithm returns, Processing
attempts to move ownership of the layer from the context to the caller,
resulting in a crash.

(This is by design, because processing.run has been optimised for the
most common use case, which is one-off execution of algorithms as part
of a script, not as part of another processing algorithm. Accordingly
by design it returns layers and ownership to the caller, making things
easier for callers as they do not then have to resolve the layer reference
from the context object and handle ownership themselves)

This commit adds a new "is_child_algorithm" argument to processing.run.
For algorithms which are executed as sub-steps of a larger algorithm
is_child_algorithm should be set to True to avoid any ownership issues
with layers. E.g.

    buffered_layer = processing.run(..., context, feedback, is_child_algorithm=True)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}
2019-01-29 18:04:16 +11:00
Víctor Olaya
6eaa511eed [processing] show warning when file-based layer could not be loaded and dependent params updated
For algorithms with multiple parameters depending on a vector layer parameter, the code that loads the layer in the background is called repeatedly, impacting performance. A small layer cache is implemented with these changes, so the dialog only tries to load the layer once.
2019-01-29 11:12:23 +11:00
Alexander Bruy
8446d3bdf0 [processing][needs-docs] native vector split algorithm now outputs
GeoPackages instead of shapefiles (refs #20557)

Also remove default output extension Processing settings as they are not
used anymore.
2019-01-29 11:05:37 +11:00
Víctor Olaya
1b4a9132c2 [processing] avoid exception when listing DB schemas
do not fail if cert file cannot be deleted when creating GeoDB object

fixes #21099
2019-01-29 08:01:20 +11:00
Juergen E. Fischer
febbc4f0b9 osgeo4w: handle grass svn versions (fixes #21114) 2019-01-27 17:37:39 +01:00
Nyall Dawson
431861a468 [processing] Add a better API for specifying that outputs are temporary
Instead of requiring clients to generate temporary file names themselves,
(or use the cryptic "memory:" string!), this PR adds a static constant

    QgsProcessing.TEMPORARY_OUTPUT

If a layer/sink output parameter is set to QgsProcessing.TEMPORARY_OUTPUT,
then the temporary output filename will be generated automatically at
algorithm run time. This means callers don't need to mess around with
finding appropriate temporary folders and paths.

Another benefit is that TEMPORARY_OUTPUT is stored in the processing
history, so if you re-run a previous algorithm which was set to
output to a temporary file, it no longer tries to use that same
previous temporary path and instead generates a new one.
2019-01-25 23:27:08 +11:00
Alexander Bruy
a90fb87c8e
Merge pull request #8973 from alexbruy/grass-buffer
[processing] fix GRASS v.buffer algorithm for variable buffer case (fix #19377)
2019-01-25 12:49:12 +02:00
Nyall Dawson
3cb6a40ef2 [processing] Add API to get an import statement and classname for a parameter type 2019-01-25 18:12:11 +11:00
Alexander Bruy
8919d604a8 [processing] use background color from the project settings in the rasterize algorithm (fix #19866) 2019-01-25 10:06:12 +11:00
Alexander Bruy
32f6034be7 [processing][needs-docs] force multipart output from GDAL-based dissolve
algorithm (fix #20025)
2019-01-25 09:57:31 +11:00
Alexander Bruy
bfb60e4dc7 [processing] fix GRASS v.buffer algorithm for case when buffer distance
is taken from the field (fix #19377)
2019-01-24 21:01:12 +02:00
Matthias Kuhn
7482f7a448
Merge pull request #8957 from volaya/#19607
[processing] do not allow editing model if it's missing algorithms
2019-01-24 19:53:12 +01:00
Matthias Kuhn
9bdaac9dd0
Update python/plugins/processing/modeler/EditModelAction.py
Co-Authored-By: volaya <volayaf@gmail.com>
2019-01-24 10:50:19 +01:00
Alexander Bruy
c6540a6276 [processing] fix description files for SVM SAGA algs (fix #20796) 2019-01-24 09:31:18 +11:00
Alexander Bruy
34ec183354 [processing] split v.surf.rst algorithm into two (fix #19472)
This algorithm cannot output cross-validation results and topographic
parameters simultaneously, hence two tools needed. Thanks to Pedro Venâncio
for finding this and proposing a fix.
2019-01-24 06:45:23 +11:00
volaya
a86965e94b [processing] do not allow editing model if it's missing algorithms
fixes #19607
2019-01-23 14:02:42 +01:00
volaya
e3516ab1b4 [processing] fixed qgis algorithms help file
fixes #20966
2019-01-23 08:38:41 +01:00
Nyall Dawson
db3b9aeb6b Revert "[processing] hide 'select file' button for vector layers when there are dependent params"
This reverts commit f2044528951bbb09a70b9c696d79d8cd5b756214.

It's a contentious fix, which needs discussion
2019-01-23 17:30:47 +10:00
volaya
eb47288fac [processing] correctly set output styles for models
fixes #20573
2019-01-23 08:02:19 +01:00
volaya
f204452895 [processing] hide 'select file' button for vector layers when there are dependent params
fixes #21055
2019-01-23 08:02:18 +01:00
Alexander Bruy
0c4c8feb70
Merge pull request #8945 from alexbruy/processing-fieldcalc
[processing] use active layer by default in field calculator algorithm (fix #19686)
2019-01-22 15:25:20 +02:00
Alexander Bruy
3a98174640
Merge pull request #8942 from alexbruy/processing-interpolation
[processing] use complex delimiter for interpolation data (fix #20490)
2019-01-22 14:03:57 +02:00
Alexander Bruy
95209d134c [processing] use active layer by default in field calculator algorithm
(fix #19686)
2019-01-22 11:04:49 +02:00
Alexander Bruy
17fd86e723 [processing] use complex delimiter for interpolation data to avoid
overlaps with charactes which can be used in the layers source URI (fix #20490)
2019-01-22 10:15:07 +02:00
Alexander Bruy
133b4057a6 add note about format of the srcnodata parameter 2019-01-22 08:18:37 +02:00
Alexander Bruy
dc2b29ce6a [processing] add missed "srcnodata" parameter to the buildvrt algorithm
(fix #20586).

Without this parameter it is not possible to remove collars surrounding
input raster which may overlap with other input rasters. As this is very
frequent case algorithm is useless without such parameter. To keep API
compatibility new parameter is optional and not used by default.
2019-01-22 08:17:47 +02:00
Nyall Dawson
ee34431214 Use a QHash instead of std::unordered_map
Because it turns out MUCH MUCH faster
2019-01-22 13:14:03 +11:00
Alexander Bruy
bb2c3663b0 [processing] add optional EXTRA parameter to gdalwarp algorithm (fix #20721)
This allows users to pass additional command-line arguments which are
not exposed in the algorithm definition. The most frequent use case is
enabling transparency and adding nodata values.
2019-01-22 09:39:57 +11:00
Matthias Kuhn
9452667af3
Add native densify by interval algorithm 2019-01-21 09:49:38 +01:00
Matthias Kuhn
8db14d8fc2
Merge pull request #8906 from m-kuhn/native_polygons_to_lines
Add native polygonstolines algorithm
2019-01-21 09:11:01 +01:00
Nyall Dawson
195d98f43a [needs-docs][processing] Port SAGA raster surface volume to native QGIS alg
The SAGA version of this algorithm is of limited use in QGIS, because the
volume calculated is embedded only in the SAGA terminal output. This prevents
it being saved to a file, or reused within a model as an input to a later
model step.

It's also very user-unfriendly, because users must know to manually scan
the algorithm log to find the SAGA output.

Given that the maths here is trivial, this commit ports the algorithm across
to be a native QGIS c++ algorithm. The algorithm duplicates the SAGA alg
1:1, but outputs the volume (and area) to either a HTML report, or a vector
table. Additionally, the outputs are exported as numeric outputs from the
algorithm, allowing them to be re-used within models.

(It's also considerably faster, because it avoids the forced conversion
to SAGA raster format)

Fixes #8607 (properly, even though that report is closed)
2019-01-21 12:33:54 +11:00
Markus Neteler
8db3dead87
Complete grass76 support 2019-01-19 22:08:28 +01:00
Matthias Kuhn
4c8af20b51
Add native polygonstolines algorithm 2019-01-18 19:07:08 +01:00
Ivan Ivanov
2488f71ddb Added test for 'gdal_rasterize -init 0' 2019-01-18 09:50:08 +11:00