Python bindings for QGIS.

learn more… | top users | synonyms

0
votes
1answer
279 views

AttributeError: 'QgsFields' object has no attribute 'itervalues'

First of all, the code which is below gives me the attribute names of a shapefile correctly if I use PyScripter IDE: from qgis.core import * from qgis.gui import * from PyQt4.QtCore import * from ...
2
votes
2answers
99 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 ...
0
votes
1answer
325 views

How to use SEXTANTE in a script outside QGIS?

I´m trying to do some geoprocessing using the QGIS Sextante plugin outside of the QGIS application (and integrate it with different other libraries like arcpy, etc.). import sys, os from PyQt4.QtGui ...
1
vote
1answer
256 views

Problem loading PyQGIS

There is a problem on my system when starting QGIS. I get this error. I am running openSuse Tumbleweed 64bit and openSuse 12.3 64bit. Same problem on both systems. Couldn't load PyQGIS. Python ...
2
votes
1answer
177 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 ...
1
vote
1answer
227 views

clip one layer with the current map layers

I work in a little companie where the main goal of employees in GIS is to have a quick view of the issues on a study area. It would be very useful to have a tool wich clip all the layers of the ...
1
vote
2answers
191 views

How to add non spatial sqlite table to map using python in qgis?

Is it possible to load pure sqlite 2.0 (without spatial extension) table into qgis using python? I would like to get the same result as in the case of using Add Vector Layer -> All files. I have ...
0
votes
0answers
326 views

Problem compiling UI file generated by QGIS Plugin Buidler

I have used the plugin builder QGIS 1.8 to create an empty plugin. The next step is to compile the ui file using pyuic. pyuic.py runs but halts at the line with from PYQt4 import QTCore and an error ...
2
votes
2answers
300 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
88 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 ...
7
votes
3answers
484 views

What are QGIS Arcpy Equivalent Functions for Update/Delete Row/Field?

I am trying to reprogram some scripts from arcpy to qgis (1.8 or 2.0) and there are some simple functions that I want to be able to redo but unfortunately documentation in qgis is lacking in certain ...
2
votes
1answer
146 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 ...
4
votes
1answer
899 views

Setting the extent for a QGIS map using python

I am writing a stand-alone application in Python/QGIS that simply creates maps. I want to load vector/raster layers, set symbology, set extent At the moment, that is all! Currently I am just using ...
1
vote
0answers
211 views

PyQGIS joining a dbf to a shapefile

I am trying to join a shp and dbf file using the PyQGIS API. The code I'll use is below: from PyQt4.QtCore import * vector1 = QgsVectorLayer("path to dbf file", "test1", "ogr") id1 = vector1.id() ...
1
vote
1answer
245 views

Connect not working for custom QGIS form

So I have a custom form for editting feature attributes. However, I can't seem to correctly disconnect and reconnect certain bindings. The init code is below and should work for any simple QT widget ...
5
votes
1answer
479 views

How to programmatically associate a layer with a custom UI?

I know it is possible to associate a layer with a custom UI for editing feature attributes using the QGIS interface. But is this possible with Python? This link shows how to achieve the result ...
0
votes
1answer
118 views

How to create a polygon feature using Python?

I'm making a plugin for Quantum GIS in python. I have a polygon layer and want to create a new feature. So far, I have this because I need a polygon geometry to add the feature: surface = ...
4
votes
0answers
328 views

PyQGIS CRS on the fly reprojetion

As a first step of a pyqgis plugin I'm trying to import several shape files at once. To get them aligned, using the GUI, I'd enable on the fly reprojections and set the project crs to WGS84. I'd then ...
0
votes
0answers
62 views

detect signal where delete polygon in qgis?

I am working with QGIS and i want when i delete a polygon and then i commit this action I detect the signal of this operation and use it in python script, I tryed this but dont work: def delete(): ...
4
votes
1answer
319 views

QGis Zonal Statistics Plugin NoData included in Calculations

I have been trying to use the QGIS zonal statistics plugin. My raster has a nodata value of -99999 and all other values are positive. After computing the mean zonal statistics there are a number of ...
1
vote
1answer
508 views

QGIS python - reference a layer in the table of contents

I'm trying to create a plugin for QGIS using python, But need some help. I want to 1.Zoom to a layer and 2. make the layer visible(switch off or on). But I have managed to zoom to an active layer by ...
2
votes
1answer
277 views

How to add a layer group using pyQGIS?

Good morning, I would like to know how I can create a new group in the layer manager using python code, someone could help me?
1
vote
1answer
198 views

Problem with encoding UTF8 chars in Windows with pyQGIS

I have the problem to show characters (äöü) in a utf8 format in Windows. In Linux there is no problem and everything is displayed correctly. I use at the second line: # -*- coding: utf-8 -*- and ...
2
votes
1answer
586 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): ...
0
votes
1answer
491 views

How to read attributes in pyQGIS and QGIS 1.8 without setSelectedFeature

