2

In the Graphical Modeler of QGIS, I don't see a way to import a layer into GRASS. The modules "import loaded raster" are not accessible in the Modeler.

I want to use GRASS reclassify module, because SAGA's doesn't save the data entered as a "simple table", forcing me to re-enter the values in the table each time I want to run the model.

But GRASS reclass modules don't work in the Modeler for a lack of loaded rasters.

The rasters I use in the modeler are first treated using non-GRASS algorithms. So I can't just load the rasters into GRASS outside of the Modeler.

Here I may be wrong. Could I load all rasters into the GRASS plugin before opening the Modeler? And then use the GRASS algorithm via the Modeler on them?

  • Processing takes care of importing and exporting. You don't need to load any data into GRASS' internal format to use it in Processing. If this does not work, it's a bug. – underdark Mar 27 '16 at 21:09
1

Perhaps this might help: http://gracilis.carleton.ca/CUOSGwiki/index.php/Automating_Vector_and_Raster_Workflows_using_the_Graphical_Modeler_in_QGIS

GRASS etc. is available in the modeller, when you turn the processing toolbox interface to 'advanced' (cp. link above).

  1. Add a raster layer to modeller and give it a suitable name. This must be thought of as a variable and is later referred as input of the grass modules:

enter image description here

  1. When you add an algorithm (GRASS r.info in my example), the input raster allready shows the name given to the raster layer in step 1. (here: 'myraster') since you have only one raster in this example. Keep in mind: At this point, the raster layer is only a parameter (or variable).

enter image description here

  1. When having saved and running the script, in the dialog you are prompted for a layer that is assigned to raster layer parameter 'myraster' created above. This can be any raster layer loaded in QGIS at this moment.

enter image description here

In QGIS modeller, you do not directly add layers, but parameters or variables holding the data at runtime.

(hope my german gui doesn't matter)

  • Thanks, Jochen, for your prompt answer. Yes, GRASS is available in the modeler, but not its raster import functions. How do I proceed, then, if my model includes both GRASS and non-GRASS algorithms? How do I pass the output of a QGIS/SAGA algorithm to a GRASS algorithm? – Marc Mar 25 '16 at 13:18
  • i add a short description in the above answer... – Jochen Schwarze Mar 25 '16 at 13:28
  • Generally you give the output a name that can be used as the input for subsequent algorithms. – Jochen Schwarze Mar 25 '16 at 14:02
  • Thanks, Jochen, but my concern is another one. What you show me works only if you have loaded your raster "...Forchheim" into GRASS prior to creating the model. If you hadn't loaded the raster into GRASS before, you would have got "Error executing algorithm r.info - Output basic information about a raster layer. [Errno 2] No such file or directory". My point is that you can't programmatically, via the Modeler, assign a raster to GRASS. – Marc Mar 25 '16 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.