Python bindings for QGIS.

learn more… | top users | synonyms (1)

1
vote
0answers
45 views

Python QGIS reliable intersection/overlap check between points and lines

In my script I need to check, whether a point I created stored in a memory layer lies on a polyline, which is in another memory layer. I am certain, that the point does overlap/intersect the line, ...
4
votes
1answer
45 views

How to insert a variable into a tool script

I am a bit new when it comes to Python programming. I'm trying to run the GRASS r.sun plugin tool to calculate the global irradiance for my chosen area for the whole year. The problem is that r.sun ...
3
votes
1answer
59 views

PyQGIS Error: Cannot Create a QPixmap or Qwidget when no GUI is being used

I am trying to create a standalone script using the code below. I was able to add a shapefile with no errors but when I add map = QgsMapCanvas() after qgs.initQgis() and ...
1
vote
1answer
45 views

Connect / Disconnect GPS device via PyQGIS

In QGIS I would like to establish a connection to my GPS device programmatically (not via button in the GPS control panel) I found out how to get available ports with QgsGPSDetector i.e. ...
1
vote
1answer
52 views

Qgis -> Settings -> Customization : how to import ini file with python?

With QGIs, from "Settings"->"Customization" i can hide/show the components of the GUI. I can export a INI file with my customization. There is a way to import my INI file with a python command in ...
1
vote
1answer
71 views

QGIS - Clip: Differences between processing commands and built-in Python console

Two geometries can be clipped in various ways. I have expected the same result, but I got two different results. The following method I used. I have selected the clip function and added two layers. ...
1
vote
2answers
51 views

Create GeoJSON after processing.runalg('qgis:clip', …)

I have the following problem: I have two vector layers, foobar and clipLayer. About the python console I call the following command: processing.runalg ('qgis:clip', 'foobar', 'clipLayer', None) As a ...
2
votes
0answers
18 views

Plug-in reloader