I add a vector layer to a map with QgsMapLayerRegistry.instance().addMapLayer(self.vlayer) later the attributes are read with def select_all(layer): layer.select([]) ...
2
votes
1answer
164 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 ...
0
votes
1answer
79 views

How can i detect the number of polygon is drawed in a edit session in QGIS

I am working with qgis 1.8 and i want to know how many polygon drawed in one edit sessions is there any signal emitted with qgis ???
3
votes
1answer
566 views

Add attributes to vector layer with pyqgis (QGIS 2.0 API)

i am trying to make a QGIS plugin ready for the new QGIS API in the current development branch (for the upcoming QGIS 2.0 release). ...
2
votes
1answer
180 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 - ...
1
vote
0answers
214 views

How to load the default layer style from Postgresql with Python?

I would like to write a python macro that upon opening my QGIS project file will reload the default style for each layer from the postgres 'layer_style' table. I have had a look at the documentation ...
0
votes
0answers
125 views

QGIS 1.9 problem with setGrayBandName on the QgsRasterLayer

I have installed the developer version of QGIS on my computer in order to do some work with a multiband raster file. The file consists of 30 bands of information, and I need to step through it with a ...
4
votes
1answer
335 views

How can I create a new layer from the currrent selection?

Is it possible to create a duplicate layer, only displaying the selection from the layer you are duplicating in QuantumGIS? Simular to ArcGIS -> Create Layer from Selected Features. I looked at "How ...
2
votes
1answer
257 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 ...
3
votes
1answer
177 views

How to create a line layer which connects a point layer to a line layer?

In the map shown below, I have manually created the dummy lines (in green). Using python, and without using PostGIS or sextante, I would like to automate the creation of these dummy links between a ...
1
vote
1answer
255 views

Looking for PyQGIS Syntax Examples/Guide

I am a long-time user of arcgis with intermediate experience python scripting for automation of geoprocessing workflows. I am moving towards using QGIS on the regular and I would like to dive into ...
1
vote
0answers
137 views

Spatial Filter in Qgis Using Python

Is it possible to create buffer and get intersected features in Qgis using Python? I did in ArcObjects.but i need the same in QGIS also. Dim topo As ITopologicalOperator topo = chkPoint Dim sFc As ...
0
votes
1answer
366 views

Getting error in compiling make file for plugin build in qgis 1.8

I am using QGIS 1.8 for building plugin. For developing i am using following ref this link example. where in this step 6 where compile the makefile in OSGeo4W. gives error pyuic4:command not found. I ...
1
vote
1answer
70 views

Qgis 1.9 issues with python [closed]

I already installed the version 1.9 of Qgis and when i runned e Script python on i could this error 'NoneType' object has no attribute 'children' however it works fine on qgis 1.8 could someone ...
2
votes
3answers
627 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 ...
4
votes
3answers
612 views

How to find the polygon inside which a point lies?

I have a layer with polygonal features. Each feature has attributes and values. I also have a list of co-ordinates and I would like to know which feature (or polygon) the co-ordinates lie in. Could ...
1
vote
1answer
346 views

How to add layer/raster with specific position in the QGIS layer list?

I use addRasterLayer(rast,'Name') but this adds the raster to the top. It is possible to set position when I add raster at once? Is it possible??
2
votes
1answer
185 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 ...
1
vote
0answers
278 views

How to write vector layer to csv file with geometry by PYTHON?

I use Python try to write vector layer file to csv file with this code QgsVectorFileWriter.writeAsVectorFormat(mylayer, r'c:\temp\xyz.csv', "utf-8", None, "CSV") It can export to xyz.csv but only ...
0
votes
1answer
90 views

Make many lines in one layer (Python)

I what to create many lines with this code: v_layer = QgsVectorLayer("LineString", "cable", "memory") pr = v_layer.dataProvider() seg = QgsFeature() ...
0
votes
2answers
83 views

Python to get ids from shp dont return all records

I have some Python code to get the ids and georeference from a shapefile: canvas = qgis.utils.iface.mapCanvas() allLayers = canvas.layers() nos = QgsFeature() for i in allLayers: if ...
0
votes
1answer
99 views

How to convert geometry of SHP to decimals

I try to create a line with two points. These points are obtained in a SHP layer. How can i convert that points to decimals? Thank you
0
votes
2answers
465 views

How to display data from a feature?

I want to display data based on the feature currently selected/clicked on. I am following a tutorial from http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html. It initially shows you how ...
0
votes
1answer
255 views

How to use expression in QgsVectorlayer label by using python?

how to show the two field values as a label on features. I have done it for a field called "ErrorDescr" with this i need to show another field values. Other field is "MarkerId" ...
0
votes
0answers
18 views

QGis non blocking notifications with pyqgis [duplicate]

I'm searching for the way to use the new QGis non blocking notification system with the QGis python wrapper. I found informations on this fonctionnality but nothing on how to use this especially with ...
5
votes
1answer
2k views

How can I programatically create and add features to a memory layer in QGIS 1.9?

I had a working plugin in QGIS 1.8 which read data from an MSAccess database and added it to a series of memory layers. There is some processing involved in the interim so I don't think simply using ...