Python bindings for QGIS.

learn more… | top users | synonyms (1)

3
votes
1answer
79 views

How to import fromUtf8 in QGIS?

# Declare instance attributes self.actions = [] self.menu = self.tr(u'&City_searcher_plugin') # TODO: We are going to let the user set this up in a future iteration self.toolbar = ...
1
vote
1answer
212 views

convert vector (point shape) to raster (tif) using python gdal lib in qgis

I'm trying to convert a vectorlayer (point- shapefile) to a raster-dataset (tiff) using python gdal-library in qgis. On Graphical UserInterface I simple choose the menue ...
0
votes
1answer
87 views

How to trigger a QGIS action when a plugin button is clicked?

I tried calling the select free hand tool by below snippet of code. iface.actionSelectFreehand().trigger() I dnt have any idea how to call this when i am pressing a button in GUI. my gui is ...
0
votes
0answers
33 views

Error in my buffer plugin

In my buffer plugin, i tried the following code # Get buffer distance and selected city dist = float( myLineEdit.text() ) city = myComboBo.currentText() # Get the feature corresponding to the ...
1
vote
1answer
82 views

How to call default tool in QGIS inside plugin using python script?

I want to create a plugin which can draw irregular polygons in QGIS. For that, I want to call the Select features by freehand default tool inside my plugin. How can I do this within a python script?
0
votes
1answer
62 views

How to enable the snapping for a layer with the tolerance value with python programming

I have a vector polygon and vector polyline layer. I want to enable the snapping for both the layer with tolerance value? How can i do that using python programming. I have tried this code but getting ...
2
votes
1answer
119 views

How to save the Map Canvas as PNG with transparent background programmatically?

I wrote a script to create a big number of heatmaps for a given scenario. I would like to save the result of every heatmap as a png image. I have figuered it out doing it with simple Map Rendering but ...
1
vote
0answers
56 views

QGIS 2.6 SAGA Processing Algorithm, “Add grid values to shapes”, produces NULL Values

I'm using QGIS 2.6 Brighton on Windows with SAGA 2.0.8 installed using OSGeo4W. I have the same versions installed on OSX as well which is not having this problem. On Windows, I'm trying to extract ...
2
votes
1answer
72 views

QGIS gets stuck when running script to automatically refresh layer [closed]

I have a QGIS layer that represents a set of links and nodes to show the streets of a city and the traffic speeds on each street. I've been trying to write a script so that if I change the speeds in ...
0
votes
1answer
62 views

Why is the display of QgsMessageBar delayed?

When a function is called - a file is tested for existence. This checksum pushes a messageBar() object for both circumstances (True/False), yet the actual bar does not display in MapCanvas until ...
1
vote
1answer
64 views

How to exclude a certain attribute from being added to the Processing script output layer?

I have a working script to split a layer by field attributes and save the single features as files: ##[User scripts]=group ##input=vector ##class_field=field input ##output=output file from ...
0
votes
0answers
47 views

Is there any way to create user login for single project in QGIS?

Is there any way to create user login for single project in QGIS? I want to track changes on database when users update features. I know that I can do this on database level but is there way to do ...
1
vote
1answer
65 views

Getting a number from QLineEdit and passing it to the buffer function

I am developing a plugin which finds buffer. In that i am using lineedit for getting distance from the user and pass it to the buffer function. My current code throws an error "'QLineEdit' object has ...
1
vote
1answer
65 views

Qgis 2.7 (Dev) feature rotation?

Curious if the following code has a blatant error that has been overlooked with respect to rotating a single polygon feature. The *.geometry().rotate(...) returns a '0', indicating it was successful ...
2
votes
1answer
79 views

How does QGIS know there is a plugin update?

I've created a plugin and hosting the installation zip and xml file on a local network repository (for company use). Everything works fine but every time a user opens QGIS, it shows that the plugin ...
1
vote
1answer
59 views

Getting values from Qt widgets and using them for a buffer

I am writing a simple plugin that finds buffer. My gui has 2 combo box and 1 Line edit. The first combo box will have a drop down of values from column 'States' and 2nd combo will have a drop down of ...
2
votes
1answer
110 views

How to move layers in the QGIS Table of Contents via PyQGIS?

