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.
UPDATE for QGIS 3.20: Please use qgis.bat located in C:\OSGeo4W\bin as qgis-bin-g7.exe is missing in the latest version.
It can be done in one step in QGIS in the raster calculator.
In QGIS3, for a raster layer named "x", use the following expression:
(("x">0)*"x") / (("x">0)*1 + ("x"<=0)*0)
This trick maps raster values x>0 into the ratio x/1 = x, and raster values x<=0 into the ratio 0/0 = NaN. This NaN is rendered as FLOAT_MIN (aka -3.402832...e+38) if the ...
Interesting question! It's something I've wanted to try myself, so gave it a go.
You can do this in PostGRES/POSTGIS with a function which generates a set of polygons.
In my case, I have a table with one feature (a MULTILINESTRING) which represents a railway line. It needs to use a CRS in meters, I'm using osgb (27700). I've done 4km x 2km 'pages'.
According to Diego Alonso's comments from the mappingGIS blog1, this error is related to QGIS version 2.14. With the upgrade, the standalone installer eliminated the msys folder from GRASS 7 algorithms.
To bypass this error, go to Processing -> Options -> Provider and deactivate all GRASS folders from previous versions. Set these paths as blanks. Then, ...
In QGIS Raster Calculator, the comparison return 0 (if false) or 1 (if true). So you can write a conditional using a sum of products.
((raster1@1 >0.3) * raster1@1 * raster2@1 ) + ((raster1@1 <=0.3) * raster1@1 * raster3@1 )
Here is a quick worked example of setting the GRASS environment, reading an on-disk raster, calculating a focal mean (using r.neighbors) and reading the results back into R. Hopefully this will get you started.
if (!require(rgrass7)) stop("rgrass7 PACKAGE MISSING")
setwd("D:/TMP") # Working directory
# Set on-disk raster variable
rname <- paste(getwd(...
My solution, based on the one from @wwnick reads the raster dimensions from the file itself, and covers the whole image by making the edge tiles smaller if needed:
import os, sys
from osgeo import gdal
dset = gdal.Open(sys.argv)
width = dset.RasterXSize
height = dset.RasterYSize
print width, 'x', height
tilesize = 5000
for i in range(0, width, ...
The answer will depend on the requirements of your specific workflow and application but I can offer you advise on how a drainage network is generally extracted from a digital elevation model (DEM). The key to extracting a drainage network from a DEM is creating a flow accumulation raster, i.e. a raster for which each grid cell contains a value that is ...
@Steven Kays's answer in PyQGIS.
Just select the lines in your layer before running the script.
The script does not support the linemerging so it can not work on layer with multilinestring
# coding: utf-8
from qgis.core import (...
The idea is to merge all your shapefiles containing linestrings. You have to handle with unique identifiers that are characterizing your linestrings definitely, according to the distinct shapefiles.
Add the unique IDs to the attribute table of each shapefile if required: Open the attribute table, toggle editing and add a new column. Fill the ...
Tom Patterson, the lead cartographer at the U.S. National Parks Service has some excellent tutorials on working with DEM data to make beautiful shaded reliefs. Part of his workflow involves using Natural Scene Designer and Adobe Photoshop.
For my own workflow I like to use GDAL to resample the size of the DEM before rendering a shaded relief. This often ...
There is differents solutions. And this can work with simple polyline and multiple selected entities
select orientation for generation and read index (left-to-right, north-to-south...)
set object size
shape = (4000,8000) # (<width>,<length>)
define superposition coef (10% by default ?)
Ordering polyline (...
What is not mentioned, yet:
QGIS and GRASS GIS - both can be run as a completely separate software
However, GRASS GIS algorithms are included in QGIS processing toolbox (can be excluded or included during the installation of QGIS software). Thus, GRASS algorithms (similarly as GDAL, SAGA, R scripts, or other activated providers) can be used directly from ...
If you want to develop a module for GRASS GIS as a Python script or just a script which uses GRASS GIS (which is, in fact, almost the same), start with http://grasswiki.osgeo.org/wiki/GRASS_and_Python.
You need to be in GRASS session and start a Python script from there, then you can import
from grass.script import core as gcore
which enables you to call ...
Many thanks to Dominik. My first answer is not correct for QGIS 2.8.3 (the expression "myraster@1" > 0 returns 0 or 1 for non-nodata input, for nodata input it returns nodata).
The following QGIS Raster Calculator expression should be sufficient
(raster layer named "myraster"), since the QGIS Raster Calculator
sets all pixels that do not satisfy the ...
I finally got a workaround for the problem, based on Micha's suggestion (thank you!) to import the raster to GRASS and vectorize it there.
1 Import Raster:
r.in.gdal input=raster.tif output=raster
2 Vectorize (option -s leads to slightly smoothed 45-degree edges):
r.to.vect -s input=raster output=vector_blue feature=area
3 Generalize with Douglas to ...
I develop a free and open-source GIS called Whitebox Geospatial Analysis Tools (can be downloaded here) that has extensive analysis functionality for processing LiDAR data. Whitebox contains a tool specifically for calculating the point-density of LiDAR LAS files called Point Density LiDAR.
The tool is highly specific to LiDAR, taking one or more LAS files ...
In spatial hydrology, DEM-based flow accumulation operations are typically static. That is, they represent a steady-state condition of the discharge of surface and near surface water passing through a point. Flow accumulation grids are actually accumulating contributing area downslope, i.e. areas not volumes. The accumulated cells that you described is ...
I get the same error with the Ubuntugis version of QGIS and GRASS version 7.2.0.
It seems that 7.2 is not yet correctly adopted in processing. There is already a ticket for it: https://hub.qgis.org/issues/16019 and https://lists.osgeo.org/pipermail/qgis-developer/2017-January/046671.html
As a workaround, you may edit (as sudo) /usr/share/qgis/python/...
You need to adjust the "threshold" parameter, which is Minimum flow accumulation for streams in the Processing GUI. With this parameter you determine what is the minimum drainage area for each stream reach. THe units are pixels. So in the above image, with Minimum flow accumulation=1 you will be creating a very dense stream network, where each and every ...
Ok, this is slightly embarrassing but I'll post the answer here anyway in case someone is as blind as I was. Apparently, there are two QGIS executable files: C:\OSGeo4W64\bin\qgis-bin.exe and C:\OSGeo4W64\bin\qgis-bin-g7.4.1.exe. In Windows, when firing up a program via the Windwos startup button, it runs qgis-bin.exe by default and GRASS does not work. When ...
For the record - You can now do this easily with QGIS alone (since later QGIS versions): first use 'explode lines' tool, yielding all line segments, then calculate azimuth with field calculator:
degrees(azimuth( start_point($geometry), end_point($geometry)) )
The current version of QGIS (QGIS 3.0+) has the option to Force segments to be exactly of a given length, except for the last one using v.split. v.split is accessed from the Processing Toolbox under GRASS --> Vector