Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
14

Aaaand I found it. Use processing.runandload, which loads the output layer into the table of contents after running the algorithm. processing.runandload("qgis:intersection", layer1, layer2, "memory:myLayerName") layer = QgsMapLayerRegistry.instance().mapLayersByName("memory:myLayerName")[0] # Should do error checking as well, but this works!!


11

As it turns out, this works fine as long as you add the memory layer to the table of contents before using it. It seems the dataobjects.getObjectFromUri function in the QGIS source can't handle it otherwise. So the following works very well: QgsMapLayerRegistry.instance().addMapLayer(mem_layer) processing.runalg("qgis:clip", layer, mem_layer, output) Also ...


8

There are several tools you can use to Drop\delete columns. 1 - Atribute table "delete column" tool Open layer's attribute table; Start editing; Click on "delete columns" icon; Select several columns using Pressing Ctrl; Click ok; Stop\Save editing; 2 - Use Table Manager Plugin Install Table Manager Plugin using Plugins > fetch python plugins; Click on ...


7

I've written to the SEXTANTE team to ask about this issue. This is the response I got: Other people have reported that those "tricks" that worked for 10 do not work for 10.1. We haven't tested it, but there are plans for doing some development on the ArcGIS version in collaboration with a team from an american university, and definitely that's our ...


6

So I tried some more things and came up with a solution. I will go over what I did step by step and hopefully this will work for others. First thing I did was uninstall qgis as completly as I know how sudo apt-get autoremove qgis sudo apt-get autoclean Then I removed the Ubuntugis-unstable PPA sudo apt-add-repository remove PPA:ubuntugis/ubuntugis-...


6

You can use Save as Python script The result is a script that you can use in the Toolbox or in the Python console ##Extract raster values (shapefile)=name ##vectorlayer_inputvector=vector ##rasterlayer_inputraster=raster ##boolean_reprojectvectortorastercrs=boolean false ##output_layer_alg1=output vector outputs_0=processing.runalg("script:pointsfromvector"...


5

You could craft your script to work with Gary Sherman's Script Runner plugin and run it from within QGIS. Re-running the script, after editing, should prompt Script Runner to reload the module and reflect your changes. See also: Script Runner's plugins.qgis.org listing. The essentials are to make sure you have a run_script function, which gets called by ...


5

EDIT: I'm going to see if this bug is related (http://hub.qgis.org/issues/8012). UPDATE: Looks like there are some issues with R in the sextante plugin for both qgis and qgis-dev. I'll file some bug reports if they haven't been already. But the two issues with R in sextante are: 1) In qgis (stable) SEXTANTE doesn't seem to use the rlib path in the Users ....


5

Sure you can create and run R scripts in QGIS 2.0. The basic sintaxis is the same as python, so start reading this: http://www.qgis.org/es/docs/user_manual/processing/console.html#creating-scripts-and-running-them-from-the-toolbox Then you can check, some example scripts installed by default, in your processing panel. If you need more help you can check ...


5

A cool little trick with QGIS is being able to isolate all the user files and folders along with all the settings into a different location. QGIS can be started with the --configpath and --optionspath swtiches to redirect any of the settings or options to a different folder. An example of doing that with QGIS 2.0 is: SET QGIS=%PROGRAMFILES%\QGIS Dufour ...


4

Thanks to Volker Wichmann from SAGA GIS forums. If you want to change the cell values to null you can use Saga reclassify grid values from Sextante. Enter the -99999 which will be null on the option for new values for other values. Saga accepts -99999 value as NoData.


4

I have it configured and working well with QGIS 1.8. I decided to have SAGA in a folder without spaces. ( not sure if that affects function). Configuration screenshot attached.


4

Sextante has to be initialized, so it loads the algorithms and can later execute them. Call Sextante.initialize() before doing anything.


4

In QGIS 1.9 you can choose between "Simplified interface" and "Advenced interface" under the SEXTANTE toolbox. Simplified hide all external algorithms, probably this is your problem.


4

it is the correct way, it's explained in the documentation http://docs.qgis.org/2.14/es/docs/user_manual/processing/console.html the next code work with in memory all except the last that it is load MDT=path/mdt.tif drain=processing.runalg("grass:r.drain",MDT,"",(pun),False,False,False,"%f,%f,%f,%f"% (xmin, xmax, ymin, ymax),0,-1,0.00100,None) vect=...


4

