I was wondering if it's possible to use Python and QGIS out of QGIS environment (namely, avoiding the use of the console). I'm pretty new to QGIS, I've been always using ArcGIS 10.1. What I am looking for is a thing similar to that "arcpy" module, since I work with tons of data at a time. Moreover, I'd like to use a good IDE, any suggestion? I'm using qgis 1.8, python 2.7.2 32bit, windows 7 64bit. P.S.: I couldn't really come up with a solution, neither following the instructions found in http://www.qgis.org/pyqgis-cookbook/intro.html#python-applications. Hope someone will enlight me!
Under the hood QGIS uses GDAL/OGR for most of the functions. So, the Python API for GDAL would be the closest analogy to using ArcPY in a stand-alone situation.
You can use the installation that comes with QGIS or have a separate installation of Python and GDAL. Other addons that complete the 'package' I would include
The last two are particularly relevant for raster processing. Have a look here for a tutorial on stand-alone geoprocessing using GDAL. This will get you going.
Yes building a standalone application out of QGIS using Python and the QGIS libraries is possible.
I have some small, but hopefully growing, example set at https://github.com/NathanW2/pyqgis-playground
The main thing is having the path the libraries setup correctly. When I'm on windows I use something like this:
@ECHO OFF set PYTHONPATH=C:\OSGeo4W\apps\qgis-dev\python Set PATH=C:\OSGeo4W\apps\qgis-dev\bin;%PATH% set QGISHOME=C:\OSGeo4W\apps\qgis-dev\ python yourfile.py
and I run it from within inside the OSGeo4W shell. You can test you have everything setup correctly by running the above
set commands inside a OSGeo4W shell and then doing:
C:\python Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>>>> import qgis.core >>>>>>
If it works you should get no errors.