Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm looking for python documentation for specific operations in the Qgis python console. I know there is no suggestions simular to Arcpy but I would like a pure list of operation code lines as "layer.featureCount()"

Or is this taken from python standard librarys?

share|improve this question
2  
The official resources are linked in this post gis.stackexchange.com/a/3659/187 –  underdark Apr 11 '12 at 10:11

3 Answers 3

I find the cookbook below is a great start, although it doesn't cover everything.
PyQGIS Developer Cookbook: http://www.qgis.org/pyqgis-cookbook/
To go in deeper you need the QGIS API documentation: http://doc.qgis.org/api/ though this is pretty limited in explanation and is directed at C++ programmers. By comparing the API information with the cookbook examples, you can get the hang of the transformations needed to move from C++ to python usage. One of the difficulties in using QGIS plugins is lack of documentation - you have to invest a lot of time on the learning curve, I don't think there is any real shortcut at the moment.

share|improve this answer

Besides the resources linked by @underdark you can always use (as last resort, perhaps?) Python introspection to find out methods and attributes of any given python object.

For instance this will enumerate all methods/members available on the main qgis object:

 import inspect
 dict(inspect.getmembers(qgis.utils.iface)).keys()
share|improve this answer

If you use the Eric4 Python IDE, an editor built with PyQt (like PyQGIS plugins), the auto-completion and call tips for PyQGIS has recently been generated. This amounts to approx. 3,450 Python API calls for QGIS. The API files are available from this nabble.com web archive from the QGIS Developer email list.

There is a separate API file for the 'iface' instance object further down on the page. Instructions on using the .api files with Eric4 are in the initial download. They were built for the API as of QGIS 1.7.4.

share|improve this answer
    
Nice! You wouldn't know if anybody has done the same for Eclipse? I have never tried but apparently you can set up PyQt in Eclipse... so maybe Eclipse users could use your API files? Any ideas? Maybe this is worth another question rather than hijack this thread... –  MappaGnosis Apr 13 '12 at 9:01
    
The API files I mention here only work with QScintilla2- or PyQt-QScintilla2-widget-based editors (Eric4 is the latter).The QScintilla2 PyQt port is built by the maker of PyQt (Riverbank Computing, Ltd.) and is available at their site. –  dakcarto Apr 13 '12 at 20:35
    
Generation of the API files for QGIS was included in the master branch last week, allowing the API files to be generated when compiling the QGIS source. However, the API files will be that of the master branch (1.9.x) and include about 1,000 more API items than the current 1.7.x branch. If you want the API files for a particular branch, you will need to backport the changes, yourself, from <qgis-src>/python/CMakeLists.txt (the git diff is here). –  dakcarto Apr 13 '12 at 20:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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