Hello Moran's I and Geary's C are in fact inversely related to one another. So the general pattern that you're observing seems consistent. However, the possible range of values for Moran's I is -1 to 1 (where -1 indicates a perfect negatively spatial autocorrelation--think of a chess board pattern--and 1 indicates a perfect positive spatial autocorrelation). ...


4

Sextante is now known as Processing and is a core plugin (no need to install). OTB, if using Kyngchaos.com QGIS installer, is included inside the QGIS.app bundle. Processing should be able to access the OTB applications within the QGIS.app bundle, i.e. with the Kyngchaos.com installer Processing should just work out-of-the-box. Also bundled within the ...


3

A simple way of getting rid of the attributes is to rightclick on the layer -> Save As... and check Surpress attribute creation. If you have many files, you could use: ogr2ogr -select field_list destination_file source_file to select fields you want (default is all!)


3

In QGIS in "Processing" options, select "Options and configuration", SAGA and uncheck the option "Enable SAGA 2.0.8..." I'm working in ubuntu 12.04 and with SAGA 2.1.1


3

Isn't it obvious that you need to install SAGA first? If SAGA is installed check in SEXTANTE settings if it is activated. Install python-saga module. Also check out this post on setup SEXTANTE for Ubuntu. If none of this helps the reason may be that SEXTANTE is looking for SAGA modules in the wrong directory. The default path to SAGA algorithms is /usr/lib/...


3

Sextante is mainly a library to be used from a gis desktop application like gvSIG, qgis or ArcGIS. If you want to use any of the algorithms of Sextante on postgis layer, just choose any a gis desktop app, load the postgis layer, and use Sextante on it, as if it was a shapefile. For example gvSIG comes with Sextante an a lot of algorithms without the need ...


3

For new users reading this post, there is a way of running QGIS processing algorithms in standalone PyQGIS scripts. Check answers to Import error for qgis.core when running OSGeo4w shell script and How can I access `processing` with Python?, which provide you with tested examples.


3

Processing scripts are scripts on their own and need to be programmed (ether in Python or R) exclusively for Processing. Thats also the reason why not all possible tools are written as Processing Script. Someone has to do it :) Regarding the functions you need (which are already partly available in some form): Add delimited text layer Implemented as "...


3

You might consider using GRASS (which interfaces with QGIS) for this process. See this link for more information: http://grasswiki.osgeo.org/wiki/LANDSAT The answer provided by @markusN on this question provides additional information and examples of what GRASS can be used for with Landsat-8.


3

So why doesn't it work? Look at your code, specifically the line with the attribute fields. You need to point R/QGIS directly towards the field data vectors unless you attach them beforehand. The following code works without issues for me (provided that you have installed ggplot2): ##Vector processing=group ##showplots ##Layer=vector ##Field1=Field Layer ##...


3

I found out what was wrong. No Layer call inside ggplot, here the right code: ##Vector processing=group ##showplots ##Layer=vector ##a=Field Layer ##b=Field Layer library("ggplot2") ggplot() + geom_point(aes(Layer[[a]], Layer[[b]])) Cheers


3

What happens when you run a .rsx script ? You must examine the Rutils.py script It creates a temporary R script with the desired command (/.qgis2/processing/processing_script.r) and use the Python module subprocess to execute it command = "R CMD BATCH --vanilla " + RUtils.getRScriptFilename() + " "+ RUtils.getConsoleOutputFilename() proc = subprocess....


3

You can use the solutions given in Using processing algorithms from the console: But if you look at what's in the module (version 2.2): import processing dir(processing) no more getfeatures() or getFeatures() You can control this with a little function adapted from Script de Python para filtrar por patrón de texto los métodos de Clases en PyQGIS de José ...


2

According to How to run a simple python script for QGIS from outside (e.g. Sublime Text)? you can't get a reference to the iface object here because it doesn't exist in this context since this is being run outside of QGIS. Any progress?


2

Since the algorithm you want to use is part of saga, you could use saga directly. eg from a batchfile: @ECHO OFF REM SET SAGA_MLB = C:\SAGA\Modules REM SET PATH = %PATH%;C:\SAGA saga_cmd ta_morphometry "Slope, Aspect, Curvature" -ELEVATION=elevation.sgrd -SLOPE=slope.sgrd -ASPECT=aspect.sgrd -CURV=NULL -HCURV=NULL -VCURV=NULL -METHOD=5 PAUSE


Only top voted, non community-wiki answers of a minimum length are eligible