Python bindings for QGIS.

learn more… | top users | synonyms (1)

1
vote
0answers
17 views

PyQGIS + selection

I would like to select some lines in the layer that match this condition : the attribut A have to be the same as the value of the "for" loop where the selection is realised. (After fixing that ...
1
vote
0answers
15 views

Dynamically load symbols preview to plugin

I am working on plugin which combines two *.qml files into new one. Now I'm trying to generate something like "list" in plugin interface. What I have done so far is saving repeated in both files keys ...
1
vote
0answers
6 views

import error of qgis.core even though PYTHONPATH set up with system environment variable

I made the environment variables as described here: How2 Import Though I still receive this error: C:\>python Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32 ...
2
votes
1answer
27 views

PyQGIS refresh layer tree programmatically

When programmatically applying a subset string to a vector layer (here: ax_flurstueck with object count 34265) via l = iface.activeLayer() l.setSubsetString('gemarkungsnummer in ('2760','2765','...
1
vote
0answers
26 views

QGIS 2.14.4 How to get the legend of a Vector heatmap layer?

I'm new on QGIS and PyQGIS. I'm trying to create a plugin which aims to apply a style on a vector layer (generated from a csv file) and then save the map as a png file. The style I apply on the ...
1
vote
1answer
21 views

PyQGIS QgsVectorLayer.uniqueValues() override active object filtering

This code snippet gives me the unique values for a vector layers attribute called myfieldname l = iface.activeLayer() attrIndex = l.fieldNameIndex('myfieldname') uniValues = l.uniqueValues(attrIndex) ...
0
votes
0answers
14 views

laszip batch process in qgis extension lastool

i am using qgis 2.16 in that lastool plugin contains laszip option. please tell how to run batch process in laszip. ill not able to add multiple files at a time in batch process.result came only for ...
3
votes
1answer
46 views

Why do I get “Data source is invalid” error when calling method?

QGIS 2.14 on Windows 7. I'm trying to call a method in a python script from the QGIS python console. I've put the directory in which the scripts resides in the PYTHONPATH in both the windows system ...
1
vote
0answers
20 views

Compare symbols in pyqgis

I'm working with renderers and I want to compare symbols from two different renderers. Is there any way to do it in pyqgis/python? Here is how I get symbols: renderer = layer.rendererV2() category = ...
1
vote
0answers
16 views

How to dynamically move a polygon in map canvas?

I would like to dynamically move a polygon on QGIS map canvas with a python script. The polygon coordinates are updated every n seconds in txt file by an outside application. I tried the following ...
-1
votes
0answers
26 views

How to programmingly get the feature from a layer by the feature's ID in Python QGIS? [on hold]

I have get a list of polygon features' ID, I want to get the corresponding polygon features by these IDs in the layer, then if I want to do some calculations by using the polygon's geometry. How can I ...
0
votes
0answers
33 views

Amending existing plugins to match Qgis 2.16+ fTools removal

Part-time development started about a year ago to create an add-on for Qgis. Many of this plugins capabilities are written with fTools commands. I am wondering if there is a recommended document to ...
2
votes
1answer
36 views

Wrong nearestNeighbor result

Could somebody tell me what is wrong with this code? This is a part of my script and returns totally different result from "Nearest Hub" with the same line and point layers. I would like to identify ...
0
votes
0answers
24 views

Is it possible to create a standalone dbf table with pyqgis

I have written plugin that grabs tabular data via soap requests. As of now the results are written to a csv file. I would rather the results go into a dbf to retain numeric values for a variety of ...
4
votes
0answers
69 views
+50

Problem executing vectorgrid (from processing) in a standalone script using QGIS 2.8.6

I have the following piece of code which I execute within QGIS 2.8.6 import processing import ogr restrLayer = QgsVectorLayer("/home/usr/Desktop/trial/EligibleAreas_polygons_filtered.shp", "...
2
votes
0answers
16 views

pyQGIS: Which attribute change signal should I listen to?

I want to receive a signal when changes have been made to a layer, regardless of the type of editing (add features, remove features, change attributes). When I receive this signal I export the layer's ...
0
votes
0answers
16 views

pyQGIS: strange error message for QgsMessageLog.logMessage()

I emit some log message in a QGIS (2.16.0) plugin I'm writing: self.log("Selected layer " + self.layer.name()) def log(self, str): QgsMessageLog.logMessage(self.toolbar.objectName() + ": " + str,...
1
vote
1answer
18 views

Problem with QgsMapCanvas().zoomToSelection() when running from function

I have the following function which, when typed in to the python console line for line works fine, but when I use the function it gets as far as highlighting/selecting the accident (feature) but the ...
2
votes
1answer
48 views

QGIS Calculate Field with Function Editor invalid expression

I have some data which is built like this: a,bbb,ccc where bbb and ccc vary in length. I want to extract the last segment of the string, after the second ",". Using the Function Editor: from qgis....
2
votes
0answers
35 views

QGIS 2.8 & Python: Merge problems using Python

I have 9 vector layers that I rasterized. All of these have the same: x;y origin pixel size (1 pixel=1 meter) SRS When displayed separately in QGIS these 9 rasters are superimposed correctly but ...
1
vote
1answer
15 views

QgsVectorFileWriter returns false output

I am trying to make a script that reads the content of a .dbf-file and exports it as a shapefile. Equal to the manual pattern "Save as.." when rightclicking the imported layer in the Qgis Desktop. I'...
0
votes
0answers
32 views

PyQGIS & multi selection request [closed]

How I can do to iterate over a layer in order to select the all value of one parameter and add it into a table (without redondancy)? I am a beginner using QGIS and especially Python for QGIS. I ...
1
vote
1answer
52 views

How to Format QGIS Field names on Editor Form

I am using PostGIS table in QGIS with custom QGISFieldWidgetFactory. However, I wanted to rename the field names in QGIS Edit Form from say first_name to First Name using Python. Currently, I was able ...
4
votes
2answers
165 views

Convert vector point data (shp) to raster (tif) using QGIS

Overall Question: How can I get the rendered tif image to keep the modifications seen in the image produced by map canvas? I am writing a standalone Python script. I have simplified my code below ...
0
votes
1answer
24 views

segfault on exit when map layer has connection to “layerRemoved”

Here's my sample code that shows the problem - apologies if this is a big load of code but this is as minimal as I can get it: import sys from qgis.core import * from qgis.gui import * from PyQt4....
1
vote
1answer
29 views

C-based implementation of Djikstra's or Fast Marching for QGIS/Python?

I need an algorithm to find least cost paths between points on a discrete grid, allowing for the direction of transport to affect the cost of transport, allowing for different modes of ...
1
vote
1answer
23 views

Loading style (*.qml file) to layer via PyQGIS?

Is there any way to load a *.qml file to layer and set a style to it in python (pyqgis)? Can I 'get into' this file in console? I want to review it.
1
vote
1answer
28 views

How to enable “Label every part of multi-features” with pyQGIS?

Regarding the 'Label every part of multi-features' check box located in the 'Labels // Rendering // Feature Options' layer properties UI... Can this be done with pyQGIS? These two commands enable ...
2
votes
1answer
27 views

QGIS 2.14.4 attribute table fields not visible in Statist plugin

I had one point shapefile to which I joined new numerical attributes by a csv text file. I saved it by right clicking and everything works fine, I use it for calculations etc. But when I use the "...
1
vote
1answer
20 views

Modifying Font Style simple marker according to character value

Currently I am writing a standalone Python script and I am trying to modify a simple point marker using font style. There are some interesting fonts with different characters that aren't exactly on a ...
1
vote
2answers
28 views

When selecting input don't minimize window - pyqgis

I am making a plugin and I have a window in which you have to select an input file. There is a pushButton and lineEdit. I am typing a path and when clicking OK button to go back to window it ...
0
votes
2answers
19 views

Python code execution error in QGIS WIEN

I have tried to make several different actions in QGIS but keep getting similar error messages when I try to select the output filename. The error message reads as follows: An error has occurred ...
2
votes
1answer
112 views

Finding list of all shapefiles that overlap with single shapefile using QGIS?

I have a list of 34 shapefiles. These shapefiles are range maps for different species. I would like to take 4 of these shapefiles and document a list of those shapefiles (within the 30 shapefiles), ...
1
vote
1answer
17 views

PyQgis show SVG Symbol on differnet value of specific attribute

I am working on a QGIS plugin. Main feature of this plugin will be changing the icons on a specific layer partly based on a specific attribute (it will be more exciting but you have to start somewhere)...
1
vote
0answers
25 views

Problem with pushButton handling - pyqgis

I have made a pushButton - new window relation. Now, when I'm trying to 'link' methods with pushButtons in new window they don't react. Here is what I wrote in metod, which opens new window in ...
0
votes
1answer
22 views

Find out if checkbox checked - pyqgis

I'm new to pyqgis and I'm not sure how can I find out if checkbox is checked and according to the result do different things in another method? I know how to do it in theory, but if someone can show ...
0
votes
0answers
34 views

GeoJson Vector layer in QGIS from a WFS service

It is possible to specify the outputFormat=geojson for a qgis wfs layer? By default, when I add a wfs layer in QGis, is downloaded from geoserver as GML. If I create the layer as: uri = "http://...
1
vote
1answer
35 views

Modifying the texture/fill of a vector layer in PyQGIS

Currently I am writing a standalone Python script to modify a few vector layers to have a wine fill pattern inside. The geometry I am working with is a polygon. I am aware of how to change outline ...
1
vote
0answers
35 views

Split polygon using points and their directions with python

I`m new for the python but want to split Voronoi polygons using points and their directions as input. Voronoi polygons were created by in-built tool: Vector>Geometry Tools>Voronoi Polygons from layer ...
0
votes
2answers
67 views

When buton clicked, open new window - pyqgis

I'm making a plugin which has two windows. What I want to know is how to refer pushButton in one window to method which opens new window. I have dialog *.ui files for both windows and their *.py. ...
1
vote
1answer
31 views

PyQGIS: How to get field values from a vector layer based on an array of field names

I have a list with the field names and i am getting the values from the vector layer shp = "D:\file.shp" from osgeo import osr,ogr, gdal driver = ogr.GetDriverByName('ESRI Shapefile') dataSource = ...
2
votes
2answers
52 views

Projection: conversion of coordinate pairs in Python

Google Translated I am using QGIS and wish to automate the export of a map (an existing project) to which I add a vector layer (representing a construction zone) in pdf format. The problem is: The ...
1
vote
1answer
28 views

Enable groupbox only when checkbox is checked - pyqgis

I have a groupbox which is always enable. I want it to be enable only when user want to edit something, so I made a checkbox for it. However, I have no idea how to 'link' if checkbox if selected with ...
0
votes
0answers
19 views

QGIS editFormConfig setNotNull not working in Python

When trying to use editFormConfig(), I get setNotNull is undefined error shown below. AttributeError: 'QgsEditFormConfig' object has no attribute 'setNotNull' Below is the part of the code used....
1
vote
1answer
49 views

How to overwrite SHP layer

I'm modifying the Arrows plugin by Gregoire Piffault. It writes the output to a shape file, but if the shapefile already exists it fails. He tries to remove the file using QgsMapLayerRegistry.instance(...
2
votes
2answers
58 views

Add attributes to layer

I'm trying to add a new attribute to a vector layer in my plugin. But it does not work.. Why? selectedLayerIndex = self.dlg.comboBox.currentIndex() selectedLayer = layers[selectedLayerIndex] name = "...
1
vote
0answers
23 views

QGIS Python variable not updating properly after layer data is saved

This problem is a continuation of this one I am running a little script on OpenProject event that sets the feature id automatically after a new feature is digitized. Code: def openProject(): from ...
1
vote
1answer
38 views

Field list in combobox in pyqgis

I'm new to pyqgis and I'm tryig to make a combobox with list of fields (from layer also selected in combobox). layers = self.iface.legendInterface().layers() layer_list = [] for layer in ...
2
votes
0answers
21 views

Why PyQt http request works in QGIS console, but not in a plugin?

I want to send http request in a QGIS plugin using PyQt. I found in this post working syntaxes to do so, but something odd occurs. The script given in the question works both in the console and in my ...
0
votes
1answer
24 views

Couldn't destroy QGIS Custom Edit Form Factories

I created custom form factories using this tutorial. However, the factory destructor QgsEditorWidgetRegistry(). However, it doesn't destroy them. I just used the above destructor at the beginning of ...