Python bindings for QGIS.

learn more… | top users | synonyms

2
votes
0answers
37 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
105 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
60 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
44 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
110 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
35 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
33 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
53 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
35 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
24 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
77 views

How to delete column/field in PyQGIS?

How to remove or delete column fields in a shape file using python?
0
votes
0answers
14 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
114 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
49 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
44 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
43 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
32 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
72 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 ...
2
votes
0answers
46 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
32 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
65 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
80 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
86 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
46 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
109 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
43 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
58 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
30 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
299 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
41 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
35 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
176 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
65 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
81 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
105 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
149 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
56 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
95 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
152 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
131 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
72 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
41 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
35 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
28 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
82 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
125 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
130 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
68 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
145 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 ...