Questions tagged [pyqgis]

Use for the python library that applies to the Qgis GIS program.

Python bindings for the Qgis GIS program. Example code and descriptions can be found at https://docs.qgis.org/3.10/en/docs/pyqgis_developer_cookbook/index.html

170 questions
0
votes
0 answers

How can we create a raster attribute table using QGIS Python

I have a couple of raster files and I need to create attribute tables for them in QGIS using PyQGIS. I have tried raster attribute table plugin but how can I do it from the Python console?
0
votes
0 answers

Setting color of Qgs Symbol to an expression or variable

I'm working with QgsSymbolLayer and I want to set the stroke color to an expression (@symbol_color) but I can't seem to figure it out. And the documentation doesn't talk about using expressions for it. I basically want to do what is in the photo…
Nidal Barada
  • 373
  • 2
  • 14
0
votes
1 answer

Script for validating the entries made by the user in pyqgis

I am writing a script in pyqgis which should perform the following task: First it should read a csv file which we consider it as a input csv,csv file will be something like this: layer ,columnname ,condition ,values layer1…
Ayan
  • 13
  • 3
0
votes
0 answers

Delete features with PyQGIS in a loop

I have been for months trying unsuccesfully to make a function which can compare a feature with the other ones in a shp layer and if some conditions fulfill, the feature in the loop is deleted. I need it for my final work. The conditions to delete a…
0
votes
0 answers

pyQGIS: Can I establish an event-listener on common qgis function like "Split Features"

I'm trying to react on a QGIS build-in function by attaching an event-listener of some sort. Unfortunalely, my reserch didn't give me any possible approach. So I have no code to show. So my question is pretty general. I know qgis has an event…
bowser
  • 43
  • 4
0
votes
0 answers

AttributeError: 'dict' object has no attribute 'startEditing'

Good morning, I'm new to pyqgis. I'm trying to create a new field in my attribute table but it's not working if someone can help me I appreciate it follow the code: # Calculadora de campo alg_params = { 'FIELD_LENGTH': 0, …
0
votes
0 answers

Trigger Refresh from subClass to mainClass

I have a main dialog which displays information, and it also has a edit data button. When the edit data button is clicked a new dialog appears where you can edit and change and data and press OK to save it into the txt file that stores the data. I'm…
Nidal Barada
  • 373
  • 2
  • 14
0
votes
0 answers

How to fix PyQgis layout resizing problem when making window bigger?

I'm working on creating python plugin that implements image viewer and use layout to plased elements in correct plases. I want to resize all elements in dialog window of this plugin using resizeEvent of QDialog, but I have one strange problem: when…
Danylo
  • 1
  • 2
0
votes
1 answer

PYQGIS: How to use QgsRasterFileWriter.writeRaster to create raster from numpy array

I am trying to use the method writeRaster from qgis.core.writeRaster to create a singleBand raster of float and Nans but according to the documentation, I need to provide theses inputs: writeRaster( self, # OK pipe: QgsRasterPipe, # Q1 …
Vincent Bénet
  • 1,212
  • 6
  • 20
0
votes
1 answer

PyQGIS - is it possible to promote my own class in Qt Designer?

While I developed QGIS plugin, I get some problem with promoting class in Qt Designer. I create plugin, using Plugin Builder and after that I reorganize the structure to this: Structure So now, when I promote a ComboBox in Qt Designer to my combobox…
Kaemer
  • 1
  • 1
0
votes
0 answers

I failed to access HTTPS's WMS service using PyQGIS's QgsRasterLayer

uri = '''https://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-90,45,-45,90&WIDTH=256&HEIGHT=256 ''' layer = QgsRasterLayer(uri, "RESA", "WMS") if…
0
votes
0 answers

QMessageBox black out

I have a pyqgis script done in QGIS 2.18 which basically open a QGIS3 project with around 9 layers. There is a lag until these layer are displayed on the canvas so I put a QMessageBox to display a waiting message for the user. This is the…
0
votes
1 answer

pyqgis standalone applicaton windows

Ive downloaded QGIS 3.22 according to documentation, I need to set PYTHONPANTH and PATH to make pyqgis visible from python for a stand alone application: set PYTHONPATH=c:\python such folder doesnt exist. Specificly c:\program files\qgis…
m3ntor
  • 11
  • 2
0
votes
1 answer

Using a QGIS Custom Function in a python script

I want to take a custom function for QGIS made in python and use it in a python script. The function came from this answer https://gis.stackexchange.com/questions/245146/getting-quantity-of-intersecting-lines-of-polygons-in-qgis and I updated it to…
MrKingsley
  • 171
  • 1
  • 10
0
votes
0 answers

Error when reloading new Plugin code in QGIS

I am nooby to Plugin Development but I'm trying to create a plugin in QGIS, for a Uni-subject, with its own graphical interface, which will receive a zipcode from the user and return the name of the corresponding location. I already created the…
Zeca
  • 1