Skip to main content
66 votes
Accepted

GRASS not working with QGIS says This algorithm cannot be run

If I open QGIS with the shortcut "QGIS Desktop 3.6.0 with GRASS 7.6.0" everything works fine. If I open QGIS with the shortcut "QGIS Desktop 3.6.0" I get the same error as you. ...
Dataform's user avatar
  • 1,346
39 votes

Merging all tiles from one directory using GDAL

You could create a virtual mosaic from all Tiff files: gdalbuildvrt mosaic.vrt c:\data\....\*.tif and convert it afterwards: gdal_translate -of GTiff -co "COMPRESS=JPEG" -co "PHOTOMETRIC=YCBCR" -co ...
christoph's user avatar
  • 5,797
37 votes

Using OSGeo4W shell with Python 3

There's no need to edit batch files (and break python 2.7 in the process) or set environment variables manually. Just run py3_env which sets the shell up for Python 3 automatically, then run python3. ...
user2856's user avatar
  • 66.6k
18 votes
Accepted

Using OSGeo4W shell with Python 3

There is a not well documented command build into OSGeo4W Shell which sets the shell up to python3 as Luke mentions py3_env Basically it sets your PYTHONHOME and the correct PATH. Then you can call ...
bennos's user avatar
  • 2,079
12 votes
Accepted

Convert raster to a CSV values and lat long based on raster value in QGIS

As GDAL supports writing to X,Y,Z (CSV) ascii, you could use gdal_translate: gdal_translate -of xyz -co ADD_HEADER_LINE=YES -co COLUMN_SEPARATOR="," input_raster output.csv To avoid writing NoData ...
user2856's user avatar
  • 66.6k
11 votes
Accepted

Compiling resources.qrc with QGIS 3.20 (could not find qt5_env.bat)

You no longer need to run qt5_env.bat and py3_env.bat (I guess). Just run pyrcc5 -o pathtoplugin\resources.py pathtoplugin\resources.qrc
Kadir Şahbaz's user avatar
11 votes

Install Python library in QGIS as non-administrator

Since you don't have admin privileges, when you install a package using QGIS Python Console/Editor as follows, it is installed to C:\Users\user\AppData\Roaming folder. import subprocess subprocess....
Kadir Şahbaz's user avatar
8 votes

No module named 'osgeo'

Try this, pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
Saroj Rai's user avatar
  • 259
8 votes

How to install OSGeo4W libraries in older version of QGIS (2.16)?

OSGEO4W only offers the current point release, the one before (currently 2.18.3), and the dev and LTR version. For older Windows versions, you can still grab the standalone installer from http://...
AndreJ's user avatar
  • 76.7k
8 votes

Using OSGeo4W shell with Python 3

If you want to make the change permanent you can modify the batch file OSGeo4W.bat located in your QGIS (or OSGEO) directory and just add: call "py3_env" below the line calling call "%~dp0\bin\...
brodegon's user avatar
  • 361
8 votes

GRASS not working with QGIS says This algorithm cannot be run

I had the same problem but I managed to solve it by renaming my grass folder from "grass76" to grass-7.6.0".
Friedemann's user avatar
7 votes

Installing qgis-ltr or qgis-ltr-full with OSGeo4W or both?

qgis-ltr-full is a metapackage. I don't know exactly what packages it selects, but I believe it might select things like qgis-globe-plugin and qgis-grass-plugin in addition to qgis-ltr. You will not ...
Lee Hachadoorian's user avatar
7 votes

QGIS Server sending UPDATE... WHERE NULL to postgis in a WFS layer

Finally, Matthias Kuhn, one of the developers of QGIS gave me the key. The WHERE clause is built checking the type of the primary key of the table. It should be an Integer and in some of my tables I ...
Egidi's user avatar
  • 3,738
7 votes
Accepted

ogr2ogr commands with cmd

To debug the command, it can be helpful to echo it instead of running it, to see if any special characters are throwing things off. From inside a bat file, do: echo ogr2ogr -sql "SELECT * FROM 'D:\...
mikewatt's user avatar
  • 5,093
6 votes

Installing File Geodatabase (*.gdb) support in QGIS

It is nice, in 2019, you do not need do above, it is already supported in qgis 3.6. Simple and easy by 3 steps: Step 1: click the add vector button (red circle) Step 2: select directory, ...
hoogw's user avatar
  • 1,742
