Questions tagged [pyqgis-3]

Python bindings for QGIS 3.

117 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
26 views

/{z}/{x}/{y} Template for QgsRasterLayer in PyQgis3

I took the following code which works in QGIS2 and changed QgsMapLayerRegistry to QgsProject for QGIS3. Running the code in QGIS 3.8.3, the layer is created, but the tiles do not display. The Scale ...
0
votes
0answers
31 views

QgsVectorDataProvider addFeatures doesn't take attributes

I'm trying to add features in empty QgsVectorLayer with addFeatures, I got the layers without attribute: def create_features(input_file, wid, hite, focal_lgth): features = [] filename_def = { ...
0
votes
0answers
42 views

Pyqgis import non-spatial CSV to Qgs project

I'm trying to upload a .csv file to my QGIS project via Pyqgis. According to the following thread Using non-spatial CSV with PyQGIS it should work that way: uri = 'file///C:/Users/denni/Desktop/test....
0
votes
0answers
32 views

Loading layer with QgsVectorLayer in standalone PyQgis 3

I can't seem to figure out why my layer won't charge in QGIS. After reading many topics, it seems to be linked to the prefix path. However changing this, does not seem to work (I tried around 10 ...
0
votes
0answers
136 views

Error message when trying to install first QGIS Plugin

I'm trying to study PyQGIS scripting and follow a tutorial. Following this tutorial I'm developing a plugin that returns "Hello World". I followed every step and copied all of the source code but get ...
0
votes
0answers
33 views

What signal can be used to get the selection change on a feature?

Right now I am using: self.iface.mapCanvas().selectionChanged.connect(FunctionThatReactsToTheSignal) But this one sends two signals, one for the deselection of the previous feature and one for te ...
0
votes
0answers
47 views

import qgis.core in Spyder- DLL load failed

First off, I'm working with QGIS 3.4.5, Spyder 3.6 installed through ArcGIS Pro (2.3.2) python package manager on Windows 10. I can't get the qgis.core module to load and I need some help. I'm ...
0
votes
0answers
51 views

Running PyQGIS script inside QGIS console via Plugin?

I have some calculation and processing done on vector data. I have written code in pyqgis( and executing inside Console).I need to create a plugin (for my use only) which don't have any input button ...
0
votes
0answers
155 views

Request WFS data using GeoServer's viewparams with PyQGIS?

Using PyQGIS how can I request WFS data using GeoServer's viewparams request parameter? I can use the viewparams request parameter to obtain the filtered WFS data I require via my web browser but not ...
0
votes
0answers
70 views

Taking snapshot from for loop in PyQGIS 3?

I am pretty new in PyQGIS and programming in general, and I am trying to get images from four different layers. If I do just for one time with Qtimer option, works... but the problem appears when I ...
0
votes
0answers
31 views

QgsVectorLayer, configuring ogr uri for a shapefile (to set field datatypes)

I'd like to load a .shp and set the data type of one of the fields. I thought something like this would work: uri = 'C:/myfile.shp?field=myfield:integer' vlay = QgsVectorLayer(uri ,'some_name','ogr')...
0
votes
0answers
115 views

Developing and desirably debugging pygis-3 processing scripts?

The writing of processing scripts in QGIS3 changed substantially. On the basis of many tutorials/blog posts and answers on this site I got a running processing script in QGIS3. But it was, for a lousy ...
0
votes
0answers
84 views

pyinstaller3.4 package of pyqgis 3.7 standalone program failed import qgis.core due to missing PyQt5.QtPrintSupport

I have a qgis standalone program that is develop with python3.7/pyqt5.11 that come with the OSGEO4W's QGIS 3.4.4 (the latest LTR), it has the following imports: import os, sys import sip from PyQt5 ...
0
votes
0answers
216 views

Python script randomly crashes QGIS

I'm trying to run a processing script in QGIS 3.4. It doesn't complete because it seems that step 3 is not generated. A few seconds later (after I got the error), QGIS completely crashes (I get the ...
0
votes
0answers
23 views

Find diagram for understanding pyqgis

In orther to undestand the api of pyqgis, i'd like to konw where can i find a diagram of pyqgis api ?
0
votes
0answers
96 views

PyQGIS 3.4: otb:unsupervisedkmeansimageclassification -> AttributeError: module 'processing' has no attribute 'runalg'

I'm trying to classify a raster with PyQGIS: import processing processing.runalg("otb:unsupervisedkmeansimageclassification","FalseColor.tif",128,None,100,3,1000,0.95,"class.tif",None) The python ...
0
votes
1answer
107 views

QGIS 3.0 migration - unable to install PyPDF2

I am migrating my Plugin to QGIS 3.0. Currently a bit stuck trying to install PyPDF2. I have been trying different things for the last couple of hours or more, without success. I have got another ...