Python bindings for QGIS.

learn more… | top users | synonyms

2
votes
1answer
161 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 - ...
2
votes
3answers
562 views

How to add QGIS Python API Intellisense support in Aptana Studio3/Pydev

I'm developing QGIS plugins using PyDev in Aptana Studio 3 and I would like to know if it's possible to make it aware of the QGIS API and add some "intellisense" functionnalities when programming. For ...
2
votes
2answers
80 views

How to remove/disable a toolbar via python?

How do I remove or disable a toolbar e.g., Raster, programmatically using Python?
2
votes
1answer
102 views

Got Null values when updating attributes with PyQgis

I'm trying to create and update a field and ,for now, just change it's value to 2. Here is my code: layer = qgis.utils.iface.activeLayer() index = layer.fieldNameIndex("P") # if index == -1: # ...
2
votes
1answer
115 views

How do I access QGIS program settings programmatically?

I am trying to temporarily enable the option in QGIS using PyQt4 to suppress the attribute dialog popup after a feature is added. I found an example in the cookbook but it doesn't indicate how to get ...
2
votes
2answers
296 views

How can I create a vector layer in PyQGIS from a table without geom column?

In QGIS I've got a Spatialite database containing tables without a geometry column. With the QGIS GUI it is perfectly possible to add such a table as a 'Spatialite vector layer'. But how to do this in ...
2
votes
1answer
141 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 ...
2
votes
2answers
280 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 ...
2
votes
1answer
142 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 ...
2
votes
1answer
725 views

qgis.core import error

I would want to use the Qgis api for custom desktop application. When I imported the qgis.core module, I get the following error >>> import qgis.core Traceback (most recent call last): ...
2
votes
1answer
1k views

How can I add button to the QGIS toolbox or create my own toolbox?

I want to create a button and add it to the QGIS toolbox or alternatively create my own toolbox and add the button here. A plugin should be started when the user clicks the button.
2
votes
1answer
56 views

PyQGIS: How to send signal if layer is currently in edit mode

I'm looking for a way to send a signal if a layer is in editing mode. I tried editingStarted(), but it wasn't working. I'd like to do something along the lines of the what I have below, but can't find ...
2
votes
1answer
129 views

Why does writing large shapefiles crash QGIS?

I'm trying to write large shapefiles with QGIS 2.0 API, using Python, which crashes QGIS. The data is composed of simple two point lines and a data table of five columns. A thousand features or so ...
2
votes
2answers
103 views

How can I close the identify result dialog programmatically?

I am trying to close the identify result dialog which appeared when I select to identify a feature from the active layer. Does someone know how can I do it?
2
votes
1answer
109 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 ...
2
votes
2answers
89 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 ...
2
votes
1answer
179 views

How to store attributes of a large shapefile in a list?

I am trying to store the attributes of a shapefile into a list. With following code it works for smaller shapes: addA = [] While provider.nextFeature(feat): attrs = feat.attributeMap() for ...
2
votes
2answers
821 views

Creating QGIS layers in python console vs stand-alone application

I am having trouble creating a QGIS vector layer in a stand-alone python script while exactly the same code works fine in python console inside QGIS. The following code results in a proper ...
2
votes
2answers
170 views

How to determine the coordinates of the corners of the raster layer

How can we determine the coordinates of the corners of the raster layer? The image opens function QgsRasterLayer.
2
votes
1answer
94 views

How to check if two qgsPoints are equal in PyQgis

I have two points: a=QgsGeometry.fromPoint(QgsPoint(227739,908343)) b=QgsGeometry.fromPoint(QgsPoint(227739,908343)) but when I run: a==b it returns False. What am I doing wrong? Update: it ...
2
votes
1answer
593 views

QGIS Zoom from python console

What are the commands to apply all types of zoom (full, on selected layer, etc.) in python console? I'm searching both on pyqgis cookbook and API documentantion, but I'm not finding anything ...
2
votes
1answer
228 views

How to move the QGIS Layerpanel/Dockwidget programmatically

i'm working on a QGIS-plugin and want to move the default LayerPanel/Dockwidget to somewhere else programmatically. More specific: i want to move it into a tab of my tabwidget. Is this possible? How ...
2
votes
1answer
1k views

pyqgis: How to get features of selected geometries

I wonder if anybody could provide an example how to get the attributes of selected Features? I tried the folowing Code in the python Console - but I'm stuck at the point where I'd like to get the ...
2
votes
1answer
200 views

Can't load PYQGIS

I get this error; any comments Couldn't load PyQGIS. Python support will be disabled. Traceback (most recent call last): File "", line 1, in ImportError: ...
2
votes
1answer
35 views

How to add labeling to a polygon layer?

I'm trying to add labeling to a polygons vector layer called "myVectorLayer". It does not give me an error but the labeling does not appear. palyr = QgsPalLayerSettings() ...
2
votes
1answer
85 views

