Questions tagged [standalone]

able to operate independently of other hardware or software.

Filter by
Sorted by
Tagged with
1
vote
0answers
37 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%...
2
votes
1answer
65 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 ...
2
votes
1answer
46 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 ...
2
votes
1answer
72 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://...
1
vote
1answer
32 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 ...
0
votes
0answers
53 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 ...
1
vote
1answer
62 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]....
2
votes
3answers
76 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....
3
votes
2answers
119 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 ...
0
votes
1answer
48 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....
0
votes
0answers
33 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 ...
1
vote
0answers
66 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 ...
4
votes
1answer
386 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') ...
1
vote
0answers
45 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 ...
1
vote
1answer
69 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, '-n' : ...
0
votes
0answers
49 views

Running QGIS 3.1 Graphical Modeler Script as standalone

I have troubles running a Graphical Modeler Script as standalone via the OSGeo4W Shell console. Everything works fine when I run the script in QGIS. When I open it via shell, nothing happens. I think ...
4
votes
0answers
203 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....
0
votes
1answer
76 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 ...
6
votes
1answer
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....
2
votes
1answer
86 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 ...
4
votes
1answer
109 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 ...
2
votes
1answer
89 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....
0
votes
0answers
49 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&...
3
votes
2answers
134 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:/...
0
votes
0answers
53 views

Scale bar for standalone PyQGIS layout clumped together

I'm trying to implement a scalebar for my layout in a standalone application. This is my current code: def createLayout(Main): layers = Main.canvas.layers() project = QgsProject.instance() ...
1
vote
0answers
36 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/...
0
votes
0answers
121 views

DLL load failed when loading PyQGIS in PyCharm with script (Windows)

I am trying to setup PyCharm to work with PyQGIS. I followed this tutorial: https://silverspringenergy.com/using-pycharm-as-an-ide-for-qgis-3-plugin-development-2/. Some files were located elsewhere ...
2
votes
0answers
60 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 ...
5
votes
1answer
732 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") ...
1
vote
1answer
124 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 ...
0
votes
1answer
188 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 ...
1
vote
1answer
89 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 ...
2
votes
1answer
278 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 ...
0
votes
1answer
128 views

QGIS C++ API doesn't work with ECW files

I'm new with QGIS. After lots of trying I finally executed a successful compile on QGIS libs and used them in my program. In my simple program I just read some layers (vector and raster) and showed ...
2
votes
2answers
275 views

Calling a plugin (quickosm) from a python standalone application?

I am trying to call the QGIS-plugin quickosm from a standalone Python application and I´m not quite sure how to or if this is even possible. My QGIS version is 3.10 (using OSGeo4W64) with the ...
3
votes
1answer
270 views

Standalone QGIS App keeps crashing. Issue with Context or Threads?

I'm trying to setup an application for my company, that generates a PDF file for specific user generated coordinates: The user enters an address into the frontend (Flask generated), which is ...
4
votes
1answer
110 views

Referenced table not found in standalone Python script

I'm trying to run a Python script from OSGeo4W Shell. Im doing this by typing "python-qgis C:\path\test.py" Everything seems to go fine until the script launches the processing module. After that ...
0
votes
1answer
320 views

QGIS Application in C++ [closed]

I'm new to QGIS 2.8 Library to develop standalone map application in qt4, C++ language. I was wondering if there is any way that I can use QGIS plugins such as Advanced viewshed analysis, Contour ...
2
votes
2answers
273 views

Does ArcPy (Standalone) have option like Spatial filter?

I want to get the polyline features intersecting with a polygon geometry and having a particular field values in ArcPy standalone script. There is another link for similar subject but it is not for ...
4
votes
1answer
126 views

Getting list of layers when opening a QGIS project on a standalone app?

I am trying to make a standalone QGIS app to read a .qgs file for rendering an image based on the vectors using LayoutManager. The problem is that when I try to print project.mapLayers() I get an ...
4
votes
2answers
204 views

QgsRasterCalculator fails in standalone Python application

I am trying to write a simple Python program which shall be a wrapper for QgsRasterCalculator() function, to use it in some batch processes. In both QGIS 2.14 (on Linux) and QGIS 3.10 (on Windows 10) ...
4
votes
1answer
294 views

Creating standalone application with same directories and qgis-auth.db

I try to have a standalone QgsApplication (api documentation), but, instead of a lot of code samples found like this one below (I'm on Ubuntu): from qgis.core import QgsApplication QgsApplication....
1
vote
1answer
103 views

Layer failed to load using PyQGIS on macOS Mojave

The following is the code that I wrote with the help of PyQGIS Developer Cookbook from qgis.core import * from qgis.gui import * import os #Reference to QgsApplication qgs = QgsApplication([], False)...
3
votes
1answer
342 views

Standalone Python application from QGIS graphical modeler

I am trying to run the script generated by my graphical modeller through QGIS script. But I get the following error. # Prepare the environment import sys from qgis.core import QgsApplication #from ...
4
votes
2answers
714 views

Running standalone QGIS model script in Python

I am trying run an exported QGIS model as Python script from Anaconda. I followed Executing a standalone QGIS python script on Windows 10, and I get no error of modules, when running this I get no ...
1
vote
1answer
1k views

Algorithm not found by PyQGIS?

I have troubles using PyQgis processing module with QGIS 3.8. For example, I can reproject a layer with QGIS graphic interface, but when using PyQgis processing module through the following script : ...
1
vote
1answer
161 views

Running QGIS script in external Python code gives TypeError?

I have one piece of Python code that I wrote in QGIS 3.6 (I'll call this code1) and I have a second piece of Python code that is a bigger project, which I wrote just in a normal text programme and ...
1
vote
0answers
112 views

Iterating over layers and exporting them as images with PyQGIS

In QGIS I have the layer tree with the following layers: Roads Transition Differences Study_area I would like to iterate over the layers and export two different images where Roads and Differences ...
0
votes
0answers
158 views

Loading .qgs and .qpt files in standalone PyQGIS script?

I have a .qgs and .qpt files. And I would like to know if it is possible to use them in a standalone PyQGIS script? I am using QGIS 2.18 and Python 2.7 This is the template that I would like to use. ...
5
votes
1answer
2k views

Error: Could not load source layer for INPUT

Very simple piece of code. I'm trying to run this as a stand alone Python script, not in the console. Keeps giving the error "Could not load source layer for INPUT", shape not found. But the os.path....