There's something i don't understand in the behaviour of the "plugin reloader" plugin : When an error occur in the test of a plugin "plugin reloader" reloads a new instance of my plugin (the one with ...
2
votes
1answer
33 views

Raster brightness, contrast, saturation in PyQGIS

I'm trying to find a way to change these properties (especially contrast and brightnes) and I've found a QgsBrightnessContrastFilter class, but I can't fugure out how to apply it to my raster layer. ...
1
vote
0answers
43 views

How do I calculate the percentage of progress using raster data using Python?

How do I calculate the progress amount of two or more raster data being processed? I have seen examples of vector data but it becomes difficult to calculate the progress when no vector data are ...
2
votes
0answers
44 views

Fatal Error when PyQGIS searches for available providers: QgsApplication.initQgis()

I am setting the prefix path in Python using the code below. When running the code, a pop-up window stating "python.exe has stopped working" shows up. I've gone line by line in the code within ...
2
votes
0answers
82 views

PyQGIS Error using standalone script when loading a vector layer

I've been able to execute the command below in the Python console in QGIS. I am able to execute from qgis.core import * and import qgis.utils with no errors in the OSGeo4W shell but adding the layer I ...
3
votes
1answer
57 views

Error when using r.series in a python script

I’m writing a tool script in python and at a certain point I want to use the GRASS tool r.series. I want the algorithem to read all raster files from a folder and calculate the maximum with r.series. ...
3
votes
1answer
82 views

Show QGIS feature count via console on existing layers

I want to make a script that toggles feature count on for all vector layers. I followed the following article: Show feature count of layer via Python console / PyQGIS. Instead of adding new layers ...
2
votes
1answer
53 views

Categorized Renderer

I am trying to set a categorised renderer for a point layer, according to its categories. I used this code: vector = QgsVectorLayer("route to shape", "title", "ogr") mi_rend = ...
3
votes
2answers
114 views

How to add a shapefile programatically using PyQGIS

I am trying to add a Shapefile outside of the QGIS environment using PyQGIS. Ideally this would be done without creating a map in QGIS. I've started with the code below but am receiving the following ...
1
vote
0answers
23 views

pyqgis change or update attribute data with real-time data or Timer update,Memory has been growing

I update my shapefile attribute data by QTimer ,and labling it, keep the lable visiable,change attribute by 1 minute, but the Memory has been growing 1 layers ...
1
vote
0answers
61 views

Writing custom GUI map application without installing QGIS

I would like to know if it is possible to develop standalone map applications with QGIS without installing QGIS software or embedding QGIS. Most instructions ask to either install QGIS or embed in to ...
2
votes
1answer
82 views

Delete all fields with the string “RAWI” using QGIS Python

I would like to delete all fields with the string "RAWI". For instance the field "RAWI_WA" and the field "RAWI_BO" should be deleted but not the field "NSG_RAW"
1
vote
2answers
121 views

Couldn't load QGIS utils; Python support disabled; No module named future

Unexpectedly Qgis won't open today. Error code is: Couldn't load QGIS utils. Python support will be disabled. Traceback (most recent call last): File "", line 1, in File ...
0
votes
1answer
32 views

How to extract a shapefile with a SQL expression from a database of shapefiles using PyQGIS or OGR [duplicate]

I have a shapefile Water_Districts.shp that consists of several water district polygons. I am trying to use the script below to 'extract' a specific polygon with the name Cache La Poudre River listed ...
5
votes
2answers
109 views

QGIS python processing.runalg Clip returns None

I'm writing a script in pyQGIS, which would emulate measurement of a line by "walking" along it with a compass with constant length. I have a problem with the Clip algorythm from processing module, ...
1
vote
2answers
82 views

problem combining geometries from all features in a layer as one geometry

I am trying to combine all features of a Polygon layer in QGIS in a python plugin, and am running into this error when I try to run the combine method: "AttributeError: 'NoneType' object has no ...
1
vote
0answers
44 views

How to clip many lines with polygon?

I have two vector layers: "parallel": a vector layer containing a lot of lines, they're all parallel but that shouldnt matter "polygon": a vector layer with just 1 polygon I want to create a new ...
3
votes
0answers
57 views

Setting default label font in QGIS?

QGIS currently does not have a way to set a default font to be used for labelling, and being lazy I'm getting tired of having to set our house font styling for every layer I create or use (see change ...
2
votes
1answer
57 views

Python Script stopping for large files

I wrote this script to classify a shapefile in 5 classes, this works for small files (minor 8000 features), for larger files, the process has stopped. Can make this better? #Load the shape vrAdubo = ...
2
votes
0answers
21 views

Open QGIS project files in exclusive mode / alert if project file already in use

I have QGIS-Project-Files saved to a network drive and was wondering if it is possible to warn users that a project file is already opened by an other user to prevent concurrent editing of the same ...
1
vote
1answer
38 views

Plugin Development “ignore close event”

I'm quite new in either QGis-Plugin- and Qt-development. I started to work on a Plugin, which displays a dialog (I used pluginBuilder and Qt-Designer) in which the user should select some options. ...
4
votes
1answer
65 views

How to split a circle in equal parts in QGIS?

I'm looking to split a circle polygon generated by a buffer around a point in equal parts. The goal is to be able to calculate statistics about the raster that will be under the circle for each part ...
1
vote
2answers
54 views

How to ireate over text of legends on QGIS and change that with fields from a Shape

I'm using 2.8.3 version of QGIS, I need change the text of legend, this is because I want to concatenate two or more fields from a Shapefile to compose this text. Can I iterate over text of legends ...
0
votes
1answer
41 views

Using pyQGIS, how do you project a shp file from EPSG:4326 to 3857?

I downloaded a few shape files but they're in EPSG:4326 and I need them in EPSG:3857. Is there a way to convert/save these files using pyQGIS?
1
vote
0answers
29 views

Plugin for automatic refreshing of vector layers in QGIS [closed]

I am trying to develop a plugin for QGIS which can automatically refresh all vector layers at a given interval of time. Prior to QGIS version 2.06 I was using self.iface.mapCanvas().refresh) along ...
0
votes
0answers
76 views

Using external IDE eclipse to develop python plugin for QGIS?

I am new to QGIS and coding for QGIS, but I have experience with C++ and Qt. I am reading the book "Python Programming CookBook" to learn how to develop a plugin to QGIS, however I am facing some ...
2
votes
1answer
78 views

