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

Create a spatial Index of the shapefiles of a schema in PostGIS using pyQGIS

I am creating a spatial Index for each shapefile I have and then I import them in a schema and the spatial index is missing. How do I create the spatial Index again in the schema? layers_fimport = QgsProject.instance().mapLayers().values() for a in…
1
vote
1 answer

Adding checkable combobox in QGIS plugin builder plugin

I am developing a QGIS plugin in python and hit a roadblock when displaying my GUI. I am using the plugin builder framework to develop my plugin and I have trouble displaying a checkable combo box in a scrollArea in my GUI. The code with core…
Ravindu
  • 11
  • 1
1
vote
1 answer

pyQGIS : How to use an URI connection with a pg_service.conf connection type in QGIS 3.16?

I'd like to open a postgreSQL table in QGIS 3.16 with pyGQIS. I've found the QgsDataSourceUri.setConnection method to do this. The problem for me is that the database password is written in clear text. If I put my code on Github or FramaGit, for…
V Damoy
  • 190
  • 10
1
vote
1 answer

AttributeError: module 'pyrsgis.raster' has no attribute 'createDS'

I use Produce Training Data For Deep Learning QGIS plugin to produce a .tiff file for training the model. When I run the Plugin this Error has occurred: Python error: An error has occurred while executing Python code: See message log (Python Error)…
Hamid
  • 41
  • 6
1
vote
1 answer

Remove Toolbar from QGIS Toolbars Menu

I'd like to know how to fully remove a toolbar in PyQGIS, so that the toolbar is not only no longer visible in the toolbar area, but also no longer listed under the View menu (View > Toolbars) or when right-clicking on the toolbar area. It is easy…
corvus
  • 556
  • 7
  • 18
1
vote
0 answers

Installing a third party plugin for QGIS3.6 on Mac

I have downloaded a zip file containing a third party plug-in for QGIS3.6 (named AVHYAS, downloaded from https://vedas.sac.gov.in/en/download.html). The plug-in was installed via Plugins -> Manage and install plug-ins -> Install from ZIP. However,…
user5618251
  • 317
  • 1
  • 9
1
vote
0 answers

How to add histogram diagram and set its position, color etc. by PyQGIS (3.x)?

I am trying to add histogram diagram by PyQGIS (3.x). Here is the sample point shapefile and the final output I am trying to achieve: I have tried the code below but my QGIS freezes. The current code does not include setting position of each…
Yuhei
  • 11
  • 2
1
vote
0 answers

Adding Z (elevation to image when georeferencing with gdal_translate and gdalwarp via gcps)

I have been trying to georeference an image with given gcps (X-Y coordinates and Z (elevation) coordinates). However, when I add gcps via gdal_translate it adds elevation Z but as soon as I use gdalwarp, the elevation disappears and I only get a X-Y…
Hassan
  • 11
  • 1
1
vote
0 answers

how to view map data on qgis

Need help to open this type of map data using qgis desktop:
phamtien
  • 13
  • 5
1
vote
0 answers

Looping over lineEdits in different tabs of the qt-dialog

I'm writing a QGIS plug-in to modify the attributes of a shapefile's features based on categories (the category of each feature is saved in one of the attributes). The relevant part of my Qt-dialog is grouped into tabs, where each tab includes the…
Py Grammer
  • 11
  • 1
1
vote
1 answer

Add number after the name of a directory who already exist

For my QGIS Plugin, I would like to write a python script who add a serial number after the name of a directory if this directory already exist same way as windows do when you download the same file several times. But I don't know how to achieve…
1
vote
0 answers

pyqgis - edit attribute table; records NULL instead "0.0"

I am writing a function to register values ​​in the attribute table to record: def process(self): """Fill dimension field with TOPSIS -rank- value """ provider = self.activeLayer.dataProvider() if…
gmassei
  • 11
  • 3
1
vote
0 answers

Eliminate QGIS temporary files during Python script

I am using a loop to create many raster sampling outputs. After the loop is finished, QGIS takes quite a while to "clean up" the directories where the output files are placed, meaning: It takes time (about 20 minutes) to delete the two temporary…
HeyGeorge
  • 11
  • 2
1
vote
0 answers

DeprecationWarning: gdal.py was placed in a namespace, it is now available as osgeo.gdal

I have a problem with my script. I would like to use a package that allows me to use the qgis software directly in my code. This package is called qgis.core. I had some trouble installing it, but it seems to be done. The problem now is that when I…
Carl Bethuel
  • 37
  • 10
1
vote
0 answers

Using PYQGIS add WMS layer from geoserver which is proxy protected

I have a wms layer hosted on a Geoserver used to display on a web map application using OpenLayers. I will get the map image using the proxy URL which sends a request to the Geoserver and returns the wms layer image as a response. But, I couldn't…
Surya Jai
  • 11
  • 1
1 2
3
11 12