I have loaded two layers in canvas and would like to move the layers using the following code in TOC, but it is not moving the layers to the position based on the index given. from PyQt4.QtCore ...
2
votes
0answers
67 views

How do I install a external package in QGIS?

Is it possible to install an external package in QGIS? For example: Can I install ReportLab in order to create a plugin to make pdf reports? Or Pandas. How can I install Pandas in QGIS Python ...
2
votes
1answer
63 views

How to apply a filter to multiple vector layers in QGIS?

I am trying to apply an attribute filter to multiple layers in QGIS at once. The filter is to be applied to .osm data brought in through PostGIS to QGIS. I have tried selecting multiple layers -> ...
1
vote
1answer
144 views

Adding field values to a QComboBox in PyQGIS

I have a layer say 'Cities'. There is a column called 'NAME_1' in the layer. My GUI has a QComboBox in which i want the values of column 'NAME_1' alone to be displayed in the drop down of the combo ...
2
votes
1answer
41 views

Show “Raise Notice” and “Raise Warning” in QGIS

Is there a way to catch "Raise Warning" and "Raise Notice" (while editing PostGIS-Layers) from a PostgreSQL/PostGIS-Trigger-Function within QGIS? One example: I have a trigger that reacts to insert or ...
2
votes
2answers
75 views

How do you change the scale bar units to feet?

I'm trying to change the default QGIS scale bar from meters to feet. From the API documentation it looks like I should be able to use the QgsComposerScaleBar.applyDefaultSize() function. I thought ...
1
vote
1answer
119 views

How to enable the snapping options for vector layer using the python programming?

I want to enable the snapping options for the the existing layers using python programming. How can I do this?
0
votes
1answer
85 views

How to position the Qwidget form/QDialogBox in the left corner using python programming

1) I am creating a Qwidget Form or QDialogBox using QT Designer. I am using the following code to move the form: sDialog.move(50,450) But i want to fit the dialogBox to fit in the left corner.How ...
4
votes
2answers
145 views

Adding a vector layer at QGIS start

I have added a shape file in QGIS using Python plugin. I want to add this shape file when QGIS is loading so i have to add code in the initgui() method. I have used following code in the initgui() ...
2
votes
1answer
132 views

How can I iterate over several layers and run a process using PyQGIS?

I am trying to find road intersections within each of my memory Polyline layers (which are named road_layer_i for i in (0-99)) so this is what I tried: import processing self=qgis.utils layers = ...
3
votes
2answers
172 views

Join table field with shapefile programatically (via PyQgis)?

The following is currently unsuccessful at fulfilling a table field join to a point shapefile in Qgis. All instances of the join object will print the proper values, and no error is flagged when ...
2
votes
2answers
197 views

How to load a data table as a 'vector layer' using PyQGIS?

This might be a simple problem, but how does one load a simple two column CSV with no associated geometric data? I have given a couple go's via QgsVectorlayer[delimited text, spatialite] types - but ...
2
votes
0answers
78 views

How to change the group icon in legend via Python in QGIS 2.6?

How to change the group icon in legend via Python in QGIS 2.6? At version 1.x I did it this way: self.legendTree = self.iface.mainWindow().findChild(QDockWidget,"Legend").findChild(QTreeWidget) ...
0
votes
0answers
70 views

How to best get Qt Designer for QGIS plugin development on Mac?

I'm using QGIS 2.6.1 on Mac OSX 10.9.4, trying to create a plugin as described in the PyQGIS Programmer's Guide. I have the plugin 'skeleton' (main widget with header and ok/cancel buttons) running in ...
2
votes
1answer
100 views

Layer properties dialog in my QGIS plugin

I am developing a plugin which should display some information like geometry of the layer, feature count etc. Now those are currently displayed in QMessageBox.information. I want it to be displayed ...
3
votes
2answers
79 views

QGIS (2.4) keeps caching old Python code

I'm fiddling around with a piece of python code to use with form validation. It works fine, but the real problem is that QGIS refuses to acknowledge the changes I make in the script. Here's what I ...
1
vote
1answer
94 views

How to deactivate my custom tool by pressing the Escape key using PyQGIS?

I'm developing a QGIS plugin and I have created a custom tool. Once the process is over, if the user presses the ESCAPE key, I want my custom tool not to trigger mouse events on the map anymore. How ...
2
votes
1answer
87 views

