Skip to main content

Questions tagged [pyqgis]

0 votes
0 answers
35 views

Override default keyboard shortcut while QGIS plugin window is active

I'm writing a QGIS plugin that uses a QMainWindow and includes several QActions. I'd like to trigger those actions via keyboard shortcuts, but only when the QMainWindow is active. The shortcuts I'm ...
Jesse Reilly's user avatar
1 vote
0 answers
37 views

QGIS plugin development: setting up QgsLayerItems with WMTS

I am in the process of developing a QGIS plugin that makes use of QgsLayerItem objects in the browser to provide a list of WMTS data sources. These WMTS sources are expected to be from a variety of ...
Geopard's user avatar
  • 11
0 votes
0 answers
35 views

Add custom CRS in QGIS resources DB

I have a custom CRS that I want to use regardless of the profile I am currently working in. I can add the CRS to resources/srs.db and to resources/qgis.db (and to profile/qgis.db). A CRS added to ...
Dezmonder's user avatar
  • 309
0 votes
1 answer
57 views

Duplicating a layer to create a virtual field on it with PyQGIS

In a plugin I want to create a duplicate of the selected layer and add a virtual field including some symbology to it. I've tried the following, and it appears to do the what I want (imitate the "...
Honeybear's user avatar
  • 2,758
1 vote
0 answers
35 views

Correct syntax for VAR_MODEL in sagang:kriging via PyQGIS

I am writing a PyQGIS script to automate interpolation using the sagang:ordinarykriging algorithm (QGIS 3.28.13, SAGA 9.2.0). While the algorithm runs successfully with the default linear variogram ...
fmn_m's user avatar
  • 11
0 votes
2 answers
115 views

Python Plugins does not work on QGIS 3.44 (Fedora Linux)

Recently I migrated from windows to Fedora (KDE Plasma Desktop 42) and I'm suffering with several issues whit python based image analises plugins. Most of them seems like to be related to a ...
Alyson Sousa's user avatar
3 votes
1 answer
343 views

Using Python Code as tool in QGIS

I have this little Python code. I want a button or at least a tool in the toolbox which I can click so the console does not have to be open all the time. I unterstand that saving this code as .py and ...
BAE_23's user avatar
  • 967
1 vote
1 answer
122 views

Saving results in already created GeoPackage with QGIS graphical modeler script

I have a QGIS graphical model. I want to save the results in an empty GeoPackage (just with one dummy layer). The PyQGIS script below works and creates the wanted GeoPackage beforehand, but now I want ...
BAE_23's user avatar
  • 967
1 vote
0 answers
53 views

Shapefile DataSourceUri different depending on how the layer is loaded using PyQGIS

I'm using Python in conjunction with a custom form to autofill some fields. I add a vector layer to my project (via 'Add Layer' button) and then use: print(self.dlg.SelectedLayer.currentLayer()....
Doug's user avatar
  • 11
2 votes
1 answer
87 views

Changing QgsProcessingParameterVectorDestination output to *.shp instead of *.gpkg in QGIS Processing Algorithm

I'm updating a plugin for QGIS and struggling to see how to set the default file type when using the QgsProcessingParameterVectorDestination parameter. See code below. self.addParameter( ...
Kapanther's user avatar
  • 336
4 votes
1 answer
190 views

Removing rows in Layout legend with PyQGIS

I have a script that exports multiple layouts using different layers. Part of it is changing the legend depending on which layer is being printed in the layout. I'm having trouble finding a way to ...
Blas Zlatar's user avatar
0 votes
0 answers
58 views

Catch or Suppress GDAL Error when using QgsRasterLayer in a standalone script

I am trying to get raster sublayers from fileGeodatabase using gdbLayer = QgsRasterLayer(gdbPath, "OpenFileGDB", "gdal") in a standalone pyqgis script and I am getting this error. ...
cratcliff's user avatar
  • 156
1 vote
1 answer
74 views

Update existing WMS connection in PyQGIS

I update a list of WMS connections automatically with QgsSettings(). When the connection doesn't exist, it is well created with all good attributes. But when the connection already exists, and one ...
dmjf08's user avatar
  • 1,343
1 vote
1 answer
94 views

Exporting aliases I/O names from vector layer attributes to GeoPackage using PyQGIS

I want to export a vector layer to GeoJSON file, but with some field aliases. Presently, I'm exporting it with fields only. fields = ["field_1", "field_2"] idxs = [layer.fields()....
Plamen's user avatar
  • 133
3 votes
1 answer
77 views

How do I debug/Run issues with code while attempting to execute TIN interpolation in QGIS 3.36.0

I am completing a project for my master's degree on sedimentary layers across South Wales deposited by a marine transgression event at the end Triassic. For the project, we're attempting to generate ...
mordecai_the_guy's user avatar

15 30 50 per page
1
2 3 4 5
526