Hot answers tagged

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,336
48 votes
Accepted

What is OSGeo4W?

OSGeo: OSGeo is an umbrella organisation (Foundation) that supports many Open Source GIS Projects. Some of the more well known ones are: QGIS, GeoServer, and OpenLayers. Being part of OSGeo gives a ...
HeikkiVesanto's user avatar
37 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,338
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
  • 64.9k
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,069
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
  • 64.9k
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
9 votes

What is OSGeo4W?

Look at the OSGeo: Open Source Geospatial Foundation site. You will see that they support Desktop applications (GRASS GIS, QGIS,...), Web Mapping projects (OpenLayers, GeoServer,MapServer ...), ...
gene's user avatar
  • 54.4k
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.5k
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
  • 351
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,798
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
  • 4,963
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,642
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,373
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,031
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
  • 612
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
  • 29.7k
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
  • 64.9k
5 votes
Accepted

Loading WMS with PyQGIS

Apparently it needs a styles& in the URL, even when there is no style defined. As the document OpenGIS Web Map Service (WMS) Implementation Specification states on www.opengeospatial.org in ...
Matthieu's user avatar
  • 392
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.8k
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
  • 63.2k
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
  • 29.3k

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