Python bindings for QGIS.

learn more… | top users | synonyms

1
vote
0answers
40 views

Clipping between features within a single vector?

Is it possible (via the Qgis API and friends), to clip polygonal features within a single vector layer? The hope is to accomplish this without having to duplicate the feature into a new layer. ...
3
votes
0answers
64 views

Performing buffering and intersection with script in PyQGIS

I wrote a script that performs the intersection of two layers: The first Layer -> layer1, represents the rivers The second Layer -> layer2, represents a set of circular dots distributed in a ...
1
vote
0answers
42 views

Using two different Python versions for QGIS scripting?

I´m intending to learn scripting with python in QGIS, but I have a couple of questions. I'm using Python 3.4 for learning which is installed in my laptop, but QGIS is using Python2.7 How could I ...
1
vote
1answer
93 views

Why is feature.geometry() None in my user-defined expression function?

I'm trying the user-defined expression functions for QGIS, as listed on Nathans blog: http://nathanw.net/2012/11/10/user-defined-expression-functions-for-qgis/ I always get the feature.geometry() as ...
2
votes
1answer
28 views

QGIS Processing - Additional Creation Parameter for GdalWarp

I am having a hard time getting the "Additional Creation Parameters" to work when using GdalWarp through the processing toolbox. I am trying to set the nodata value to 0 for the output raster. ...
2
votes
1answer
68 views

PyQGIS - Start/Stop Editing with data Provider - Commiting changes

I want to edit a specific field for a QgsVectorLayer, within a QGIS application. I am facing inconsistent results from my code, ie: changes are not alway commited. Please could someone point me to ...
2
votes
0answers
21 views

Refreshing “layer render order” widget

i made changes in the render order of my map canvas using a : qgis.utils.iface.mapCanvas().setLayerSet(a) "a" being a list of QgsMapCanvasLayer My code is working as expected (i see result on map ...
5
votes
1answer
106 views

QGIS Processing Progress

I have been developing a python plugin that uses Processing algorithm for raster calculations. I want to support the gui with progress bar. How can i connect Processing job to progress bar? I found ...
1
vote
1answer
61 views

Programmatically export a Qgis project

I have a QGis project that I programmatically modify using the Python xml.etree library. Now, I would like to know if it is possible to add few lines to my script in order to export the modified ...
1
vote
0answers
48 views

Retrieve a point coordinates from map canvas using QGIS API

I'm trying to build a plugin that firstly captures the map coordinates. I have tried to adapt the map tool explained in this post: How to programatically check for a mouse click in QGIS The code I ...
2
votes
0answers
32 views

Memory layer or QgsVectorFileWriter Error?

Currently this excerpt of code will not save to file (as it is supposed to). The memory layer is visable and editable. Yet even when manually saving the layer, any priorly added features ...
1
vote
1answer
79 views

QGIS 2.4 plugin PyQT qWebview javascript interface problem

I have a QGIS plugin which contains a qtwebview and Javascript communication between the page and the plugin. It is working perfectly with QGIS 2.2 but not with 2.4 (both QGIS versions share the ...
3
votes
1answer
50 views

QgsMapCanvas.reresh() does not reload new wfs layer features, but panning does

I have a wfs layer loaded in a standalone QGIS app, which I am updating by running a database query on the view it is based on. The feature is added with no problems and I reload the layer with: # ...
3
votes
1answer
41 views

Changing attribute values in a memory layer

I'm trying to change attribute values in a memory layer. My memory layer is defined in this way: pro.addAttributes([QgsField("nom", QVariant.String), QgsField("valeur", QVariant.Int)]) I made ...
1
vote
1answer
71 views

Import shapefile is not working in pyshp?

I am just trying to use "pyshp" package to open shapefile in Python and use the Attribute data for further development. Firstly I have downloaded pyshp package for python 2.7 and installed it in my ...
1
vote
1answer
28 views

How to set QGIS options in standalone pyqgis application

I have a standalone application which uses the QGS api to view and query map layers. One layer is a WMS-C layer which automatically caches tiles which is great. I want to also activate a setting which ...
2
votes
0answers
28 views

access point layer representation in qgis with pyqgis

I am exporting the style of a categorized point layer with qgis: unfortunately my code only extract the size of the symbol in the definition of the properties of the layer but not the ...
3
votes
1answer
48 views

PyQGIS esri ascii grid to .bil conversion

Esri ASCII GRID can be converted to esri .bil format by following way in a desktop From QGIS desktop menu-->Raster-->conversion-->Translate(convert format) How can I write a python code because I have ...
3
votes
1answer
33 views

Why is the SelectionChanged signal triggered every time i click on the layer?

i'm making some experiments with the SelectionChanged signal of a QgsVectorLayer. i try this piece of code : curLayer.selectionChanged.connect(self.test) and "test" print a warning message. The ...
1
vote
0answers
22 views

PyQGIS standalone gdal_ECW_JP2ECW.dll error

This is my code in a batch file My error messages are gdal_ECW_JP2ECW.dll error unable to open EPSG support file gcs.csv Thanks in advance REM Change OSGEO4W_ROOT to point to the base install folder ...
0
votes
1answer
66 views

How to delete column/field in PyQGIS?

How to remove or delete column fields in a shape file using python?
0
votes
0answers
11 views

Pyqgis 2.2 : get signal on feature added : error message

For my pyqgis plugin 2.2, I try to: def logFeatureAdded(self,layerId,addfeatures): message = str(layerId) + " has features added: " for feature in addedFeatures: message += str( ...
1
vote
2answers
83 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
46 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
39 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
40 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
23 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
59 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
42 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
25 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
56 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
69 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
56 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
39 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
80 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
41 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
54 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
29 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 ...
1
vote
2answers
251 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
33 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
23 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
123 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
56 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
57 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
66 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
95 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
52 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
78 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?
8
votes
1answer
139 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
99 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 ...