Python bindings for QGIS.

learn more… | top users | synonyms

1
vote
2answers
70 views

Pyqgis 2.2 : zoom to layer extent?

Regarding my plugin pyqgis 2.2, i can load a vector layer succesfully. But when i try to zoom to the layer extent it does not work. How to do in order to zoom to the layer extent? Thank you very ...
2
votes
0answers
45 views

How to add a TIF raster layer programmatically?

This is my code whenever i try to load .tif image it shows layer is not valid,QgsRasterLayer always return invalid layer (I am using linux 12.04). QString myFileName = ...
0
votes
0answers
38 views

Get signal on edited feature?

Regarding my pyqgis plugin 2.2 , I've implemented signal on a vector layer event successfully. For instance, whenever i create a new feature, i can read a new basic message appeared via QGIS logging ...
0
votes
0answers
37 views

Is there a way to take control of the mouse pointer using python in QGIS?

i would like to take control of the mouse pointer in QGIS (for example constraining it to a given extent...) Is there any way to do that using PyQGIS ? Thanks !
0
votes
0answers
22 views

Pyqgis :2.2 : link between a signal and an event

I'm writing a pyqgis 2.2 plugin with qgis 2.2 I succeeded in accessing and displaying vector data (geometries & attributes). I succeed also to create a 'beforecomitechanges' signal ( emitted, ...
1
vote
1answer
54 views

Pyqgis 2.2 : How to allow editing on layer and features

I'm writing a pyqgis plugin with qgis 2.2 I succeeded in accessing and displaying vector data (geometries & attributes). Now I would like to allow editing for all my layers and all features ...
1
vote
0answers
38 views

Modifying properties of Attributes Table in QGIS?

In my QGIS project I'm using vector layers that require a lot of data inputting/editing. The problem is that some of the data I'm inputting varies greatly in matter of length and structure (various ...
0
votes
0answers
22 views

How to move a layer in QGIS Toc above an existing group?

If in QGIS TOC a group already exists and I add a new layer via QgsVectorLayer* lyr= mQGisIface->addVectorLayer(uri->uri(),Title, myProviderName); the new layer will be inserted within the ...
2
votes
1answer
55 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() ...
1
vote
0answers
58 views

PyQGIS: Editable Combobox for Value Map widget isses

I am having issues with an editable combo box in QGIS 2.4. The edit widget is set to Value Map with an uploaded CSV. However, if a new values (not included in the key value pair list) is added, the ...
1
vote
1answer
50 views

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

Is 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?
2
votes
0answers
34 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
69 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 ...
1
vote
1answer
37 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 ...
1
vote
0answers
53 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
28 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
2answers
221 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
1answer
31 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
22 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 ...
0
votes
1answer
93 views

PyQGIS: Print Composer Map with Table

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 ...
0
votes
1answer
43 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
54 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
45 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
71 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
48 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 ...
2
votes
2answers
73 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?
1
vote
0answers
35 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
83 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 ...
1
vote
1answer
67 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 ...
0
votes
0answers
39 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
34 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
0answers
26 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 ...
1
vote
2answers
66 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
100 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 ...
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 .
1
vote
0answers
105 views

Using qgis modules in standalone application with PySide?

I want to make small standalone application using PySide and QGIS python modules to display satellite images and do standard GIS operations, like creating new shape file and placing polygons or points ...
2
votes
1answer
51 views

How to add an interpolation raster from the python console in QGIS?

I'm trying to add an interpolation layer based on an existing vector layer by using the Python Console (initially in the menu Raster/Interpolation), but can't find anything related in the ...
0
votes
2answers
122 views

How to make a routable graph from a Point and a Line shapefile, using Networkx?

I have one shapefile which consists of all the streets in the study area, and another shapefile which has points representing origins and destinations. I would like to know if it's possible to find ...
1
vote
1answer
146 views

How to make a Python script that does a task in QGIS?

When I run this code in QGIS Python console it works fine, but I want want to run it from an external Python script. What I want the script to do is: 1- Open QGIS 2- Run this code 3- Close QGIS from ...
0
votes
0answers
42 views

PyQGIS: Programmatically Adding Point Features via QgsMapToolEmitPoint

I've created a map tool for QGIS 2.0 Python plugin that emits a point with the click of the mouse. I'm trying to create an edit tool, adding a point feature at the emitted point while selecting ...
0
votes
0answers
18 views

Qgis; How can I add only mean values instead of coun, sum and mean from QgsZonalStatistics (zonal statistic)?

I am using Qgis 2.2.0 Valmiers. I have ASCII grid, total 864 and I have a polygon layer as a zone. after zonal static batch run, attribute fields stop at 2046, fields number shown from "Table Manage" ...
0
votes
1answer
51 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 ...
0
votes
1answer
39 views

How to select a specific area (in a polygon form) determined by some value range in a raster band?

For example, I want create a vector layer with polygons that represents all areas where the elevation is between 500 and 600. Someone has any idea to help me? I'm using PyQgis 2.2.
0
votes
1answer
45 views

PyQGIS: How to send signal to call unsetMapTool()

I've created a map tool to add some functionality to adding point features in QGIS 2.0. I'd like to unset this map tool if editing has manually been terminated by user. I've attempted as shown below, ...
0
votes
0answers
48 views

PyQGIS: QgsMapTool to add point feature

I am having issues programmatically adding point features using QGIS 2.0. I am trying to add a point feature, select another layer's nearby feature, and open the feature form to enter attribute data ...
1
vote
1answer
77 views

QGIS GUI Python Editor Code Running Exception

import sys from PyQt4 import QtGui class MessageBox(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setGeometry(300, 300, 250, 150) ...
1
vote
1answer
91 views

Iterating over selected features in QGIS Processing

I used to be able to iterate over selected features using the following script in v2.0. import processing features = processing.getfeatures(layer) for feature in features: #Do whatever you need ...
0
votes
1answer
71 views

Programmatically set layer properties Python Init function

Is it possible to set the layer properties Python Init function field programmatically? I've been looking through the qgis 2.2 api but can't seem to find anything on it. Hint, suggestions and ...
0
votes
1answer
64 views

Developing QGIS plugin on Mac - GDAL

I'm developing a plugin for QGIS called DEMtools. It runs fine on my linux machine, but is causing me headaches when run on Mac OS X Mavericks (surprise, surprise). I keep getting segmentation faults ...
0
votes
0answers
44 views

QGIS Python API: SAGA difference algorithm does not split parts

I am using the QGIS Python API in an external script (platform: ubuntu). Everything works as expected. But when I am using the SAGA difference algorithm within the script, there is an issue. The ...