How to iterate over features and abort iteration with keypress in PyQGIS?

I would like to run a loop with PyQGIS, it should wait for the user to press a key either SpaceBar or Escape to continue. canvas = qgis.utils.iface.mapCanvas() aLayer = canvas.currentLayer() feat = ...
0
votes
1answer
56 views

Loading all the vector layers in plugin

I have a list of vector layers loaded in the canvas of qgis. `layers = self.iface.mapCanvas().layers() for layer in layers: if layer.type() == QgsMapLayer.VectorLayer: ...
1
vote
1answer
128 views

How to link my QGIS plugin main class to mouse events from a custom Tool?

I Have two files one is mouseevent.py and the other one main.py. class MouseClick(QgsMapTool): canvasDoubleClicked = QtCore.pyqtSignal(object, object) def __init__(self, ...
0
votes
0answers
41 views

The result is not displayed after OK is pressed in my plugin

I am developing a plugin that checks for multipart geometry in a layer in qgis 2.6. After ok is pressed, nothing is displayed. My code snippet is attached. def run(self): """Run method that performs ...
1
vote
1answer
100 views

Attribute Error: “List” object has no attribute getFeatures

I am developing a plugin that checks for multipart geometry in a layer in qgis 2.6. I am geeting an error list object has no attribute getFeatures. My code snippet is attached below. def run(self): ...
1
vote
2answers
115 views

MultiLine field-name label referencing

A labeling routing (which is updated often) is being implemented via pyqgis and a QComboBox. The attached code below worked great, that is until needs for narrowed column headers spawned the use of ...
1
vote
1answer
48 views

Load Oracle Spatial Raster using PyQGIS

Able to connect to Oracle Spatial 11g and print tables with SDO_GEORASTER attribute both in QGIS python console and standalone application.I get below error when loading rasters from oracle Table. ...
1
vote
1answer
93 views

Load PostGIS or Oracle Spatial Raster Layer using PyQGIS

How do we load Rasters stored in PostgreSQL-PostGIS or Oracle Spatial 11g into QGIS using PyQGIS? I am able to load vector layers from Oracle 11g with below code. What changes are necessary to add ...
3
votes
1answer
124 views

How to show Python console at QGIS program start

I wonder if there is a way to open the Python console of QGIS 2.6 directly at program launch. There is a possibility to set a shortcut for the Python console, but I can't find such an option for the ...
2
votes
3answers
213 views

Why script works on my computer but not on another?

The script below works perfectly fine in my computer. But when running the script on another computer, I receive an error: Error: Algorithm not found The computer has similar specifications to ...
1
vote
0answers
66 views

Using processing using other output (result from another algorithm) as input

I have a problem. I am developing a standalone app in python and I need to use processing algorithms. I was able to use one algorithm without erros but I need to run other processing algorithm which ...
2
votes
1answer
78 views

QGIS toolbars source code

I can see the source code of the core QGIS plugins from the repository in github. But is there any repository of source codes for QGIS toolbars also?
1
vote
0answers
124 views

Custom QGIS 2.6 map tool - mouse click and release issue

I have create a custom map tool for QGIS 2.6, implementing a canvasReleaseEvent and canvasPressEvent. I can't though get the signals to work on one single mouseclick (I have to click twice). My map ...
3
votes
2answers
55 views

Send signal when attributes modified - QGIS 2.6

For a QGIS 2.6 python plugin, I am trying to send a signal when an attribute value is changed (values for an existing feature are updated or added and the attribute form dialog is accepted). This ...
1
vote
1answer
73 views

Why use QgsFeatureRequest() when iterating?

I am unclear on why one should use QgsFeatureRequest() when iterating over a file’s features. Let’s say I would like to print out all IDs in my currently active dataset. Now, most examples will ...
5
votes
2answers
78 views

Start QGIS with virtualenv Python

is there any means of telling QGIS to use a different Python installation than the default, system-wide one? E.g. use some virtualenv Python /myvirtualenv/bin/python instead of /usr/bin/python? ...
2
votes
0answers
91 views

Efficiently generate Voronoi layers in qgis via Python

The following python commands both appear to function when called in qgis 2.6 to generate Voronoi diagrams: processing.runalg("qgis:voronoipolygons", pointLayer, 1, None) ...