6 votes
Accepted

No module named 'osgeo'

This sounds like you have multiple python installations, and GDAL is installed on one and not the other. Try the following (which I have based upon this). Create a text file within your python ...
JimT's user avatar
  • 2,383
6 votes
Accepted

OSGeo4W does not add bin directory to Windows PATH

is not recognized as an internal or external command, operable program or batch file OSGeo4W specifically has closed the ticket to add this to the system path. The DLLS may conflict with other system ...
Evan Carroll's user avatar
  • 7,081
6 votes

How to setup Visual Studio Code (Windows) for PyQGIS 2 or 3?

We didn't want to use a script to open our workspace, so we finally found out how to configure Visual Studio Code through the settings.json file: https://github.com/isogeo/isogeo-plugin-qgis/blob/...
Guts's user avatar
  • 622
6 votes

NumPy array to Raster file (GeoTIFF)

By using a raster with integer values (1, 100) and one equivalent condition (myarray >= 35, myarray <= 7), following code would work as expected: from osgeo import gdal, osr import numpy ds = ...
xunilk's user avatar
  • 30k
6 votes
Accepted

Add FID to attribute table using ogrinfo

I found a simple way to add a rownumber with ogr ogrinfo layer.shp -dialect SQLite -sql "UPDATE layer set ID = rowid+1"
Helga F.'s user avatar
  • 365
6 votes

GRASS not working with QGIS says This algorithm cannot be run

Go to C:\Program Files\QGIS 3.12\apps\grass\grass78\ and copy the "bin" folder directly into C:\Program Files\QGIS 3.12\bin\. Now the GRASS modules are in the specified path C:\Program Files\QGIS 3....
Steffen's user avatar
  • 61
6 votes
Accepted

Why is osgeo4w (w QGIS 3.6.2) asking for admin rights?

The osgeo4w installer requiring admin rights is a long-standing issue. The installer requests admin rights because some features really do need to be installed as admin (they create Windows services, ...
user2856's user avatar
  • 66.6k
5 votes

Convert raster to a CSV values and lat long based on raster value in QGIS

Try this way with GDAL: import os, sys from osgeo import gdal from osgeo import gdalconst # get the arguments InRaster = sys.argv[1] OutCSV = sys.argv[2] # open the raster and get some ...
Michael Stimson's user avatar
5 votes
Accepted

Reading various (non-.shp) vector types using ogrinfo

ogrinfo is meant to be used on single datasets. GDAL's Shapefile driver "treats a whole directory of shapefiles as a dataset, and a single shapefile within that directory as a layer" but that really ...
bugmenot123's user avatar
  • 10.9k
5 votes

Reading various (non-.shp) vector types using ogrinfo

Directory of shapefiles is a special case for GDAL/OGR and it behaves like a datastore with many layers as you have noticed. As far as I know no other driver has similar behavior. You can test all ...
user30184's user avatar
  • 66.4k
5 votes

Using OSGeo4W shell with Python 3

Please make sure that py3_env to initiate the python with OSGEO Shell is not working. The right command is pythonw if you have the current version of QGIS (3.20).
Chandrama Sarker's user avatar
5 votes
Accepted

Export spatial data from SQL Server to ESRI shapefile

If that is the exact command copied from your terminal, you simply need to be more careful with the spelling; there are spaces between quotation marks and the output file string. Try and replace your ...
geozelot's user avatar
  • 30.3k
5 votes

GRASS not working with QGIS says This algorithm cannot be run

Based on this grasswiki-article setting the operating system environment variable GISBASE to the GRASS installation folder might fix the issue (e.g. C:\OSGeo4W\apps\grass\grass76). QGIS 3.8 ...
Nicolo's user avatar
  • 340
5 votes

GRASS not working with QGIS says This algorithm cannot be run

To me, it seems like some environment variables are missing when starting the "normal" qgis. I fixed this in QGIS 3.4.13 by changing qgis-ltr-bin.env and qgis-ltr.bat . In the 3.6, 3.8 (...) version ...
jannik schilling's user avatar
5 votes
Accepted

QGIS - Python Action Error

QGIS uses the Python environment installed by itself. You have to install packages to Python 3.7 installed by QGIS installation. Open OSGeo Shell Run py3_env Run pip install pandas
Kadir Şahbaz's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible