Hot answers tagged

42

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


36

I didn't find a one-tool solution, but you can first use raster calculator to turn all values below a certain threshold to zero and then use gdal_translate with -a_nodata 0 to turn the 0 into nodata.


29

First you need to project your geographic coordinates to a cartesian 2D coordinate system, since affine transformations don't apply to geographic coordinate systems. You can apply an affine transformation from control points or from transformation parameters. The QGIS plugin asks you transformation parameters, but it is much more common for a user to have ...


29

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 ...


29

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'. Here, ...


23

GRASS is usually used for scientific purposes. So unless you want to do some sophisticated spatial analysis or routine, just stick with QGIS. Also GRASS works with its own formats so you will have to import/export data to exchange data with someone. Even if you will need sophisticated spatial analysis or routine at some point you will be able to do it with ...


20

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, ...


18

Yes, in GRASS you can edit raster cells graphically with d.rast.edit.


17

Here's the GRASS mapcalc expressions to set a range to NULL: r.mapcalc "dem_corrected = if(dem<=0, null(), dem)"


17

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 )


16

They have a major difference on how they deal with vectors and this is very important: GRASS has full/real topology support, that means that a single boundary can share several areas . QGIS is primarily non-topological or "spaghetti" , adjacent area boundaries are duplicated. And they relate in the way that Qgis can display and edit GRASS vectors through ...


15

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[1]) width = dset.RasterXSize height = dset.RasterYSize print width, 'x', height tilesize = 5000 for i in range(0, width, ...


15

There is no direct route to convert an image into a shapefile format. Your jpg map has no spatial reference. You can load it into arcmap but it won't know where to put it. In order to tell arcmap where it belongs in space you have to provide geographic reference points, hence the term 'georeferencing'. In ArcGIS this is done via the Georeferencing ...


15

The Processing framework in QGIS can call these function directly from Python. From the QGIS Python console: >>>import processing >>>outputs_0=Processing.runalg("saga:ordinarykriging", vectorlayer_pointtable, z, True, 0, 0, True, 100, True, 0.0, 10.0, 100.0, 1.0, 0.1, 1, 0.5, 1000.0, 4, 20, 1.0, True, None, None, None) >>>...


14

Sure, have for instance a look at the r.neighbors tool available through the processing-toolbox with GRASS support enabled. It has a similar functionality as the Focal Statistics tool. I will also soon add a generic filter function to my QGIS plugin LecoS (needs installed Scipy), which can do the same stuff, but uses python+scipy as backbone.


14

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(...


13

With PyQGIS in the Python console, see How to add Direction and Distance to attribute table? for the azimuths of the segments of a line (with the azimuth functions of Points: point1.azimuth(point2)) but you can use many other Python modules like Shapely and Fiona without using QGIS see Python: traitement des couches vectorielles dans une perspective ...


13

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 ...


13

Steven Kays 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 #!python # coding: utf-8 # https://gis.stackexchange.com/questions/173127/generating-equal-sized-polygons-along-line-with-pyqgis from qgis.core import QgsMapLayerRegistry, ...


12

yes, r.reclass is for reclassing thematic rasters, like the Corine Land Cover. It will work for your data, but the routine will cast the float numbers to integers before doing the reclass, so it might lead to unexpected results. What you are looking for is r.recode The rules are defined in many formats, one of those is the following: old_low:old_high:...


12

You can also save the layer (right click, save as ...) and specify a nodata range. This will keep the original nodata and create new nodatas for the specified range of values.


12

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. QGIS approach: 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 ...


12

There is differents solutions. And this can work with simple polyline and multiple selected entities block diagram: Parameters 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 ?) init Ordering polyline (...


11

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 ...


11

I hesitate to mention this because markusN's answer is so good. But if you don't get on with GRASS and if your DEM is not too large you could try the following. Firstly, note the coordinates for the pixels that you wish to edit. Then explode the DEM to xyz triplets using gdal2xyz: gdal2xyz.py input_dem.tif output.csv 'output.csv' will be a space delimited ...


11

To simplify the raster it might be worth looking at gdal_sieve, it's available under the "Raster" menu. See: http://www.gdal.org/gdal_sieve.html N.


11

You could start by getting the difference of the two DEMs. QGIS has a raster calculator tool that should come in handy. Just get tiles of both DEMs that cover the same area and subtract the values of one DEM from the other. That should get you a nice raster layer that shows the differences in elevation between the two DEMs.


11

I had to do this just recently. Using ArcGIS 10: If you only want to symbolise the dead ends you can just set up a Topology on the roads featureclass and set the rule "Must not have dangles". this will put a marker on every feature that has a dead end. Alternatively, run the "Feature Vertices to Points" Tool (Located in Data Management Tools --> Features) ...


11

A general way of solving this problem is to find all polylines having a node whose valence = 1. A valence table may be created either in memory or on disk, using a key that is the hash of the x&y of each end point of each polyline. You may wish to truncate x and y may be truncated if polylines are not snapped. Each node is labeled by its degree (or ...


11

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 ...


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