Python bindings for QGIS.

learn more… | top users | synonyms

0
votes
0answers
5 views

How I can get coordinates by clicking on the QGis Canvas with PyQGIS?

Please, does anybody knows if there are any procedure on QgsMapCanvas (pyqgis, qgis) in order to obtain a pair of coordinates by clicking on the map canvas? Are there any python code I can see?
1
vote
0answers
11 views

Add a new polygon to an existing shapefile from wkt in QGIS

I have a layer of polygons in QGIS; I want to add programatically (pyqgis) a new polygon to this layer using WKT. Example: mywkt = POLYGON ((522762 376413 0,530635 368671 0,522237 353713 0,522762 ...
0
votes
2answers
32 views

Error while importing CSV File using PyQGIS

Currently I am trying to import a CSV file using the python extension in QGIS and I have run into a problem that I can not seem to solve. I am trying to do a basic import of a CSV file from a python ...
4
votes
1answer
285 views

How to write scripts that can call on both Arcpy and PyQGIS?

I have spent quite a bit of time looking for a clear answer this topic and have still been unable to really accomplish my goal of accessing PyQGIS in a stand alone script. Parts of answers have been ...
1
vote
1answer
24 views

What causes this error when loading plugin

After installing pyspatialite on my Mac two plugins fail to load with this error:: This plugin is broken invalid literal for int() with base 10: '2-spatialite' I am fairly sure that the offending ...
0
votes
1answer
36 views

How to integrate pascal code into a QGIS model or plugin?

I have a console program that is written in pascal (lazarus) that reads in some raster files and parameter values as input. The code use dynamic 2D arrays to represent the rasters. I would like to ...
4
votes
1answer
125 views

How can I modify layer order with the QGIS python API

Typically, after a new_layer = addRasterLayer(...) that inserts new_layer before the active layer, I'd like to move it to the top of the table of contents. How to do it? I use an existing QGIS ...
4
votes
1answer
132 views

Can I add entries to the layerlist context menu?

I am implementing a python based plugin for use with QGIS 1.8. Most of it's user interface is contained within a QDockWidget but there are some layer specific controls I would like to append to the ...
2
votes
2answers
121 views

Is there a function to select a region of a map for further processing with Python?

I would like to select a map's region in QGIS for further processing with python console. Ideally I would like to select the region with a mouse drag (like Gimp crop function) and then e.g. analyze ...
3
votes
1answer
753 views

Setting the extent for a QGIS map using python

I am writing a stand-alone application in Python/QGIS that simply creates maps. I want to load vector/raster layers, set symbology, set extent At the moment, that is all! Currently I am just using ...
0
votes
0answers
36 views

developer problem with PyQGIS

I am a QGIS developer. We have been modifying the source code of QGIS for several months and have done good work in QGIS version 2.1. After that we tried to do the same modifications for QGIS version ...
0
votes
0answers
23 views

pyQGIS : Way in order to know modifications?

I 'm writing a pyqgis script. I succeed in accessing gis vector data (lists) from my remote server (thanks to urllib) . I succed in displaying geometries and attributs. 1/ Now, i would like manage ...
0
votes
1answer
49 views

Print custom feature form using PyQGIS

I am looking for a way to print a custom feature form created in PyQt Designer for QGIS 2.4 using PyQGIS. My goal is to print/save image as the current extent of the map with the selected feature's ...
4
votes
2answers
710 views

How to use map composer in a stand-alone script?

I'm trying to follow the map rendering section from the pyqgis cookbook, but I'd like to test this as a standalone application. I can do the first part, using simple rendering, but I'm a bit stuck ...
0
votes
1answer
20 views

How to read Oracle data with PyQGIS? (“identifier is not long” error)

Do you have any idea how load Oracle spatial data to QGIS with using the PyQGIS? Is it possible? I try: uri = QgsDataSourceURI() uri.setConnection("*host*", "1521", "*database*", "*username*", ...
0
votes
0answers
60 views

QGIS 2.4: plugin changes map tool canvas click behavior from 2.0

I had created a plugin for QGIS 2.0 to add new features more easily. It involves changing extents and updating snapping options along with triggering the default actionAddFeature(). However, I've ...
0
votes
0answers
13 views

v.clean in QGIS Python console

I have tried to use v.clean and v.clean.advanced (by GRASS GIS) within a script in QGIS, and was not able. I followed instructions here:, but was not able to do so. I got message: "No module named ...
3
votes
3answers
1k views

QGIS 2 Python error on Mac OSX

Have just installed newly released QGIS 2.0. I installed the gdal package available at the official kyngchaos site. It seems to run ok, but when the program loads up I get a lengthy error message ...
1
vote
1answer
117 views

How to save after using fet.setFeatureId in pyQGIS?

By using the following code, I want to change the id of the line when saving the line. But the setFeatureId command, gives a false when doing the commitChanges(). Any idea how to change the id? vl = ...
0
votes
1answer
23 views

PyQGIS - QgsMapToolEmitPoint

I would like to make use of Signal and Slot while using PyQgis along with PyQt4. Despite spending some time trying out tutorials and some somewhat related post on gis.stackexchange I can't figure out ...
1
vote
1answer
355 views

QGis 2.0.1 mapserver extension missing

I tried to export my Qgis projects to mapserver, using RT mapserver extension, because there is not any other extension in my version of QGis.(QGis 2.0.1 Dufour on ubuntu 12.04 LTS). After installing ...
1
vote
1answer
32 views

How to interact with other layers in a QGis Python init function?

I am using QGis and making a Python script that sets the Python Init function to a custom UI file. I have a function with the following signature: def formOpen(dialog, layer, feature): ... I ...
0
votes
0answers
19 views

Error when providing “Python init function” from Python script in QGis

Problem I am using QGis and Python scripting to programmatically set a layer's edit form and "Python init function". It appears that the Python init function is called correctly in one situation ...
1
vote
1answer
51 views

Import error when utilizing QGIS's Python Init function

Based on the answer to Referencing Qt UIs external to plugin with python. I'm trying to utilize the "Layer Properties / Fields / Python Init function" to execute a file (test_file.py) that is located ...
6
votes
4answers
1k views

How to get features based on their attributes using Python?

How to Get features by their attributes (similar to Iqueryfilter in arcobjects) in Qgis using python? Instead of getting all features and filter it manually, is there any option to use whereclause to ...
4
votes
1answer
282 views

QGis Zonal Statistics Plugin NoData included in Calculations

I have been trying to use the QGIS zonal statistics plugin. My raster has a nodata value of -99999 and all other values are positive. After computing the mean zonal statistics there are a number of ...
2
votes
1answer
491 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
0
votes
0answers
21 views

QgsMapRenderer to export current extent using PyQGIS

I am trying to accomplish PyQGIS simple map rendering via the QGIS 2.0 Python console, but end up with only a blank image. I've followed instructions of this link. My objective is to export a simple ...
0
votes
0answers
43 views

gdal_translate from within pyqgis [duplicate]

I want to use gdal_translate from within a python script in my plugin qgis2leaf. I've tried with ...
0
votes
2answers
383 views

How to display data from a feature?

I want to display data based on the feature currently selected/clicked on. I am following a tutorial from http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html. It initially shows you how ...
1
vote
2answers
36 views

How to switch to edit mode vector layers, in pyqt application based on qgis?

I do QGIS based application, I need to implement the ability to modify the geometry of vector layers in manual mode (editing nodes), how to do it?
2
votes
1answer
228 views

pyQgis in stand alone script, vector loading error

I am trying to use the Qgis functions in a stand alone Python script. I m running Mountain Lion OS, 2.7 Python & the Qgis 2.0.1 Dufour. My main problem is that I cannot get started - I cannot ...
1
vote
2answers
135 views

How to get the file paths of the loaded layers in a QGIS plugin?

I am very new to GIS, QGIS and Python so please bear with me. I am using QGIS 2.0 and I would like to develop a QGIS plugin that would display the raster layers of the main window in order to allow ...
0
votes
0answers
21 views

QGIS - Calling interpolation extension from python console

I would like to call the QGIS interpolation extension function (TIN method) (Raster->Interpolate) from python console. I can't find the corresponding function within QGIS API or within the ...
0
votes
1answer
39 views

How to open, modify and save a QGIS project with PYQGIS

I need to create a stand-alone script for opening a QGIS template project, modify a layer data source, export the Composition and finally save the modified .qgs project into a new file. So far I have ...
3
votes
1answer
160 views

Load and display a layer using PYQGIS

I'm having a go at using pyqgis from within the QGIS python console to load a layer from SQL Server and display it. I feel like I'm part way there but I'm having a real issue getting the layer to ...
1
vote
1answer
48 views

How to programmatically export a composition as image?

QGIS Print Composer has tool "Save As Image" and I found appropriate function in QGIS source code exportCompositionAsImage. Is it possible to get access to existing Print Composer from Python console ...
2
votes
1answer
66 views

How to implement 1:n joins with string attribute concatenation?

I have a question concerning pyQGIS. I'm a QGIS long-time (self-learned) user, but just a pyQGIS newbie. I want to implement 1:n spatial join with attribute concatenation in the table. I have a vector ...
2
votes
1answer
339 views

Python Script that calls the Voronoi Polygons Function?

I've been looking to see if there was a way to call Voronoi Polygons function found in Vector/Geometry Tools, directly from the code but I have not found one. Does this currently exist? Is there a way ...
0
votes
0answers
36 views

Couldn't load PyQGIS in QGIS 2.2 on Ubuntu 14.04 [duplicate]

This issue appears to be occurring with some frequency to folks in some shape or form. I upgraded from ubuntu 12.04 to 14.04, with loss of python functionality. My QGIS version is 2.2 from the ...
0
votes
1answer
32 views

QGIS API documentation in French?

I am looking for a document which explains what the API of QGIS is, with examples of this API but in French.
0
votes
1answer
188 views

clip one layer with the current map layers

I work in a little companie where the main goal of employees in GIS is to have a quick view of the issues on a study area. It would be very useful to have a tool wich clip all the layers of the ...
2
votes
1answer
58 views

How to find the id of the last added feature using pyQGIS?

Is it possible to programmatically (in python) access the attribute info of the last added feature in QGIS 2.0 before edits are saved? I'm failing to find a way to get the ID and subsequently other ...
1
vote
2answers
53 views

How to get features based on their attributes using Python - special characters?

I want to get features based on their attributes and it works fine when I use this Python script: canvas = iface.mapCanvas() curLayer = canvas.currentLayer() it = ...
2
votes
1answer
113 views

How to show in a custom QGIS form the feature and/or geometry info?

I need to show point coordinates on the from dialog used to edit the attributes of a point.. I see that in the formOpen the dialog receives a layerId and a featureId, but no iface object, so how can ...
0
votes
0answers
19 views

Is it possible to customize openFeatureForm of pyqgis?

I am a beginner in PyQgis. I am trying create a plugin, which will be used to AddFeatue,Delete Feature, and Edit the Feature. It is more customized than which is provided by Qgis (2.2). I am capturing ...
0
votes
0answers
20 views

'QgsGraph' object does not support indexing

Traceback (most recent call last): File "/home/kasun/.qgis2/python/plugins/floogin/floogin.py", line 246, in findRoutes path=self.astar.astarSearch(graph, start, end) File ...
1
vote
1answer
225 views

QGIS Updating composer label text via python - problem with Item Properties panel

I am writing a plugin that replaces the text of a composer label based on its itemID. When I change the text of the label using: item.setText("Hello World") the label changes on the composer but ...
0
votes
1answer
320 views

Getting error in compiling make file for plugin build in qgis 1.8

I am using QGIS 1.8 for building plugin. For developing i am using following ref this link example. where in this step 6 where compile the makefile in OSGeo4W. gives error pyuic4:command not found. I ...
0
votes
0answers
10 views

search for examples of plugin of Multiple buffers [duplicate]

I am loooking for examples of plugin for Multiple buffers to help me to create a new one .