Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Export DXF using PyQGIS and change layer order

When I use project > Import/ Export > Export project to DXF my hatches come out below my other content as desired in the resulting DXF. When I use the code below the hatches come out on top, ...
Sethinacan's user avatar
  • 2,002
1 vote
1 answer
27 views

TypeError when exporting point cloud layer to drive with QgsPointCloudLayerExporter.doExport() via PyQGIS

I am trying to save some point cloud layers to disk without benefiting from the GUI export (that is to say using PyQGIS commands). The point cloud layers are results of earlier filtering that I ...
Sina NAKHOSTIN's user avatar
0 votes
0 answers
24 views

How to reduce load on calculations in PyQGIS

I am trying to calculate the length of a network with creating length field and giving it expression of '$length'. I have approximately 3000 features in layer. I tried two ways By giving default ...
Dinesh Pawar's user avatar
0 votes
0 answers
11 views

Control rendering order in processing plugin doesn't work

I want to set rendering order for my layer Layer name by time field in descending order. When the layer is loaded in the project, I run the code below in the console and it works fine. But when I put ...
Freestyle Season's user avatar
0 votes
1 answer
39 views

QGIS python configuration LayoutTable

I have a problem when I import layout template in QGIS project with Layout Attribute Table. In template I have two frames (tabela1 and tabela2) for one table which is connect to layer "VOZLISCA&...
Miha's user avatar
  • 1
1 vote
0 answers
28 views

Pasting code in python console in QGIS, recognize line change

I'm trying to simply paste Python code I have in a text file to the QGIS Python console. While this worked before, I'm now receiving this error: SyntaxError: multiple statements found while compiling ...
Horizen's user avatar
  • 587
2 votes
1 answer
35 views

Getting Georeferencer target CRS with PyQGIS [closed]

According to the C++ code in qgsgeorefmainwindow.cpp I tried to retrieve the Georeferencer target CRS with PyQGIS using QgsSettings().value("/Plugin-GeoReferencer/targetsrs") but ...
christoph's user avatar
  • 6,417
0 votes
0 answers
24 views

Why does layer.materialize() fail to copy features in gpkg files containing json data?

After making this post: layer.materialize() function not copying all features within layer I ran another multi-part test to determine why layer.materialize() does not copy all features within ...
Jonathan's user avatar
1 vote
0 answers
44 views

layer.materialize() function not copying all features within layer

What could cause the layer.materialize() function to not copy all the features within a layer? Similar Post: layer.materialize() does not copy all features Steps to reproduce: Drag an s57 file in ...
Jonathan's user avatar
2 votes
2 answers
154 views

Using PyQGIS to get data contained in the "in-memory editing buffer" of layer that is currently being edited

I am writing a Python plugin for QGIS and I need to be able to retrieve data about the current edits to a particular layer with in QGIS before the edits have been applied. There does not seem to be ...
Jonathan's user avatar
1 vote
1 answer
74 views

Run standalone PyQGIS script with processing algorithms from external plugins

Some of the external QGIS plugins contain processing algorithms integrated by the processing toolbox after installation, e.g. the plugin "Shape Tools". How can the processing algorithms from ...
Mapos's user avatar
  • 607
0 votes
0 answers
79 views

Applying also the labels, assigning a .qml style file to a layer with PyQGIS

I'm working on QGIS 3.36 and I'd like to apply a .qml style file to a layer. Writing the following instructions of my code, the aspect of layer changes as I want it, but it doesn't load the labels ...
Salvatore Diolosà's user avatar
1 vote
1 answer
55 views

Setting precision for decimal values when labeling layer with PyQGIS

I am currently working on a project in which I need to turn on the "RESULT_PRE" field label so this is the code but the field holds decimal values and I want to give a precision of 3 digits. ...
Dinesh Pawar's user avatar
1 vote
0 answers
22 views

QGIS Server missing DB Manager providers on Docker/Debian

i´m triying to create a QGIS Server container on Docker, following the example in documentation: docs. The purpose of this container is to export some layers from a .gdb file to an external PostGIS ...
Cir02's user avatar
  • 11
2 votes
0 answers
45 views

"IndexError: list index out of range" error when reading memory layer with PyQGIS

In QGIS 3.22.10, I created a No Geometry layer and a group layer. The No Geometry layer was added to the group layer, and it was added perfectly. I can see the data in QGIS. Here is the code for layer ...
Velugoti Venkateswarlu's user avatar
1 vote
0 answers
47 views

"ImportError: attempted relative import with no known parent package" error when running QGIS Plugin in PyCharm

I am trying to run a Plugin that I created in the Python debugger and it gives this error: ImportError: attempted relative import with no known parent package Which appears to be related to this ...
Joe G's user avatar
  • 363
1 vote
0 answers
34 views

"No module named PyQt5.sip" error when using PyQGIS in standalone script

I tried to run Python code from PyQGIS Developer Cookbook | Using PyQGIS in standalone scripts on Windows 10, but I got an error: I installed PyQt5 and PyQt5-sip, and set all paths but the error ...
usev's user avatar
  • 43
