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

Issue consistently mapping a python list to dictionary

I am trying to understand why my list (update_features in code below) isn't consistently mapping properly to a dictionary (update_reno_map in code below). There is a bit of code leading up to the mapping, that i've included to give context to the…
user25976
  • 1,005
  • 4
  • 18
  • 39
1
vote
0 answers

Loaded 'qgis' package with Anaconda, importing gives the error "DLL load failed while importing _analysis: The specified module could not be found."

My goal is to edit and run qgis scripts in Spyder. I installed Anaconda. Within Anaconda Navigator I created an environment 'qgis_env' with Python 3.9.15, and installed the qgis package in the environment. Then I installed Spyder in the environment…
teakayist
  • 11
  • 2
1
vote
0 answers

QGIS plugin - getting ModuleNotFoundError when importing specifically python-ternary

I am building a QGIS plugin and I'd like to import a module named python-ternary. I have a specific issue importing this module (others get imported), and importing it in QGIS (works outside of QGIS). I installed it using pip, tried to import it…
1
vote
1 answer

Why does pyqgis not give error or warning, when opening project with invalid file path

I have a stand alone script, that opens a QGIS project file in order to extract details. I accidentally moved a file and the script broke. Below is the interesting part. QgsApplication.setPrefixPath("/usr", True) project = QgsProject.instance() qgs…
Mads Skjern
  • 5,648
  • 6
  • 36
  • 40
1
vote
0 answers

Adding Title to Description section (in file Properties) of .png metadata for use as Alt Text when using Report Layout (or print layout)

I have developed multiple reports with great success; however, I would now like to add a unique Title to the Description in the Metadata for each exported .png file. In my review of the file Properties, for each image exported, there appears to be…
Zapato
  • 11
  • 2
1
vote
0 answers

Problems when trying to setup QGIS on Google Colab

I use the following commands from https://lerryws.xyz/posts/qgis-in-google-colab and get "No module named 'PyQt5.QtCore'" error: !sudo apt-get install gnupg software-properties-common !sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys…
Chrono R.
  • 11
  • 1
1
vote
0 answers

How to embed a SVG symbol with pyQGIS

In a python QGIS plugin, how can I embed a SVG symbol, as if I used the 'Embed file' function in a svg marker symbology in QGIS (at the end we don't need the svg file anymore, the svg description should be embedded into the symbology definition)?
Etienne
  • 111
  • 3
1
vote
1 answer

How to use Graphviz Python module in Qgis Environment?

I installed the graphviz python module with pip commend python -m pip install graphviz later i set the environment system variables then tried in small code in Qgis python console import graphviz print('Graphviz running') dot =…
VSR
  • 49
  • 4
1
vote
2 answers

RuntimeError: qgis._gui cannot import type '\ufffd\ufffd\ufffd\ufffd' from PyQt5.QtCore

i am trying to set a venv to use qgis processing algorithms in a standalone python script. since i am using sublime text, i created a build system and provided the path to python.exe file that gets downloaded with qgis. after creating venv i ran…
Satya Pamidi
  • 143
  • 8
1
vote
1 answer

Using Bing Aerial With API Key in QGIS

I want to use Bing Satellite images in QGIS using the Bing Maps API. You can do this in ArcGIS with not much bother using the API key. I'm sure it must be possible to do this in QGIS but can't work it out. It's easy enough to get low quality maps in…
Tom
  • 11
  • 2
1
vote
1 answer

How to let user select a CRS in QGIS Python plugin?

I am currently developing a QGIS Plugin in python. In it, the user should be able to select a Coordinate Reference System (CRS). In QGIS built-in dialogs, there often is this window called "Coordinate Reference System Selector" which allows…
1
vote
0 answers

'QGIS Processing Executor'_Issue: "sqlite3_open ... unable to open database file"

Trying to run a self built-in QGIS-model (*.model3) using the followoing 'QGIS Processing Executor' (qgis_process) command in the command line does not work. C:\Program Files\QGIS 3.24.1\apps\Qt5\bin>qgis_process run…
Rick Atb
  • 31
  • 3
1
vote
1 answer

QGIS python returning non-zero exit status 1 trying to create a venv

I'm trying to setup a venv using the Python interpreter which ships with QGIS 3.22.6 according to this blog post here. However, when I execute the specific command, the following error…
mael
  • 53
  • 3
1
vote
1 answer

How to check if the environment variable "PROJ_LIB" is defined and how to unset it ? (PyQGIS Standalone Script Executer)

I just tried the standalone PyQGIS application by running the custom script "Proximity.py"* in a VS Code project without the need of a GUI (such as QGIS). But, when I run the python-program I get the following message: proj_create_from_database:…
Rick Atb
  • 31
  • 3
1
vote
1 answer

Load QGIS project from geopackage

My attempt is to use the same function behind the above dialog in which QGIS allow to load project form a geopackage by giving the connection, the path. The idea is to be able to check if a geopackage contains project or not. what I did so far is…
Louis
  • 11
  • 1
1
2
3
11 12