Python bindings for QGIS.

learn more… | top users | synonyms

1
vote
1answer
72 views

How to get access to layers without geometry?

I have a QGIS project with some layers without geometry. I develop a QGIS plugin. I want to get all my layers by: iface.mapCanvas().layers() but I get only layers with geometry. How I can get ...
0
votes
0answers
90 views

How to create a Layer from a list of points in PyQgis

I`ve developed an algorithm that generated an two dimensional array with points. Each subList of this array must be displayed as an polygon on the map view, and the recently created Vectors should be ...
3
votes
1answer
106 views

Get features in order they are selected using QGIS

Is there a way of establishing the order that a user selected features using QGIS and Python? By example: we have a network of line features representing a road network, and the user defines a route ...
1
vote
1answer
96 views

How to show QGIS plugin dialog always on top?

Is it possible to define for a pyqgis plugin, that the plugin dialog is always shown on top, after starting it from the toolbar?
1
vote
2answers
138 views

How can I define the layer CRS for a memory layer in pyqgis

how can I define the CRS for a memory layer from the qgis project settings vpoi = QgsVectorLayer("Point", "vectpoi", "memory") feature = QgsFeature() ...
0
votes
1answer
137 views

How to obtain rotation field name defined in the Labels “Data Defined” section in pyqgis?

I'm trying to find how to get with the QGIS Python API the layer field name that contain the rotation angle used by a layer to rotate its labels? I know that I can obtain the field name containing ...
2
votes
2answers
287 views

How to change the color of a vector layer in pyQGIS?

Is it possible to change the color while adding a vector layer? I have a vecot layer with water areas and want to load it with a blue color. The layer is added with: ...
0
votes
0answers
81 views

How to use the QgsMapToolIdentify in PyQgis?

I'm trying to implement the QgsMapTollIdentify class in a stand alone app but I can not. I am a newbie in Pyqgis and would like to ask how do I implement this class in Python? Thanks! Completing, ...
4
votes
2answers
483 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
68 views

How to Resize the Qgis Main Window from python

I would like to write a plugin that simply resizes the qgis main window to make it small. How can I access the qgis main window through the qgis api? Use Case: We are having problems with qgis taking ...
0
votes
2answers
229 views

How to add a dynamic timeline to the QGIS canvas?

I am using the plugin Timemanager which works really great but there is one thing I'd like to improve. Instead of displaying the date and time on each frame, I would like to display a timeline ...
0
votes
0answers
61 views

How to change API version from 9.0 to 8.1 to load PyGIS

Traceback (most recent call last): File "", line 1, in RuntimeError: the sip module implements API v9.0 to v9.2 but the qgis.core module requires API v8.1
1
vote
0answers
106 views

Loading Vector Layer PyQGIS Issues

I am trying to follow PYQGIS documentation for loading a shapefile from inside a script. http://www.qgis.org/pyqgis-cookbook/intro.html I was able to set the datasource and run the QgsVectorLayer ...
0
votes
0answers
16 views

Problems loading PyQGIS Español [duplicate]

No se pudo cargar PyQGIS. El soporte para Python estará deshabilitado. Traceback (most recent call last): File "", line 1, in RuntimeError: the sip module implements API v9.0 to v9.2 but the ...
2
votes
0answers
129 views

How to render a transparent raster layer on top of one or more vector layers with PyQgis?

I been trying to render a map with a 3 vector layers and one raster layer. The idea is that the raster layer should be on top of the other 3 vector layers. The problem is that even when I add the ...
1
vote
0answers
30 views

Can I use the PyQgis QgisPluginLayer to create heatmaps?

I am working in an application to generate maps from a bunch of MIF/MID files, I already created almost all the maps that I need, but, now I want to create heatmaps. I can't find any way of creating ...
0
votes
0answers
18 views

QGIS & python: returning value from shapefile dbf [duplicate]

I'm trying to work out the python code in QGIS to return a value from a shapefile dbf. E.g. if I have a shapefile named "vlayer" how would I find the value in row 0, field 3? Sorry for such a basic ...
2
votes
1answer
89 views

Can one expose variables to the Python console from a plugin in QGIS?

I have a QGIS plugin that performs a long-running operation, eventually producing and loading new shapefiles into QGIS. (I have this as a plugin rather than just a function that can be called from the ...
0
votes
1answer
165 views

AttributeError: 'QgsFields' object has no attribute 'itervalues'

First of all, the code which is below gives me the attribute names of a shapefile correctly if I use PyScripter IDE: from qgis.core import * from qgis.gui import * from PyQt4.QtCore import * from ...
1
vote
2answers
60 views

How to avoid the CRS Dialog when creating a vector layer memory?

I am trying to create a vector memory in a plugin. Basing on some examples,I was able to create a memory vector layer and to add it in QGis with : QgsMapLayer.instance().addMapLayer(myLayer,True) But ...
0
votes
1answer
225 views

How to use SEXTANTE in a script outside QGIS?

I´m trying to do some geoprocessing using the QGIS Sextante plugin outside of the QGIS application (and integrate it with different other libraries like arcpy, etc.). import sys, os from PyQt4.QtGui ...
1
vote
1answer
182 views

Problem loading PyQGIS

There is a problem on my system when starting QGIS. I get this error. I am running openSuse Tumbleweed 64bit and openSuse 12.3 64bit. Same problem on both systems. Couldn't load PyQGIS. Python ...
1
vote
1answer
96 views

Pyqgis vector layer rollback and commitChanges

I have problems with the vector layer rollback and commitChanges function, it doesn't matter wich one i call the vector layer is is Changed.Here is my code i hope someone can help me. This is my firt ...
0
votes
1answer
150 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 ...
1
vote
2answers
145 views

How to add non spatial sqlite table to map using python in qgis?

Is it possible to load pure sqlite 2.0 (without spatial extension) table into qgis using python? I would like to get the same result as in the case of using Add Vector Layer -> All files. I have ...
0
votes
0answers
207 views

Problem compiling UI file generated by QGIS Plugin Buidler

I have used the plugin builder QGIS 1.8 to create an empty plugin. The next step is to compile the ui file using pyuic. pyuic.py runs but halts at the line with from PYQt4 import QTCore and an error ...
0
votes
0answers
57 views

How to add a group at the top of all groups in a legend?

I have six groups of layers added to the legend. After adding the new one using python, I can load layers then move them to this new group. Is it possible to create group at the top of all groups or ...
2
votes
2answers
217 views

How to create a circle vector layer with 12 sectors with Python/pyqgis?

From a given coordinate and radius I need to create a circle with 12 sectors. The sectors should start from north (0 degrees) in 30 degree steps clockwise. I could also imagine to create the sectors ...
1
vote
1answer
73 views

How to set default bad layers handler in the python plugin?

I am trying to write a python plugin for QGis. My python plugin will copy a template qgis project into data catalog with ESRI shapefiles. Because data catalogs can vary in its content there will be ...
6
votes
3answers
348 views

What are QGIS Arcpy Equivalent Functions for Update/Delete Row/Field?

I am trying to reprogram some scripts from arcpy to qgis (1.8 or 2.0) and there are some simple functions that I want to be able to redo but unfortunately documentation in qgis is lacking in certain ...
2
votes
1answer
109 views

QGIS custom form: 'dynamic' default value

I am trying to make a custom form in QGIS to smoothen the digitizing process. For this purpose, I put the Edit widget (Layer properties, fields) of one of the fields on 'value map', and I loaded a ...
2
votes
0answers
560 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
121 views

PyQGIS joining a dbf to a shapefile

I am trying to join a shp and dbf file using the PyQGIS API. The code I'll use is below: from PyQt4.QtCore import * vector1 = QgsVectorLayer("path to dbf file", "test1", "ogr") id1 = vector1.id() ...
0
votes
1answer
151 views

Connect not working for custom QGIS form

So I have a custom form for editting feature attributes. However, I can't seem to correctly disconnect and reconnect certain bindings. The init code is below and should work for any simple QT widget ...
3
votes
1answer
230 views

How to programmatically associate a layer with a custom UI?

I know it is possible to associate a layer with a custom UI for editing feature attributes using the QGIS interface. But is this possible with Python? This link shows how to achieve the result ...
0
votes
1answer
88 views

How to create a polygon feature using Python?

I'm making a plugin for Quantum GIS in python. I have a polygon layer and want to create a new feature. So far, I have this because I need a polygon geometry to add the feature: surface = ...
2
votes
0answers
178 views

PyQGIS CRS on the fly reprojetion

As a first step of a pyqgis plugin I'm trying to import several shape files at once. To get them aligned, using the GUI, I'd enable on the fly reprojections and set the project crs to WGS84. I'd then ...
0
votes
0answers
52 views

detect signal where delete polygon in qgis?

I am working with QGIS and i want when i delete a polygon and then i commit this action I detect the signal of this operation and use it in python script, I tryed this but dont work: def delete(): ...
4
votes
0answers
221 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 ...
0
votes
1answer
275 views

QGIS python - reference a layer in the table of contents

I'm trying to create a plugin for QGIS using python, But need some help. I want to 1.Zoom to a layer and 2. make the layer visible(switch off or on). But I have managed to zoom to an active layer by ...
0
votes
0answers
28 views

Raster Calculator [duplicate]

Could anyone help me with some information on using the raster calculator functionality in the python console within QGIS. I need to apply a mask and compute zonal statistics on a few hundred tif's. I ...
0
votes
0answers
166 views

How to add a vector layer in a group using pyQGIS?

Good morning, I insert a group QgsLegendInterface.addGroup (name, expand, parent), but the problem is I need to have at all times controlled each group with an ID because I have to go then inserting ...
2
votes
1answer
169 views

How to add a layer group using pyQGIS?

Good morning, I would like to know how I can create a new group in the layer manager using python code, someone could help me?
0
votes
1answer
125 views

Problem with encoding UTF8 chars in Windows with pyQGIS

I have the problem to show characters (äöü) in a utf8 format in Windows. In Linux there is no problem and everything is displayed correctly. I use at the second line: # -*- coding: utf-8 -*- and ...
2
votes
1answer
353 views

How to zoom to a selected feature with pyQGIS

I want to create a function that selects a feature and zooms to it (similar in QGIS). Therefore there is following function: QgsMapLayerRegistry.instance().addMapLayer(self.vlayer) def zoomTo(self): ...
0
votes
1answer
306 views

How to read attributes in pyQGIS and QGIS 1.8 without setSelectedFeature

I add a vector layer to a map with QgsMapLayerRegistry.instance().addMapLayer(self.vlayer) later the attributes are read with def select_all(layer): layer.select([]) ...
2
votes
1answer
123 views

How to get mean of pixel values within a buffer zone around current mouse position in QGIS

for a qgis 1.8 python plugin I want to query the mean of all pixel values of a raster layer within a defined buffer around the current mouse position, not for an existing point layer. For the buffer ...
0
votes
1answer
72 views

How can i detect the number of polygon is drawed in a edit session in QGIS

I am working with qgis 1.8 and i want to know how many polygon drawed in one edit sessions is there any signal emitted with qgis ???
3
votes
1answer
311 views

Add attributes to vector layer with pyqgis (QGIS 2.0 API)

i am trying to make a QGIS plugin ready for the new QGIS API in the current development branch (for the upcoming QGIS 2.0 release). ...
2
votes
1answer
134 views

How to update data from external table in real time?

I have been trying for a long time to connect a external table data[csv] through Excel (for exmaple) with QGis with the objective to each time i change any data in table(for example data location - ...