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
1 answer

How to insert rows of csv data with matching column names in PostgreSQL table?

I am writing a code to copy rows of matching columns from CSV to PostgreSQL table. I am using python and qgis for the same.Code is as follows connection=psycopg2.connect(host=host, port=port, dbname=dbname, user=name_user, password=password) …
0
votes
1 answer

.map is not a function in Google Earth Engine

I am trying to normalize my data. But it says, .map is not a function. How can I come up with this? var Stprep = raindata.subtract(ltamean).divide(ltastd); var SPI = Stprep .map(function(image){ var Imin = Stprep .reduce(ee.Reducer.min()) var…
0
votes
1 answer

Exporting sld with pyQgis

Is there a way to export the style of a layer thanks to pyqgis in a sld file? I didn't find it in the documentation. I am in a 3.x version of Qgis
0
votes
1 answer

Python QGIS Processing of Shortest Path

I would like to use python and execute the Shortest Path Processing using QGIS. But I would like to ask on how can I load the Vector Layer (endPointLayer ) in the END_POINT (params)? The below is my python code endPointLayer =…
xxestter
  • 441
  • 7
  • 19
0
votes
1 answer

Use multiple windows in pyqt5

I'm building a plugin for QGIS using PyQGIS and PyQt5. I want to work with multiple windows. After clicking a button, a new window should open. Ideally, it should overlap window 1. After editing in window 2, it should go back to window 1. My…
cc_schr_gis
  • 123
  • 3
0
votes
0 answers

Why am I getting 'Could not load source layer for INPUT: invalid value' for native:extractbyexpression algorithm on QGIS?

I need to convert this: from qgis.core import QgsProcessing from qgis.core import QgsProcessingAlgorithm from qgis.core import QgsProcessingMultiStepFeedback from qgis.core import QgsProcessingParameterVectorLayer from qgis.core import…
0
votes
1 answer

Visual Studio Code Upgrading to 1.56.0... Issues with Windows Environment

Prior to the last Visual Studio Code update, I was able to set the windows environment variables. Now with the new update I can't and I don't know what to do. My code is quite long so to simplify it I have tried to change the windows prompt,…
RBenet
  • 171
  • 1
  • 10
0
votes
1 answer

PyQGIS 3.18.2 Removing Band Name from Symbology

I recently updated my QGIS and I noticed the styles now show the band Band 1(Gray) The issue is it now shows within my print layout: Using PYQGIS, how can I remove just the Band 1 (Gray)? For reference, here is how I am currently setting the…
Jonathan
  • 43
  • 5
0
votes
2 answers

Load a point layer from CSV in PyQGIS QGIS 3.10

I'm trying to use a script that loads in a point layer from CSV. The code that I used is: uri = "file:///some_path/PyQGIS/Some.csv?delimiter={}&xField={}&yField={}".format(os.getcwd(), ";", "X", "Y") vlayer = QgsVectorLayer(uri, "Name",…
Bram
  • 31
  • 3
0
votes
1 answer

pyQgis processing algortihm

import sys sys.path.append("c:\\osgeo4w64\\app\qgis\\pyto\\plugins") import processing, os,glob layer1 = QgsVectorLayer(layer1ShpFilePath, "layer1", "ogr") layer2 = QgsVectorLayer(layer2ShpFilePath, "layer2", "ogr") params = { …
xxestter
  • 441
  • 7
  • 19
0
votes
0 answers

PyQGis crash with QWebEngineView

I have QGIS 3.16.3-Hannover installed with Qt 5.11.2 and 64-bit windows 10. In two more computers I also have it installed in similar conditions. I am using the PyQgis to stand-alone applications from Qgis and I think there is something that is not…
RBenet
  • 171
  • 1
  • 10
0
votes
1 answer

How to load Postgres QgsVectorLayer

I have a QGIS script that I am trying to load a vector layer that is stored in a Postgres database. When I print the layer's isValid() method I get False. Here is my code: from qgis.core import * db_client = 'postgres' db_host = 'localhost' db_port…
user908759
  • 1,355
  • 8
  • 26
  • 48
0
votes
1 answer

How to print a specific row from a list in python

I have a list called 'DistInt' that contains values of Intensity with corresponding Distances for an earthquake event. Is there a way I can just print a specific row within list? import math import json # Open JSON file f =…
LiamHems
  • 121
  • 7
0
votes
0 answers

Problems in converting raster to vector in QGIS3

I am trying to convert some raster layers (from a wms) to vector layers, by using the Polygonize tool in QGIS3.14, however I always get this decoding error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 41: invalid start…
Pawel
  • 39
  • 1
0
votes
1 answer

CheckableComboBox in PyQGIS (waiting for choice)

I am using this code in QGIS's built-in python-editor. How can I make the script wait while I mark the necessary lines, and only then continue execution? So far, I cannot do this: the window starts, but the script continues to execute and therefore…
1 2 3
11
12