Questions tagged [standalone]

able to operate independently of other hardware or software.

Filter by
Sorted by
Tagged with
1 vote
1 answer
34 views

Selecting Features By Rectangle in PyQGIS standalone

I want to select features by a rectangle in QGIS standalone using Python but the function iface.actionSelectRectangle().trigger() is not available in a standalone application. How to code iface....
user avatar
0 votes
1 answer
17 views

'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&...
user avatar
0 votes
1 answer
55 views

OGR error "is not a directory" when moving to Windows from UNIX

I have to write a script that works either on Windows or macOS. I want to run these lines : processing.run('native:refactorfields',{ 'FIELDS_MAPPING' : [{'expression': '"Name"','length': 10,'...
user avatar
  • 115
1 vote
1 answer
34 views

PyQGIS standalone app processing with selectbylocation not working

I'm trying to run processing with selectbylocation in standalone app, everything seems to run fine but the output I'm getting is the main layer always, so it's not really working. And I have no idea ...
user avatar
  • 133
1 vote
1 answer
38 views

Solve "ERROR: Too many connections: max 64 while"

I would like to apply zonalstatisticsfb to 30 raster file on 3 different areas each time. I guess Python have to loop 90 times. This is the code I am using : def extract_stats(a,b,c): import ...
user avatar
  • 115
0 votes
1 answer
72 views

How to solve 'Warning 1: Field of width 255 truncated to 254.'

I get this warning message Warning 1: Field Date of width 255 truncated to 254. when I run this code : # Prepare the environment import sys import os from qgis.core import * from PyQt5.QtWidgets ...
user avatar
  • 115
2 votes
1 answer
39 views

Running PyQGIS without using the GUI

I found this topic and it is exactly what I want to do. As @casta2k in 2015 I am running MacOS. So I follow the step and that is what I get : >>> import sys >>> import os >>>...
user avatar
  • 115
0 votes
0 answers
33 views

Read CSV file with x/y to shapefile in standalone PyQGIS Script

I have read quite a few Q&As on this topic so far but still I have problems with correct import CSV file. I'm working in PyCharm and trying write function which will read CSV and save as vector ...
user avatar
0 votes
0 answers
21 views

Standalone PyQGIS script set layer in AddFeature mode for user

I have written a script in the Python console and would like to bring in a standalone script. In the end I put the layer with i.face in edit mode and AddFeature, because the user should only set ...
user avatar
  • 159
2 votes
2 answers
368 views

Looking for manual on how to properly setup standalone PyQGIS without GUI

My goal is to create a standalone PyQGIS script that is able to run QgsProcessingAlgorithm scripts without GUI. My setup runs on Windows and my IDE of choice is VS Code. I've followed the Windows ...
user avatar
  • 425
2 votes
2 answers
329 views

PyQGIS outside GUI: module 'qgis.processing' has no attribute 'run'

When trying to use processing.run() from a standalone (no GUI) mode, I get the following error: module 'qgis.processing' has no attribute 'run' in the following trivial example: from qgis import ...
user avatar
  • 425
1 vote
1 answer
48 views

PyQGIS custom application: no GUI appearing

I'm following the following instructions on getting Python to work with QGIS, outside the QGIS GUI itself: Using PyQGIS in custom applications. But for some reason the GUI is not appearing, yet the ...
user avatar
  • 425
5 votes
2 answers
127 views

Running the GRASS algorithm in standalone Python code using the PyQGIS processing module

What is the right way to import GRASS algorithms for a standalone Python script? I tried the solutions (solution1, solution2), but they didn't help me. Here's the code that doesn't import GRASS ...
user avatar
  • 5,642
0 votes
0 answers
29 views

GPX track appears scaled down and in center of world using standalone PyQGIS

I'm trying to load a GPX-track as a layer in PyQGIS (standalone) but the track appears entirely on the wrong scale and position (scaled down in the middle of the equator). When I load the file ...
user avatar
  • 1
0 votes
0 answers
34 views

Why basemap appears blank in Standalone PyQGIS on Linux?

The script below processes Geotagged photos generates a shapefile of locations, plots them on a base map, exports the output to a png/jpg image. It is working fine within the QGIS environment or as a ...
user avatar
  • 1,222
0 votes
1 answer
101 views

Connecting PostgreSQL/PostGIS registry in qgis.core.QgsProviderRegistry

I'm developing a standalone QGIS based Python script for loading layers from/to PostgreSQL/PostGIS database. If I check the list using code: providers = QgsProviderRegistry.instance().providerList() ...
user avatar
1 vote
0 answers
52 views

Generating standalone file with QGIS

I need to share a project including all feature including images, styles and print settings. The user that receive this project should be able to print a paper like the .pdf I generate from my PC. I ...
user avatar
  • 1,299
5 votes
1 answer
135 views

QGIS Stand alone python script terminating problem

I want to write Python standalone QGIS script to layout export and my code is as follows: import os from qgis.core import ( QgsVectorLayer,QgsProject, QgsWkbTypes,QgsVectorLayerExporter,...
user avatar
2 votes
2 answers
343 views

Does QGIS still support standalone PyQGIS application development (outside of QGIS program)?

We have developed a few PyQGIS standalone applications that bring in PyQt5.Qtcore, PyQt5.QtGui, and qgis.core to display map and do custom logics etc. The applications started with QGIS python 2.7 all ...
user avatar
  • 1,077
2 votes
1 answer
127 views

Loading WMS layer into QGIS Project through Python standalone script

I can load WMS layers by coding on QGIS Python console, those are the codelines: # Google Satelite URL wms url = 'type=xyz&url=http%3A//mt1.google.com/vt/lyrs%3Dy%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%...
user avatar
2 votes
1 answer
305 views

Using custom Processing algorithm from standalone PyQGIS scripts (outside of GUI)

How can I run a custom algorithm using processing.run ? I've extended a QgsProcessingAlgorithm following qgis docs. I've managed to run a native algorithm in a standalone PyQGIS script following Using ...
user avatar
  • 123
1 vote
1 answer
97 views

Adding Layers panel to standalone/custom PyQGIS application [duplicate]

Is there an option for adding a "Layers" panel to a custom/standalone PyQGIS application (like the one available in QGIS) or do I need to construct my own using something along the lines of ...
user avatar
2 votes
1 answer
272 views

Loading QGIS project file with standalone PyQGIS Script

I've been working on a standalone PyQGIS script that loads a QGIS project file and opens it on the main canvas. I've written the script directly based on the PyQGIS Developer Cookbook here: https://...
user avatar
1 vote
1 answer
73 views

Invalid PostgreSQL layer after loading it with PyQGIS [duplicate]

In a standalone PyQGIS script, I try to load a PostgreSQL (PostGIS) layer with the following code (see below). The layer is always invalid, however when entering the code directly into the Python ...
user avatar
  • 21
0 votes
0 answers
84 views

Enter credentials in standalone PyQGIS script

I'm developing standalone script using PyQGIS. I would like to access to layers in QGIS project but IDE returns an error. from qgis.core import * from qgis.core import QgsApplication from qgis.core ...
user avatar
1 vote
1 answer
91 views

Creating features from existing point layer in Standalone PyQGIS script

I am trying to add a feature into an existing layer in my SQLite database. The script below is working: layers = QgsProject.instance().mapLayersByName('msm_LoadPoint') layer = QgsVectorLayer(layers[0]....
user avatar
  • 31
2 votes
3 answers
196 views

"native:setlayerstyle" algorithm is not running in standalone script

I interpolate and crop the temperature data with PyQGIS (QGIS 3.18). There is no problem so far, but I can not set style file. What can I do set style file correctly? OS: Win10 import os, sys os....
user avatar
  • 39
3 votes
2 answers
149 views

How to change default shown layer of QGIS project in standalone Python app?

I'm developping a Python standalone app that needs a dynamic map (with the zoom and pan tools). I chose to use PyQGIS that allows me to work with QGIS projects. I managed to create a class that takes ...
user avatar
0 votes
0 answers
107 views

How to import QuickOSM processing algorithms into standalone python script

I'm working on a standalone application that imports OSM data into its mapCanvas. It works in QGIS but not in the standalone script. I get algorithm not found when I run the help function. processing....
user avatar
  • 71
0 votes
0 answers
48 views

Change layer data source from QGIS TOC in standalone PyQGIS script

I'm trying to write standalone PyQGIS script and was trying to find how to change layer source listed in QGIS TOC (table of content). Right now i'm working with shapefiles. Below you can find my draft ...
user avatar
1 vote
0 answers
133 views

Problem on running a sample code of QGIS3 C++ API

I have written a code using QGIS 3 C++ API. But there are runtime errors. My environment is: Windows 10 64bit Qt 5.15.1(MSVC 2019) Qt Creator 4.13.1 QGIS 3.x.x using osgeo4w-setup-x86_64.exe, and ...
user avatar
4 votes
1 answer
1k views

Error "No module named PyQt5.QtCore" in QGIS standalone application

import os, sys sys.path.append(r'C:\Program Files\QGIS 3.6\apps\qgis\python') sys.path.append(r'C:\Program Files\QGIS 3.6\apps\qgis\bin') sys.path.append(r'C:\Program Files\QGIS 3.6\apps\Python37') ...
user avatar
1 vote
0 answers
47 views

Setting the CRS of Raster in standalone PyGQIS

I'm generating raster files without a CRS and would like to assign one. I am attempting to use GDAL's assign projection, which works perfectly inside QGIS, but seems to have no effect when run in my ...
user avatar
  • 93
1 vote
1 answer
108 views

Running 'r.null' processing algorithm in Standalone Python script on Windows

I want to run this code outside QGIS as a standalone Python script. import os import processing os.chdir('C:/Users/User/test/25') alg_params = { '-c' : False, '-f' : False, '-i' : False, ...
user avatar
5 votes
0 answers
463 views

Using PyQGIS functions outside QGIS

I want to use PyQGIS function crs.isValid() in normal Python file outside of QGIS like this: wkt = 'GEOGCS["WGS84", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298....
user avatar
  • 1,385
0 votes
1 answer
151 views

QGIS: How to modify the selection style when selecting features in a standalone script

It's quite easy to modify the default style that QGIS applies when selecting attributes in the GUI by following the steps in this question: QGIS: How to modify the appearence of selected attributes ...
user avatar
  • 300
6 votes
1 answer
5k views

Making a Feature Form for a standalone PyQGIS application as in QGIS

In QGIS, there is a method named openFeatureForm defined in QgisInterface class. It opens a form that shows value of attributes for a given feature. layer = iface.activeLayer() feature = layer....
user avatar
2 votes
1 answer
127 views

openFeatureForm in PyQGIS Standalone Application

I am trying to implement a desktop application with PyQGIS 3. When I try to use openFeatureForm to display the data of the selected layer object it shows an error, however when I use this code in the ...
user avatar
4 votes
1 answer
134 views

Adding column with area values in attributes table with standalone PyQGIS

I would like to add an area column to the Attributes table using Python. I prefer not to use QGIS Python console. I would like to do that using cmd. How should I change my code? My code and error ...
user avatar
2 votes
1 answer
189 views

No output in Python console when using PyQGIS

When I run my code in QGIS Python console I get output, but when I run my code from normal console I didn't get any output. Why does it work only in QGIS Python console? import sys, os sys.path....
user avatar
0 votes
0 answers
74 views

WFS layer invalid in standalone python script

I have a project in 3.10.11 (ltr) loading a layer from a Geoscience Australia WFS. https://services.ga.gov.au/site_1/services/Geomorphology_Scale_Guide_WM/MapServer/WFSServer?request=GetCapabilities&...
user avatar
3 votes
2 answers
226 views

Algorithm qgis:joinattributesbylocation not found

I would like to join attributes by location using standalone PyQGIS but I'm getting error. I have QGIS 3.16 installed on my machine. from qgis.core import * QgsApplication.setPrefixPath("C:/...
user avatar
1 vote
0 answers
42 views

Importing processing from QGIS into IDLE

I have been trying to make a program that creates a virtual raster based on the files that are input. Whenever I run my code it says. Traceback (most recent call last): File "C:/Users/Zach/...
user avatar
  • 21
1 vote
1 answer
136 views

Check if polygon intersects with coordinates in a .csv file with PyQGIS standalone script

I have a bunch of .csv files with coordinates and a polygon. In my standalone script I would like to check if the polygon intersects with the coordinates. So, when I write: for feature in ...
user avatar
  • 2,287
2 votes
0 answers
73 views

PyQGIS Standalone QVectorLayer works and QRasterLayer not work without QgsApplication / initQgis()

I'm trying to make a standalone python app and I want to use in some parts of app functions of PyQGIS. I'm testing things to understand how it works. Doing tests I have found a situation that I do ...
user avatar
  • 622
7 votes
1 answer
1k views

Difference between iface.mapCanvas and QgsMapCanvas

I am working on standalone pyqgis script and I wanted to set project extent to position on imported layer. First I tried with: vlayer = QgsVectorLayer("data/layers/layer1.gpkg", "layer_name", "ogr") ...
user avatar
  • 701
1 vote
1 answer
160 views

QGIS standalone application in python can't access 3d:tessellate processing tool

I'm developing a standalone QGIS application and I want to run the tessellate (3d:tessellate) processing tool using the following code:  import processing from qgis.analysis import ...
user avatar
  • 573
0 votes
1 answer
307 views

Extract by location works improperly in PyQGIS standalone script

I have been trying to extract polygons from one layer that intersect a polygon in another layer, and another extract that is disjointed, and looping this over several files organized by date. When ...
user avatar
1 vote
1 answer
111 views

pyqgis: Get the Click on canvas standalone app

I added a subwindow in a MDI area containing a QgsMapCanvas. Defined the clic tool QgsMapToolEmitPoint. But when I click on the canvas there's no response, al least it should print 'clicked'. ¿¿May ...
user avatar
  • 103
2 votes
1 answer
355 views

Errors while importing QGIS 3.10 from standalone Python, but not from QGIS's Python Console

I try to load a QGIS project in standalone Python on Windows 10. This is the code that I use: from qgis.core import * qgs = QgsApplication([], False) QgsApplication.setPrefixPath("C:\Program ...
user avatar
  • 181