Hot answers tagged

5

A new QGIS plugin called Geo Simplification that contains a processing script named Reduce Bend is available in the official QGIS plugin repository. It is an implementation of the Wang-Muller algorithm, the same algorithm used by the ESRI Bend simplify. It can simplify lines but also polygons while preserving topology within and between features of the ...


5

The module r.univar can take a comma separated list of rasters as input, and calculates stats on the whole list. Does that help? MAPLIST=`g.list rast pattern="rast*" separator=comma` g.region -p $MAPLIST r.univar input=${MAPLIST} percentile=90


4

First, to clarify, the window size in r.neighbors is the width of the window (length measure) in pixels, but you request an area measure in hectares. If you mean a window width size such that the window covers 700 ha, then we can do some quick arithmetic: Each pixel in your raster is 625 mq.meters. If we choose a window of 106, then the window will cover: (...


4

I dont know why your attempt does not work. But you should be able to fix it with a more manual approach: Fix the holes: Dissolve Delete holes Difference with your start layer as input layer, and dissolved layer as overlay. Now you have the holes as small polygons Merge these with the input layer Select them by area and Eliminate Self intersections: Union ...


3

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8c in position 113: character maps to I have had problems with GRASS with a non ASCII charachter (like ö) in the path. Try changing it.


3

To use GRASS modules from within R, first you need to install GRASS in your system. The 2nd step is to have the GRASS extensions installed from GRASS GUI interface or commandline. The GRASS add-ons that openSTARS going to use does not come pre-installed with GRASS. So you need to install it from the following menu inside GRASS: The above step will open ...


3

Generally speaking, the way to extract substrings using Python is best done using a regular expression, by importing the re module. If your coordinates always have a '1N' at the start, you can skip those characters and capture the rest using a combination of a positive lookbehind and a capturing group. The simplest form of that pattern would be: (?<=1N)(.*...


3

You should be able to use the max= parameter to i.histo.match to retain the full range of values with input rasters like S2 that use 15 bit DN, without any rescaling. I checked two S2 images (band 8 for two dates), using r.univar and found the max values about 16,000. So I ran: micha@RMS:Western Negev$ i.histo.match input=`g.list rast sep=comma pat=b08*` max=...


3

What the problem was: duplicate points After inspecting your data, I could identify the problem: you have a lot of duplicate points as well as a few points that are "almost" duplicates (extremely close to each other). From originally 954 features in the point layer you provided, only 229 (ca. 24%) are really unique points (thus not duplicates or ...


3

I do not have 3.22 installed yet, so not tested in that version. I have tested this with 3.20.3 installed with the new OSGeo4W installer. If it doesn't work for you I will delete this answer. Tested workflow is: Save the following batch file (e.g. pyqgis_grass78.bat): @echo off SET OSGEO4W_ROOT=C:\OSGeo4W call "%OSGEO4W_ROOT%"\bin\o4w_env.bat call &...


3

Here is how GRASS should be imported (because of a bug it does not work, see more here, thanks Andrea Giudiceandrea): import sys import qgis.core OSGeo_folder = r'C:\OSGeo4W' sys.path.append(fr'{OSGeo_folder}\apps\qgis\python\plugins') import processing from grassprovider.Grass7AlgorithmProvider import Grass7AlgorithmProvider processing.core.Processing....


3

It is all about definitions. If you assume that your peak is any cell, that is higher than 8 of its neighbors, you'll pick any tiny bump in your terrain: However if definition is any cell that is highest for neighborhood square 101*101, you'll get this: To locate mountain passes you'll need to isolate ridges first. Picture below shows divides between ...


2

And now it is even easier than Kay's answer -first use 'explode lines' tool, yielding all line segments, then calculate azimuth with field calculator: main_angle($geometry)


2

QGIS 3.20 has a built-in Vector Geometry tool called the "Split Lines by Maximum Length" which splits a line into multiple parts where each part is of a specified maximum length. Takes a line (or curve) layer and splits each feature into multiple parts, where each part is of a specified maximum length. Z and M values at the start and end of the ...


2

You can also calculate the length of a line taking into account the topography the following way: Use the "Profiles from line" (SAGA) tool, which adds points along the line, giving the length from the line start to each point ("DIST" as the length on a flat surface, "DIST_SURF" with heights included). Select the point with the ...


2

GRASS modules and any of its functionality cannot be accessed without accessing a proper GRASS environment. Using GRASS (or any of its modules) without starting it explicitly can be done in mainly 3 ways: In a standalone python script In bash or windows command line (your case) In a standalone R script The beauty of accessing GRASS in these ways is you can ...


2

As @Vince pointed out, the GRASS module r.viewshed (man page) will achieve what you want. You'll need to first "burn" the wall into your DEM. Then set the coordinates= parameter to the location of the light, and use the -b parameter so that the output raster will have 1 or 0 for visible/invisible (i.e. lighted/dark).


2

Micha's answer is right. If instead you do a for loop with r.univar, you get the same result than with t.rast.univar which is a wrapper for r.univar for all the maps within a time series.


2

Unless your terrain is very/extremely(?) mountainous you are not going to have many slopes > 60 degrees, so maybe almost all your slopes are 0-60? Try: Slope Raster calculator on your slope. I calculate slopes <=30 to 1. Steeper slopes gets value 0. Style the output using "Paletted/Unique values and add only the value 1:


2

If I understand, your Lines.shp is in Longitude/Latitude WGS84, so units are degrees. The threshold you chose, 0.03, is about 3 kilometers. The gap between the lines, that you showed in the screen shot, is less than 3 centimeters. So nothing to snap... I suggest to reproject the Lines.shp to a new shapefile (or preferably geopackage) in UTM, then choose a ...


2

I think that you're missing the "SG=" parameter to initGRASS. GRASS GIS is very particular about coordinate reference systems. Since you are creating a "one-off" Location/Mapset with the initGRASS command, you must set its coordinate system, using the SG param. It might make more sense to prepare the GRASS location and mapset in advance, ...


2

You can use postgis to measure each points distance to all others. select avg(st_distancesphere(t1.geom, t2.geom)) from pointswgs84 t1 cross join pointswgs84 t2 where t1.id>t2.id You can use psql command to execute: psql -U postgres -d testdb -c "select avg(st_distancesphere(t1.geom, t2.geom)) from pointswgs84 t1 cross join pointswgs84 t2 where t1....


2

Here's an outline: nc = nrow(coords) overlap = rep(NA, nc) # make a vector to store the results for(i in 1:nc){ view_i = viewshed(dem, coords[i,]) # optional: uncomment to save raster to an R RDS file: # saveRDS(view_i, paste0("view_",i,".rds")) overlap[i] = can_see(view_i, street_view) } Now you need to write viewshed and ...


2

After a very frustrating afternoon with a colleague, we figured it out. The reason it had always worked before this is because all my code was previously configured to work on a local Postgres instance. (i.e. on localhost). My explanation here is based on what appears to have happened, I am not an expert on the inner workings on GRASS and my brain feels like ...


1

For r.in.lidar, you need to have the Liblas library installed (before creating the Mac binary package of GRASS GIS). But Liblas is rather outdated. As an alternative, you may install PDAL and then the addon r.in.pdal (https://grass.osgeo.org/grass7/manuals/addons/r.in.pdal.html) which relies on it.


1

The problem was identified in this thread at the GRASS mail list. The manual page for the v.surf.idw module states the following: **column**=name Name of attribute column with values to interpolate If not given and input is 2D vector map then category values are used. If input is 3D vector map then z-coordinates are used. The points ...


1

In response to your comment, "setting" the projection is almost always the wrong thing to do. If you need to use a different projection then in nearly all cases (I'd say 99.9% of the time :-) ) you must do a transform. But before addressing the coordinate system, I think your problem is with the original habitats shapefile. In the output message ...


1

thanks for your response! So, I just resolved it finally by searching for and deleting all traces of the previous install attempts. It was originally the "standalone" installer, 3.16 with Grass 7, version 2.0; Mac, Catalina 10.15.7. After erasing/uninstalling everything I could find from previous install attempts; I again installed the newest ...


1

It appears, according to https://github.com/OSGeo/grass/issues/1262 that the problem has been fixed in GRASS GIS 7.8.5, available from https://grass.osgeo.org/download/


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