Re: [Qgis-user] How to run SEXTANTE algorithms outside of QGIS Python console?

2013-05-15 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 14/05/2013 23:04, Martin Lacayo ha scritto:

 Our software (naturalcapitalproject.org) is developed on Linux but
 packaged for Windows.

Hi Martin,
could you please let us know more about this?
I do not see any reference to QGIS.
All the best.
- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlGTJgEACgkQ/NedwLUzIr60JgCeMZzOh+96CESwhbjdKFZ9Hlg4
BycAnicpMj4TZosMXotgIg9Xo+luGxtu
=j3ao
-END PGP SIGNATURE-
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] How to run SEXTANTE algorithms outside of QGIS Python console?

2013-05-15 Thread Martin Lacayo
Hi Paolo,

I just disabled digest mode, but hopefully this will be part of the same thread.

My question is more specifically about SEXTANTE, if there is a better
forum for this please let me know.

My question is how to run SEXTANTE algorithms outside of QGIS Python
console. Is this possible? The closest answer I found was on
StackExchange here:

http://gis.stackexchange.com/questions/28701/how-to-run-sextante-algorithms-outside-of-qgis-python-console

The code provided runs, but when I add a call to sextante.runalg it
raises an error related to iface, which seems to be something from
QgisInterface.instance(). Specifically I get an AttributeError because
iface == None. Another related post indicated that this kind of error
is because the code is being run outside of QGIS and therefore there
is no iface that could be referenced. In the code there is a commented
out line that looks like a QGIS instance is wanted, but it wasn't
working. Any suggestions?

What would be most helpful is if someone could modify the code to
include a single SEXTANTE call that executes any algorithm, preferable
one from GRASS.

Thank you.

Here is the code:

import sys
from PyQt4.QtGui import QApplication
from sextante.core.Sextante import Sextante

def main():
 main function or something 
# as per 
http://qgis.org/pyqgis-cookbook/intro.html#using-pyqgis-in-custom-application
from qgis.core import *
import qgis.utils

app = QApplication(sys.argv)
# supply path to where is your qgis installed
QgsApplication.setPrefixPath(C:/OSGeo4W/apps/qgis, True)
# load providers
QgsApplication.initQgis()
# how???
# qgis.utils.iface = QgisInterface.instance()
Sextante.initialize()
run_script(qgis.utils.iface)

def run_script(iface):
 this shall be called from Script Runner
Sextante.alglist()
Sextante.alghelp(saga:slopeaspectcurvature)

if __name__==__main__:
main()



-Martin

 Date: Wed, 15 May 2013 08:06:57 +0200
 From: Paolo Cavallini cavall...@faunalia.it
 To: qgis-user@lists.osgeo.org
 Subject: Re: [Qgis-user] How to run SEXTANTE algorithms outside of
 QGIS Python console?
 Message-ID: 51932601.9080...@faunalia.it
 Content-Type: text/plain; charset=ISO-8859-1

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Il 14/05/2013 23:04, Martin Lacayo ha scritto:

 Our software (naturalcapitalproject.org) is developed on Linux but
 packaged for Windows.

 Hi Martin,
 could you please let us know more about this?
 I do not see any reference to QGIS.
 All the best.
 - --
 Paolo Cavallini - Faunalia
 www.faunalia.eu
 Full contact details at www.faunalia.eu/pc
 Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAlGTJgEACgkQ/NedwLUzIr60JgCeMZzOh+96CESwhbjdKFZ9Hlg4
 BycAnicpMj4TZosMXotgIg9Xo+luGxtu
 =j3ao
 -END PGP SIGNATURE-


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


[Qgis-user] How to run SEXTANTE algorithms outside of QGIS Python console?

2013-05-14 Thread Martin Lacayo
Hello,

I would like to make calls to GRASS and other packages available via
SEXTANTE. How can I do that?

I found this post which is very close to answering the question:

http://gis.stackexchange.com/questions/28701/how-to-run-sextante-algorithms-outside-of-qgis-python-console/60725#60725

However when I try calling sextante.runalg I get an error seemingly
related the fact that the code is not being run inside the QGIS Python
console (qgis.utils.iface is None).

Our software (naturalcapitalproject.org) is developed on Linux but
packaged for Windows.

Any suggestions?

Thank you,
Martin
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user