New answers tagged

1

The QGIS 2.6 documentation does not cover the new GRASS 7 plugin. You can create a new mapset from the menu or open an existing one from the browser


0

You answered yourself quickly, but I'd like to add two comments: 1.To do the loop you asked for, I would just replace the shapefile name with a variable, then go thru all shapefile names and run the script with each. For example (based on your first solution above: V=$1 g.region vect=${V} #first set g.region to shapefile j=1997 while [ $j != 2008 ] do ...


0

I found a shortcut way to do this. I rename all my 215 shapefiles as numbers appneded with a text (x1.shp, x2.shp, x3.shp...x215.shp) and imported them in GRASS. Than I used this loop to change my g.region: k=1 while [ $k != 216 ] do g.region vect=x$k j=1997 while [ $j != 2008 ] do .............. #rest of the code here ...


0

I moved an old MYSYS folder and contents from an earlier QGIS install. 7 works now. I think for 6 to work Id have to install it and point to it.


1

Have you used the Advanced Install option in OSGeo4W to make sure msys and GRASS 7 are both installed? I usually run the express install first, then go back into Setup, tick over to Advanced Install, and grab any extra bits and pieces I like to use. My GRASS 7 path is C:\OSGeo4W64\apps\grass\grass-7.0.4 GRASS 7 commands work for me but not GRASS ...


1

r.watershed doesn't require filling depressions, because it uses least cost path for routing. Try -b flag (Flow direction in flat areas is modified to look prettier).


0

Once a python script is running, changes to environment variables are no longer effective. They are set up right before runtime and the interpretor will not update them afterwards. PYTHONPATH can be updated using the method sys.path.append() and that is all. A workaround is to re-execute the script after setting up the environment. This way the interpreter ...


1

GRASS numbers the directions in a drainage (flow direction) raster from 1-8 starting eastward and going counter clock-wise. What about the negative numbers? GRASS uses negative direction to indicate that the flow from this cell is going off the map. But the absolute value still indicates the direction. So both 4 and -4 mean west. Also, GRASS uses 0 to ...


1

I think the solution to what you call "buffer" is to create a MASK raster in GRASS. Then the r.neighbors analysis (and all other raster analyses) will be limited to the area covered by the mask. You would do that in GRASS by converting the polygon to a raster, and naming it MASK: v.to.rast input=<your polygon> output=MASK use=value


5

It is possible if you convert your raster to a vector layer. Quick example, starting from this classification raster: Use Raster > Conversion > Polygonize to convert it to a vector layer: If you want to create points over a whole class (and not over each separate "patch"), use the Vector > Geometry Tools > Singleparts to Multiparts tool. ...


1

The Python version of GRASS GIS is 2.7.x and not 3.x In Python 2.7.11 (Mac OS X) import grass.script.core core.__file__ '/Applications/GRASS-7.0.app/Contents/MacOS/etc/python/grass/script/core.pyc In Python 3.5.1 import grass.script.core Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Applications/GRASS-7....


2

I use this export GISBASE="path_to_your GISBASE" export PYTHONPATH="${PYTHONPATH}:$GISBASE/etc/python/" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GISBASE/lib" export GIS_LOCK=$$ export GISRC="/path_to/.grass7/rc" Then with Python import grass.script.setup as gsetup gisbase = os.environ['GISBASE'] gisdb="path_to_your_GISDBASE" location="Geol" mapset="test"...


0

GRASS expects the LC_ALL environment variable to be set, otherwise it issues this error. As it happens, distributions such as Ubuntu have this environment variable unset by default. So the fix is to set up this variable manually at the beginning of the script, something like: if sys.platform.startswith('linux'): os.environ['LC_ALL'] = "en_GB.UTF-8" ...


0

I just had the same doubt using QGIS 2.14.3, since I was used to use the old GRASS toolbar where the Create and Open mapsets where included as buttons... But as Jim himself answered, you just have to realize that those options are now in Plugins > GRASS


0

Before you run GRASS, make sure that the project CRS is set to the CRS of the layer you are working on. Then output and input layer CRS should be the same. Save As is not useful for reprojecting rasters (it only works for vector data). Instead, use Raster -> Projections -> Warp to a different filename and CRS, or Set Layer CRS ONLY if the raster is ...


2

In GRASS GIS 7, there are two v.kernel tools: v.kernel.rast and v.kernel.vector. These tools are available in the current development version of QGIS. (QGIS 2.14.2 contains fewer algorithms and v.kernel is missing.) In the provider settings, the "GRASS commands" section is used to configure GRASS GIS 6 and the "GRASS GIS 7 commands" section GRASS GIS 7. ...


1

The fact that the range is NAN is no good as it means: no data there :) In GRASS GIS, the concept of computational region applies, i.e. in computations, raster input maps are automatically cropped/padded and rescaled (using nearest neighbour resampling) to match the actual computational region (bounding box and current raster resolution) in order to produce ...


0

I have gotten to finally visualize my data. In a nutshell, I uploaded a newer version: 6.4.4; different from the one I was using: 6.4.3. After doing it, I followed the same steps for importing my data and now it works.


0

I'll try with a higher value for threshold, just to know if it works. However, I've finally solved my original problem (i.e. "build a raster with the shortest distance from every pixel to a city following a road") in four steps: 1- using 'v.distance' I've calculated the distance from the grid points to the road and the and the x and y coordinate of the ...


1

It's not an operation system issue, but a QGIS installation one. There's no MSYS folder with the 2.14 standalone installer. Either follow the tips in the question and answers at QGIS 2.14 standalone GRASS provider missing Msys folder, can't execute tools, or perform an advanced install of 2.14, which does come with MSYS (verified so yesterday).


1

I think you need to install GRASS 6 on your system to include Minimal System (MSYS) because GRASS 7 doesn't include MSYS. The GRASS 7 tools keep looking for MSYS which is not exist. After installation, if you still receive the same error, then you need to set the correct path of the folder where MSYS is installed from Processing Options.


2

The image should be 1 bit/pixel (0/1 values doesn't guarantee that). Use gdal_translate to change (tiff or png format will fit). gdal_translate -co "NBITS=1" image.tif bit_image.tif Change the background color to null r.null map=image setnull=1 After r.thin should work.



Top 50 recent answers are included