How to solve SIP installation error?

I'm new to Python, and am trying to install Qt/PyQt for PyQGIS. I downloaded the PyQt and SIP packages, and tried to install them but have run into errors. Installing SIP: As far as I can tell, ...
1
vote
2answers
59 views

Problem with query in a loop in QGIS Script

I want to run the following script in QGIS from qgis.core import * from qgis.utils import * from PyQt4.QtCore import * inLayer = iface.activeLayer() with open('iso_codes.txt') as f: codes = ...
2
votes
1answer
92 views

Remove features inside a feature in shapefile using python (UNION, CONTAINS methods)

I have created a shape file from raster. The shapefile was generated using contours detection. I am in the process of automating feature detection using python and open source libraries such as ...
3
votes
1answer
78 views

QGIS 2.14 Plugin Encoding Error

I've developed a plugin for QGIS 2.12 which uses data that is encoded in UTF-8. The plugin works fine for 2.12, but when I try to start it in QGIS 2.14 it throws me the following error: ...
3
votes
1answer
85 views

Works in Console but not in Script Editor

On QGIS, I am using a simple script to zoom the selected features. I write them in the Text Editor, but it didn't work until I used the console... and it does work. What kind of problem is this? Is ...
1
vote
0answers
10 views

provider.addAttribute $area [duplicate]

I'm trying to add the attribute $area. I made a intersection and Tot_aera isn't the good one, so I want to add a new. I made that : from PyQt4.QtCore import * try: if ind==-1: if caps ...
1
vote
0answers
48 views

PyQGIS: vector layer does not get displayed after rendering

My project goal is to write a standalone app for Unbuntu and QGIS 2.14. It should get a layer of simple points and their name from a Postgres database and show them in a layer. In addition there ...
1
vote
1answer
72 views

Load multiple files from folder for further processing

I'm working on a processing model and I'm looking for a possibility to load multiple shape-files from an Input-folder for further processing (first clip them all to a certain extend, then assign them ...
3
votes
1answer
113 views

Using processing algorithm in QGIS plugin

I'm building a plugin in QGIS, one of its part is processing algorithm: intersection. I want to save the result as memory layer, and then work on it. Following code was working fine, nothing changed ...
4
votes
1answer
103 views

Implementing NNJoin in Python

I am curious to know on how to implement NNJoin into the python code. I have created a point shapefile using shapely. I have another shapefile which is a centerline and is used as a reference line. ...
3
votes
1answer
38 views

How to read help() from QGIS classes

I'm trying to copy a shapefile and give it a new name in QGIS python console, I am trying to use the QgsVectorFileWriter class' writeAsVectorFormat method writeAsVectorFormat(...) ...
3
votes
0answers
49 views

Gdal and module import error when creating an .exe application with pyinstaller

I’ve been struggling since three days in a row to create a windows executable application from my python application. I have managed to get results but I’m not at all satisfied with the workarounds I ...
3
votes
1answer
38 views

How to set the color of a feature depending on field attributes with PyQGIS?

from PyQt4.QtCore import * from PyQt4.QtGui import * def Symbology(): canvas = qgis.utils.iface.mapCanvas() layer = qgis.utils.iface.activeLayer() for feat in layer.getFeatures(): ...
5
votes
2answers
160 views

How to find disconnected islands in a road network layer, using QGIS

I have a road network layer that can't route from one side of the layer to the other. Topologically, there is no connectivity between the start and end nodes, probably due to missing links. This ...
1
vote
2answers
73 views

QGIS equivalent to arcpy.SearchCursor?

What is the equivalent in QGIS (or other FOSS) to this: rows = arcpy.SearchCursor(table, fields="ORIG_FID; field1; field2; field3; field4", ...
1
vote
1answer
21 views

Why would having a reference string “boh@10” cause a crash?

When using the raster calculator in a pyqgis script, I have several layers to process. When it gets to "boh@10", the processCalculation() call crashes. I don't see anything in the code that requires ...
3
votes
1answer
61 views

How to get the feature id of features added to dataProviders?

My question is somehow related to the problem of finding the id of the last added feature: I am looking for a way to supply the feature id and another attribute of each added feature through a signal. ...