Hot answers tagged

44

In QGIS 2.8.1 there's a tool in the Vector menu that can split a dataset based on an attribute. Look in Vector > Data Management Tools > Split Vector Layer... It's a basic tool that should work if you don't want to resort to plugins or tools in Processing; unless they offer additional functionality you need.


29

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

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


22

I was struggling to do exactly the same thing, but for various reasons I'm committed to using QGIS. I tried using v.rast.stats using the GRASS plugin and also via the Sextante plugin. The latter approach failed, because it seems to attach the stats to a temporary vector layer which it then deletes. The GRASS plugin worked, but it doesn't deal with ...


17

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


16

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


15

Attempt to answer my own question: The cause of striping in the examples I provided are entirely due to my workflow, not any legacy issue with how the data was originally assembled or mosaiced together. The DEMs I was dealing with were all generated from newer techniques, as evidenced by this map: The two methods that cover the areas I was working with ...


14

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

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


13

This is a good question, and one that I tend to get asked from time to time. First, as you've pointed out, the equation for TWI = ln(a / tan(B)), where a is the 'specific' catchment area (i.e. the upslope inflowing area normalized for a measure of contour length) and B is the slope gradient, in radians, at the grid cell. As you correctly pointed out TWI will ...


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


12

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


11

Using QGIS you can quickly divide a given shapefile up into regular rectangles as you've shown in your example. Load the original shapefile; Use Vector|Research Tools|Vector grid and create a grid of polygons the same extent as your shapefile, with the right distance between divisions ('parameters') selected (100 in my example image below); Intersect the ...


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.


10

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


10

Try the following commands from a command line: sudo add-apt-repository ppa:johanvdw/saga-gis sudo apt-get update sudo apt-get install saga The problem may be that synaptic has not updated it sources because the signing key was not imported. This should be the most easy way to fix that error. [update] It seems the wxwidgets package for raring was uploaded ...


10

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


10

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.


9

First, you need to calculate at least the slope. F.ex I have the following data: Then put the correct data as variables to the module: And at last you should get the result: UPDATE With Catchment Area as input the results are:


9

The tool you mentioned in ArcGIS does not snap one layer to another. Rather it snaps the boundaries in a layer to "themselves". So it you have two lines in the same layer that are within a certain threshold, Integrate will snap them together (i.e. move them both to the average distance between them). This action is done in GRASS with the v.edit module, ...


9

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


9

Due to how complex it was to manage multiple versions (and how fast and erraticly the SAGA API changes), it was decided to support a single version. SAGA 2.3 is supposed to be something like an LTR, so API changes are not to be expected. Also, that's the version shipped with OSGEO4W. any more info you can provide about the messages you see about your SAGA ...


8

Use GRASS with the native GUI or with the QGIS plugin or with the Sextante plugin and use the v.generalize tool, choosing the "Chaikens" algorithm.


8

As you would have seen from the referenced GIS SE question, there doesn't appear to be much in the way of viewshed stand-alone packages at least in the Open Source market beyond SAGA and GRASS GIS. Apart from writing a wrapper around the code for these algorthims you may end up implementing viewshed yourself unfortunately. (Though I would love to be ...


8

I got good results with mDenoise. This tool uses the Sun's denoising algorithm which removes noise without filtering sharp edges like ridges or peaks. Good for mountainous areas especially high mountains. You can define the threshold and the number of iterations. You have to try something around to get the best result. Before denoising ASTER GDEM2: After ...


8

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


8

You may check out the 'Trace Downslope Flowpaths' tool in Whitebox GAT. It will identify the cells in a DEM that receive flow from upslope target cells. It is however based on the D8 flow algorithm and therefore cannot model flow dispersion, which would yield downslope 'areas' as you are referring to them as. Nonetheless, there is some debate in the ...


8

I think I see the problem. I could reproduce this, both using your script, and SAGA itself. The output from SAGA matches the output from your script. So it's not RSAGA. But look at the slope output from SAGA... vast areas are near-vertical, with slopes around 1.57 radians (nearly 90 degrees) with some flat areas. You can confirm this looking at the ...


7

You could try to make an overlay of your contour lines with the slope grid, and only show certain contour lines depending on the average value of the slope below that contour line.


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