0 votes
1 answer
38 views

Georeferenced images from a grid

I have a layer with the attributes height, width, x, y, vertex_ind and a path pointing to a non-georeferenced jpg image. I know how to use the x,y coordinates of each vertex to translate the angles of ...
fcka's user avatar
  • 1,015
2 votes
1 answer
71 views

QGIS plugin showing multiple messages in the message bar

I am adding some user feedback to a plugin. I have followed the pyqgis developer cookbook to create a message as below. self.iface.messageBar().clearWidgets() messagelinktext = 'something is happening'...
Sethinacan's user avatar
  • 2,002
1 vote
1 answer
68 views

Add in content of text file in algorithm dialog in Processing tools text box

I am learning how to create my own processing toolbox, I just want to be able to select a text file and display the content in the multiline text box. I can put "some text" in it but not the ...
GforGIS's user avatar
  • 3,349
1 vote
0 answers
41 views

"Cannot import http://spatialreference.org/ref/epsg/3812/ due to ALLOW_NETWORK_ACCESS=NO" error in PyQGIS

I am building a headless PyQGIS application that will need to be integrated into a bigger system. Everything works, but when reading a layer from a GML file, the output keeps printing: Cannot import ...
Lennert De Feyter's user avatar
2 votes
1 answer
65 views

Running PyQGIS processing algorithms within FME PythonCaller

Using FME Form 2024.1.2 and QGIS 3.34.4 with Python 3.9 the following script: import fme import fmeobjects import sys from qgis.core import QgsApplication, QgsVectorLayer, QgsProcessingFeedback ...
Mapos's user avatar
  • 607
3 votes
1 answer
110 views

Aligning rasters using native:alignrasters with PyQGIS [closed]

