Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pyqgis]

Python bindings for QGIS.

1
vote
0answers
22 views

How to read PyQGIS documentation? [on hold]

As I get more into QGIS scripting, I refer to the documentation often and usually without success. I have trouble deciphering how to interpret the classes, etc. I've been really struggling to create ...
1
vote
1answer
28 views

How to remove legend items with PyQGIS without removing the layer?

I am trying to generate maps in pdf files by using a pre-defined .qgz layout. I am already able to load layers and adjust color scale, etc. Since the legend is synchronized with the map layers, all ...
-1
votes
0answers
20 views

add layers shown in Table of content as a input parameter [on hold]

I want to add layers shown in Table of content as a input parameter to a script which I written in python language.Can anyone help me to do this?
1
vote
1answer
27 views

Retrieve layer file path in PyQgis

I've been trying to list al file paths in my project using PyQgis (I'm not really acquainted with it); my goal is to translate and clip them all to export them to a folder I've tried with: names = ...
0
votes
0answers
26 views

Python QGIS .svg symbol with modifiable color (data defined override)

I can import an .svg format symbol on a vector layer by using QGIS Desktop App and change its color by using data defined override part(case when .. then rgb_color(255,0,0) END ). How can I implement ...
2
votes
1answer
62 views

Writing PyQGIS code to select items in line layer by length?

I have been trying to write a short code to select items in a line layer that are longer than 2000m, but I don't have much luck at the moment now. layer=iface.activeLayer() selected_fid=[] lenth=[] ...
1
vote
0answers
26 views

Is there a way to use the project layout if using a plug in that creates batch maps through QGIS?

There is a plugin for biological records which creates batch maps for each taxon but it bypasses the premade project layout with a legend, picture of a logo and the copyright for each of them. Is ...
1
vote
1answer
20 views

Toggle labels on/off for a layer with PyQGIS 2?

I try to toggle labels on/off for a layer in QGIS 2.18 with PyQGIS. In PyQGIS 3 a method QgsVectorLayer().setLabelsEnabled() seem to have been added, but as far as I see, such is not available in ...
2
votes
2answers
35 views

PyQGIS QgsSvgMarkerSymbolLayerV2 setDataDefinedProperty() for color doesnt work

i have a script which works well and changes the symbol QuarterCircle's color and angle : vLayer = QgsVectorLayer(uri, "myData" , "delimitedtext") symbol = QgsSymbolV2.defaultSymbol(vLayer....
2
votes
0answers
34 views

Running python code created in QGIS

I'm using QGIS 3.4 and Python 3.7.0 on Windows 7. From the Python console of QGIS, I created a test script ("test.py") which contains the following line: print('Hello) and this is saved in C:\...
2
votes
1answer
44 views

Running into endless loop when adding feature to layer with pyqgis

I am working on a script where I want the user to add feature to a layer in edit mode, and then decide whether to keep the newly added feature in the layer or not. I am doing it the following way: ...
1
vote
1answer
36 views

Hosting a few shapefiles so multiple users could use and edit the same map

Is there a way to synchronize a QGIS map with vector layers so that 3 or 4 users can use and edit the same file? I have a plug-in that updates shapefiles on a layer and it would be great to ...
1
vote
0answers
19 views

PyQGIS (3.4) and PyQt5 DLL error

I have installed the new version os QGIS(3.4) on my computer. I am working in a standalone application of PyQGIS so I need to load PyQt5 components. As a difference with previous versions when I try ...
1
vote
1answer
22 views

QDockWidget not showing content at first sight

I'm loading the QDockWidget and it does load fine and has the content but it seems that doesn't have a fixed size that avoids it's content to be hidden once loaded. this is how it looks when is ...
1
vote
1answer
27 views

Add new feature to QGIS layer with pre-defined attributes using pyqgis

I am working on a pyqgis script where I allow the user to add features using the addfeature map tool, where the user can create the geometry of the feature by clicking on the canvas, and after the ...
1
vote
1answer
17 views

enable Advanced Digitizing Panel (cadDockwidget) with PyQgis

I am working on a PyQgis Plugin where I want to enable cad in advanced digitizing panel. Following pre-conditions are met: layer is in edit mode project has projected crs move feature tool is ...
1
vote
1answer
25 views