“Couldn't load PyQGIS” Error running QGIS on Ubuntu 14.04

I have installed QGis on Ubuntu 14.04 from the QGis stable repository; it went fine with no errors reported. But when I launch QGis I get this huge window with the following message: Couldn't load ...
2
votes
1answer
70 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
155 views

How to adjust QGIS attribute table view column width using Python?

I'm programmatically opening the Attribute table via Python through a plugin. All of the columns have a default width, but some of the data that I'm using do not fit. It's not enough to be able to ...
2
votes
1answer
152 views

Which data providers support loading attribute tables without geometry?

I have a table in Memory from a cx_Oracle query (a list of rows, and a list of field names and their types) in my python plugin and I want to load it as a geometry-less layer (Attribute table) in ...
2
votes
1answer
233 views

How to label vector features programmatically?

I am using python for QGIS 2.0.1 and I have a vector layer of points representing the positions of state labels. I want to display the 'state abbreviation' attribute on the corresponding point for ...
2
votes
2answers
352 views

How to load memory output from QGIS processing?

Many processing algorithms have an option to save output as memory. If ran from toolbox, this works fine, because you can tick the "Open output file after running algorithm" box. Looking at the ...
2
votes
1answer
1k views

PyQgis question: How to change or set active layer?

Developing a qgis plugin, I found that if no layer is selected in the Layers panel I can iterate over all layers and do anything to them, but "activate" them. Could someone give me a hint please? ...
2
votes
2answers
418 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: ...
2
votes
1answer
86 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 ...
2
votes
1answer
133 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
1answer
508 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): ...
2
votes
1answer
245 views

ImportError: No module named qgis.core

I am on Ubuntu 13.04. I get the following error message - Traceback (most recent call last): File "analyse.py", line 1, in <module> from log import shelve File ...
2
votes
1answer
508 views

Joining table to shapefile with pyQGIS

Joining shapefiles is a relatively straightforward proess in QGIS using 'add vector join' in the layer properties menu. I can add a csv file as a vector layer, as well as a shapefile, and join the two ...
2
votes
2answers
905 views

Extract coordinates from vector layer in PyQgis

In Qgis, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon. Now I want to extract these grid points in the ...
2
votes
1answer
110 views

How to get a list of all projections that are currently available in QGIS via the PyQGIS-API

i'm building a QGIS-Plugin and i want the user to choose a CRS out of a combobox in which the coordinates he would enter into some textfields are represented, so these can be converted into another ...
2
votes
1answer
137 views

QGIS 1.8 compiled against PyQt 4.8+?

I'm currently running QGIS on Win7 64bit. My installation says it was compiled against and running against PyQt 4.7.1, although according to the Osgeo4W installer and PyQt4.QtCore.PYQT_VERSION_STR, I ...
2
votes
1answer
227 views

Is it possible to set a layer style (e.g. set the color ramp) before loading the layer using pyQGIS?

I am implementing a tool which allows an user to calculate some statistics with some data from the registration office. My question is, can I set some layer styles using pyQGIS? The analysis part is ...
2
votes
1answer
234 views

Is there an itemSelectionChanged Signal in Attribute Table?

The QgsVectorLayer class emits a selectionChanged() signal . If a QGIS user for example selects a record in the Attribute Table of a Vector Layer - a selectionChanged() signal is emitted an can be ...
2
votes
1answer
70 views

Which class should I use to work with vector layers?

I'm doing different operations on vector layers. Kindly suggest which class should I use for vector layer i.e QgsVectorLayer or QgsVectorLayerDataProvider.
2
votes
1answer
445 views

How to load a postgres view using pyQgis?

Under Qgis 1.8 on Windows 7 I have this problem with my pyArchInit plugin: I need to load on the map canvas my geometries from a postgis layer. Till the 1.7.4 version I use the method explained on the ...
2
votes
1answer
201 views

How can i include program form (created in Designer ) to my QGIS plugin?

How can I include a form created in Designer in my QGIS plugin? And how to get controls values (textbox,label,etc)?
2
votes
1answer
275 views

How to connect QGIS to a WMS-C with python?

I would like to connect my QGis to a WMS-C server when my python plugin load. How can I do that ? BTW, the method: addRasterLayer do not seams to handle WMS-C layer...
2
votes
1answer
63 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 ...
2
votes
1answer
58 views

Referencing Qt UIs external to plugin with python

I'm developing a plugin that sets up a working environment for a user: loading layers (from db), applying styles and several custom designed (Qt) UI files etc. Primary user interaction is in the ...
2
votes
1answer
116 views

How to write a new layer to PostgreSQL from QGIS plugin

The PyQGIS cookbook states that QgsVectorFileWriter can write vector layers to any format supported by OGR: https://www.qgis.org/en/docs/pyqgis_developer_cookbook/vector.html#writing-vector-layers ...