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")
# Should do error checking as well, but this works!!
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:
processing.runalg("qgis:clip", layer, mem_layer, output)
There are several tools you can use to Drop\delete columns.
1 - Atribute table "delete column" tool
Open layer's attribute table;
Click on "delete columns" icon;
Select several columns using Pressing Ctrl;
2 - Use Table Manager Plugin
Install Table Manager Plugin using Plugins > fetch python plugins;
Click on ...
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 ...
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-...
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
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 ...
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 ....
Sure you can create and run R scripts in QGIS 2.0.
The basic sintaxis is the same as python, so start reading this:
Then you can check, some example scripts installed by default, in your processing panel.
If you need more help you can check ...
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
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.
it is the correct way, it's explained in the documentation
the next code work with in memory all except the last that it is load
drain=processing.runalg("grass:r.drain",MDT,"",(pun),False,False,False,"%f,%f,%f,%f"% (xmin, xmax, ymin, ymax),0,-1,0.00100,None)
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). ...
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 ...
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!)
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/...
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 ...
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.
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 "...
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.
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):
I found out what was wrong. No Layer call inside ggplot, here the right code:
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....
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):
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é ...
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?
Since the algorithm you want to use is part of saga, you could use saga directly.
eg from a batchfile:
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