PyQGIS (3.2) and H5PY DLL problem

I am working in a project in which I need to use PyQGIS and H5PY. The problem comes when I load qgis library and h5py, for example: import qgis import h5py I get this error: from ._conv import ...
1
vote
2answers
28 views

Python QGIS QgsSimpleMarkerSymbolLayerBase 1/8 Circle

How can I change the shape of simple marker to simple_marker = QgsSimpleMarkerSymbolLayerV2() simple_marker.setShape(QgsSimpleMarkerSymbolLayerBase.QuarterCircle ) not QuarterCircle(1/4) but 1/8 , ...
5
votes
2answers
199 views

Finding distance between point and polygon edge in eastward direction using PyQGIS?

I need to find distance in eastward direction from each point to the closest polygon edge: I can find shortest distance in any direction with: pointlayer = QgsProject.instance().mapLayersByName('...
3
votes
1answer
38 views

pyqgis - post-processing of layer output of QgsProcessingAlgorithm

While extending a plugin with a Processing Provider and a set of algorithms I mostly followed the defaults of Plugin Builder 3. So, the basic code is smth along the lines of class ORSisochronesAlgo(...
1
vote
1answer
76 views

UBUNTU 16.04, QGIS 3.4 above Installation problem

I want to install QGIS 3.4 above and did exactly the same as this page: QGIS Installers and tried the codes below having no error at all: (1) add the following lines to /etc/apt/sources.list deb ...
3
votes
1answer
64 views

How to export a layout in standalone script with QGIS 3? [closed]

I'm trying to automate map export from a QGIS project in a standalone python script, without interface. Many of the scripts founds are for QGIS 2. For example the script written by Tim Sutton here. ...
2
votes
1answer
40 views

QGIS3.4 Madeira crashes when calling print()

I am using the pyqgis template from underdark for showing the crash. Her script is running like a charm, but as soon as I add a print("finished...")-call in her code, QGIS3.4 Madeira crashes. You can ...
2
votes
1answer
66 views

Getting line geometry out of two points using QGIS?

I have one input point layer and out of that, I want to create an output LINE vector layer. For each feature in my output line vector layer, I define a geometry which takes 2 point geometries. ...
2
votes
1answer
31 views

Loading QGIS Python tools in ArcMap? [closed]

How to load QGIS Python tools in ArcMap? For example, if I want to use any GDAL or GRASS tools in ArcMap.
3
votes
1answer
28 views

Get number of changed features in a layer under edit mode using pyqgis

Is there a method I can find out, how many features in a layer have changed during edit mode (including changes in the attribute and the geometry)?
1
vote
0answers
42 views

QGIS 3 Python plugin psycopg2 Postgres Notify/Listen Live Connection

I'm developing a plugin for QGIS3 for my company, where my managers can allocate tasks to other users. I have programmed two tables within the python script, witch will be only visible according to ...
2
votes
1answer
28 views

Pyqgis Gdal_translate

I would like to transform tifs in a directory with using python in qgis 3 in order to make tifs with a diffrent crs and adding tfw file. import glob, os from PyQt5.QtCore import QFileInfo from qgis....
0
votes
0answers
14 views

PyQGIS edit sample color by using expression (data-defined-override)

i have a .tab file which has a polygon geometry type.I want to change its colors according to some expression.In order to do this i could go properties>styles>simple fill>Edit(data defined override)>...
1
vote
0answers
16 views

PyQGIS 3D Map API

I can't find the way to show / hide / manage 3D map canvas in pyqgis. I've searched in API but nothing. Is there a way to control the 3d map visualization from plugin like QgsMapCanvas?
0
votes
0answers
35 views

Allow access to PostgreSQL database only through QGIS plugin

I created a Python plugin in QGIS that manage the connection to my PostgreSQL database and loading layers in a specific structure, I've created also some personalized widgets to edit attribute tables ...
-5
votes
0answers
38 views

Which python library is best to use all GIS tools in python only? [closed]

Which python library is best to use all GIS tools in python only?
0
votes
0answers
21 views

GeoRefrencing in Gdal using x,y of four Corners

I have co-ordinates of all four corners of a raster and i want to Georefrence the raster using those co-ordinates, I can specify the following in SetGeoTransform # (uperleftx, scalex, skewx, ...
1
vote
0answers
29 views

Promoting to multipart using PyQGIS?

I am creating a code that aggregates neighbouring polygons if they have similar value on the field 'DN' and if they are closer than 50 m.Then I want to iterate this 3 times. I could already get the ...
1
vote
0answers
31 views

Debugging processing algorithms in PyQGIS?

This is my code which should call processing alg selectbylocation and do intersection and touch between two layers. Next layer - points should intersect with the result of the previous layer. I typed ...
2
votes
1answer
48 views

Distance betweeen classified Points

I got two sets of points. The first set has a unique ID The second set references to this ID (one-to-many). So I merged the two sets. Now every point in the joined table has the X and Y coordinates ...
1
vote
1answer
43 views

Categorized symbols are not working in QGIS 3.4

I'm trying to generate categorized symbols for a polygon layer in QGIS 3.4. The code below should generate random colour polygons for each record of 'run' layer and I'm not getting any error message. ...
1
vote
1answer
30 views

PyQgis won't find dockwidget child

Manually in the PythonConsole I can open or close panels but when is executed in code it won't find the dockwidget, this is the line I'm using in my code: self.iface.mainWindow().findChild(...
1
vote
0answers
27 views

Failed to load python Qgis 3.4 add-ins

I installed Qgis 3.4 Madeira and it worked fine, but now it throws me two errors The first is the following: The second is: By omitting the two errors that load with several defects, such as: a ...
0
votes
1answer
34 views

how to get first and last point of MultiLineString-objects in qgis3

i would like to identify the start- and endpoints within a set of polylines and return the coordinates of both points finally. so far i have been able to iterate the features and found out that ...
1
vote
0answers
28 views

Is it possible to pass multiple WMS layer to a processing script

Is it possible to pass multiple WMS layers as parameters to a QGIS 3 processing script, similar to QgsProcessingParameterMultipleLayers but using WMS or WFS Layer? QgsProcessingParameterMultipleLayers ...
0
votes
0answers
11 views

pyqgis processing: running multiple tools in a single algorithm

I have the following code that executes the v.clean processing plugin: params = { 'input' : input, 'type' : 1, 'tool' : 1, 'threshold' : 0.000095, 'output': ...
0
votes
1answer
31 views

Dissolving using PyQGIS?

I have trouble to use function dissolve to dissolve polygons by field value in PyQGIS3. In PyQGIS2 this line was doing the job: QgsGeometryAnalyzer().dissolve(ki, "name.shp", onlySelectedFeatures=...
1
vote
1answer
41 views

Compute 3D seismic fold with QGIS and Python

Computing 3D seismic fold is quite straight forward, for those unfamiliar with the concept, below is a brief explanation. Background information (Seismic 101) : Seismic Fold: Basically, I have (...
0
votes
1answer
41 views

from qgis.gui import QgsMapCanvas - ModuleNotFoundError: No module named 'qgis'

I created a form with QT Designer, then converted it to a .py file. An error occurs with the line import : from qgis.gui import QgsMapCanvas. It's not recognized. How can I resolved this error in ...
1
vote
1answer
30 views

Run processing only in layers with selection

First of all, I am really begginer with PyQGis... I am trying to run a random point algorithm in different vector layers of a folder. But I dont want to do it for every polygon, only for selected ...
0
votes
0answers
28 views

Pyqgis standalone - Matplotlib on QgsMapCanvas

Standalone mapping application: Is possible to plot a point like scatter of matplotlib on QgsMapCanvas object? I want to display my GPS current position without create a shapefile and edits it. ...
2
votes
1answer
64 views

How to open GPKG layer fo processing in QGIS

I am making a model with QGIS 3.4 graphical modeler that should open and process a layer from the GPKG located in the project folder. Since the folder path may be changed, and QGIS does not allow ...
2
votes
1answer
106 views

Defining fields and adding features to output layer using QGIS?

I have two input vector layers (one point and one line layer). I loop through every feature in the input-line-layer and calculate some things (with help of the point layer). What I am trying to do ...
1
vote
1answer
52 views

Making automatic updated date and time field in QGIS

I wish to create a field which automatically updates with the current timestamp when edits are made to a feature. I am using QGIS 3.4 and I am testing this using a shapefile. Following @Joseph's ...