I would like to use native:alignrasters to, obviously, align two rasters. However, it does not accept my input layer, despite it being valid. (I tried native:alignsingleraster as well, but that is ...
RavenS's user avatar
  • 69
2 votes
1 answer
79 views

Pole of inaccessibility and buffer loop using PyQGIS

I'm trying to create a Python script in QGIS that will identify potential sites for tree planting in residential areas. The logic is: Start with a layer "trn_fts_roadtrackorpath" that ...
RobShaw_UK's user avatar
1 vote
2 answers
77 views

Setting max zoom level of QgsRasterLayer with PyQGIS

I'm using PyQGIS to add QgsRasterLayer layers to my project. This is how I create the layer: urlWithParams = "type=xyz&url=http://ecn.t3.tiles.virtualearth.net/tiles/a%7Bq%7D.jpeg?g=1" ...
Didac Busquets's user avatar
0 votes
1 answer
90 views

Trouble getting SAGA to work in QGIS 3.4 for Mac

I have been trying to get the SAGA toolbox to work in QGIS 3.4 but it does not show up. I have downloaded the SAGA Next Gen plugin for QGIS, and I have also downloaded SAGA from SourceForge and set ...
MapDeath's user avatar
  • 345
-1 votes
1 answer
91 views

Symbolizing QGIS Raster with PyQGIS [closed]

I would like to symbolize raster layers using PyQGIS. If I understand correctly using a prepared style-file is no solution, since the maximum value of the raster changes depending on the inputs of it'...
RavenS's user avatar
  • 69
0 votes
1 answer
63 views

Setting color of feature of polygon layer with PyQGIS

I'm working on QGIS v. 3.36, I'd like change the color of a feature of a polygon layer called "canvas", but creating QgsMarkerSymbol and setting the renderer, the symbol on the map is ...
Salvatore Diolosà's user avatar
2 votes
0 answers
39 views

Changing the data source of QgsVectorLayer with PyQGIS

I am trying to update the data sources of all the layers of a project. I am going from a SQLite source to a PostgreSQL db source. I can't delete and re-add the layers because there is a large number ...
WouterVermeyen's user avatar
0 votes
1 answer
42 views

How to add a WMS layer to QGIS using PyQGIS with custom authentication headers [closed]

I’m working on adding a WMS layer to QGIS using PyQGIS, and while it works perfectly without authentication, I’m having trouble when custom authentication headers are required. Here are the scenarios ...
Volodymyr Nikulishyn's user avatar
0 votes
0 answers
31 views

SAGA in QGIS 3.30 and versions above

I created a plugin that needs to create a drainage area from an outlet point, for this, I was using the SAGA "upslope area" tool, but I realized just now that I was using SAGA Next Gen in ...
Mestrexama's user avatar
0 votes
0 answers
30 views

Conflct between QgsMapTool and QgsMapToolDigitizeFeature

I created a plugin with one QgsMapTool and one mapTooldigitilizedFeature. When I use the QgsMapTool before the mapTooldigitilizedFeature, I can't digitize my feature and my QGIS crashes. self....
JuLaNouille's user avatar
0 votes
0 answers
62 views

Dealing with QGIS freezing when executing PyQGIS script

I want to create a tool that allows me to use a source layer to retrieve the parcels contained in the selected commune from my PostgreSQL database. When I use layer actions, everything works fine. But ...
Aurélien ROBERT's user avatar
0 votes
0 answers
24 views

Legend Cropped on First Export Using PyQGIS - Why Does It Render Correctly on the Second Export?

My function below creates a map in my processing toolbox. I am having a problem with the legend. def create_geology_overview_map(project, vlyr_ezgStats, ezg_qml, vlyr_geol, geologische_layer_qml, ...
Nil's user avatar
  • 1,606
0 votes
0 answers
23 views

After use commitChanges in layer PyQGIS generate ERROR Failed to delete file qix

When I use commitChanges on a layer in PyQGIS then it generates ERROR 1: Failed to delete somefile.qix I use it in the button method when I want to save the edit changes in the layer. Here is the code:...
Stano's user avatar
  • 49
1 vote
2 answers
65 views

Download location plan centered on each point with QGIS

I'm trying to download the location plan for each point on my network. This will allow me to fill in a data sheet with a GIS photo with the manhole in the center. I've managed to find out how to ...
parerdev81's user avatar
2 votes
1 answer
67 views

Sorting Recently Used Coordinate Reference Systems list in QGIS

I want to sort alphabetically all CRSs in the Recently Used Coordinate Reference Systems list in QGIS. But I can't find a way to do this using the user interface. How one can sort them using PyQGIS?
Comrade Che's user avatar
  • 8,208
3 votes
0 answers
62 views

Custom rotate function based on spheroid

Basically if PostGIS had an ST_Rotate but for geography type where it calculated based on a spheroid. But in my case I want to do this in a QGIS plugin. I need to rotate polygons and I only ever need ...
tbob's user avatar
  • 616
0 votes
0 answers
79 views

Making vertex edits on polygon layers using PyQGIS

I've got a bug/problem in my PyQt QGIS based app. CODE SNIPPET DOWN BELOW A little context first: The app enables users to load polygon data into different map layers which I display on the QGIS map. ...
gd822's user avatar
  • 1
0 votes
1 answer
68 views

Cycling thru themes and and using composer with PyQGIS

I'm trying to make QGIS go through a few themes and export the map with the Composer but I don't manage to switch theme. I tried to get some help from ChatGPT and I few snippets I found on GitHub, ...
Rob's user avatar
  • 149
1 vote
1 answer
86 views

Creating temporal raster (timeseries) in PyQGIS

QGIS can animate a temporal raster using the Temporal Controller. I am trying to programmatically create a layer in Python that can be animated in this way. What I can do so far is to create a numpy ...
Christoph's user avatar
-1 votes
1 answer
51 views

How to retrieve values ​from the layer property window via a script? [closed]

I can obtain via the property window the values: Upper Left / Lower Left / Upper Right / Lower Right for a non-georeferenced image. How can we obtain these values ​​via a script for several hundred ...
fcka's user avatar
  • 1,015
0 votes
0 answers
36 views

Cost raster does not start with zero

I used processing.run('grass7:r.cost', params) to create a cost raster starting at one or several points along a street-raster-layer. Each cell is 1m² and the algorithm is supposed to accumulate (...
RavenS's user avatar
  • 69
0 votes
0 answers
28 views

Failure to load qgis_core.dll in py scripy

We (Git Hub's co-pilot and I) are attempting to automate several processes using Python. One step in the process requires that I create and manipulate QGIS projects. Apparently this step requires ...
DataDel's user avatar
2 votes
1 answer
68 views

Button to update the categorized renderer of layers in QGIS

In QGIS the empty layer "Symbology" has a categorized renderer that defines a color for each country. I want it to act as a global categorized renderer for several hundreds of layers and so ...
August2323's user avatar
0 votes
1 answer
67 views

Large in-memory raster calculations in PyQGIS

My workflow in a nutshell: I create cost rasters from starting points along a street network (grass7:r.cost), reclassify them according to their distance values (gdal:rastercalculator) and would like ...
RavenS's user avatar
  • 69
1 vote
1 answer
54 views

Custom Python Script Runs Automatically in QGIS Startup Instead of Appearing in Processing Toolbox

I'm working with QGIS 3.34.11-Prizren and have a Python script that I want to use within the Processing Toolbox. My goal is to incorporate it into a model in the Model Designer. However, I am facing ...
Miguel Madeira's user avatar
1 vote
2 answers
70 views

Completely removing layer from QGIS (to delete it)

I have this code below which works well, creating an intersection layer. But if it works the first time, at the second time it blocks, because the intersection layer is locked by QGIS (but I remove it ...
Georgie's user avatar
  • 21
0 votes
1 answer
31 views

Migrate projects and information from QGIS 2.x to QGIS 3.x [closed]

How can I migrate projects and information from QGIS 2.x to QGIS 3.x? I can't find much documentation about it, it is from the QGIS version 2.18 to the current 3.34 What things must be taken into ...
Michelle Angelo's user avatar
0 votes
1 answer
44 views

QGIS Set Project Colors via Python

since we try to automate QGIS related project settings, I am currently struggling with setting project colors in the project properties usinq PyQGIS. I managed to retrieve any existing color scheme: ...
UngerFGIS1985's user avatar

1
2 3 4 5
158