Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [grass.script]

The Python scripting library for GRASS

0
votes
0answers
14 views

GRASS v.hull for many point sets

I have map "my_pointmap" with 3D points with ids=(1,2,3...N). I have also list of subsets of these point ids , S = [(1,2,3,4),(2,4,10,12), ...]. I would love to get GRASS GIS vector map with |S| 3D ...
1
vote
1answer
67 views

Adding GRASS module to QGIS 2.18.21

I did a module in grass wich I called r.out.haralickFeatures.py. I did a .qgm. I can't get the parameters rigth. #!/usr/bin/env python #%module #% description: Compute asm, contrast, var, idm and ...
0
votes
1answer
102 views

Loading ADF file from National Elevation Dataset into GRASS with Python?

I'm trying to load data from the National Elevation Dataset into GRASS/Python, using this Python script (outside of GRASS): # Imports import os import grass_session from grass.script import setup as ...
0
votes
1answer
31 views

Entry point not found Error initiating GRASS GIS from Python

I cannot run any GRASS tools from within Python 2.7.15. While the GRASS environment, grass.script etc. are loading correctly and I can run basic checks like gscript.read_command('g.gisenv') gscript....
0
votes
0answers
43 views

Running “r.lake” command in GRASS 7.4.0 from Jupyter notebook

I am currently using Jupyter notebook (Python 2.7) to run a GRASS (7.0.4) session on Windows 10. My code snippet is as follows: out_lake = gcore.start_command('r.lake', elevation = '115_hydrosheds', ...
2
votes
1answer
214 views

Watershed Delineation Loop - r.water.outlet resulting in NAN area while snapped

I am attempting to create multiple watershed delineations for stations within a CSV file. I have files for flow direction (raster with a cell size of 30m), flow accumulation(raster with a cell size of ...
1
vote
0answers
39 views

GRASS GIS Error Flags

I am attempting to run a GRASS command from the terminal and eventually a bash script, in which it links rasters in a folder to the Mapset previously defined. I was able to successfully create the ...
2
votes
1answer
120 views

grass GIS + spyder python script error

I'm getting crazy with grass gis and python. I want to call a grass function from an external python script (using spyder for instance). I've installed QGIS + GRASS with the OSGeo4W64 installation ...
1
vote
1answer
158 views

Setting variable from input map in GRASS python script?

I'm currently working on a GRASS script that takes maps from user input and computes them into a mapcalc expression. The issue i'm stucked with that when i ask for the map i can't set a variable name ...
0
votes
1answer
115 views

How to execute a GRASS module developed in Python?

I am following the FOSS4G-E 2015 tutorial on how to develop GRASS modules with Python. The minimum template given in this tutorial is this script: %%file r.viewshed.points.py #!/usr/bin/env python #%...
4
votes
1answer
2k views

How to clip raster in GRASS Gis?

I am using GRASS GIS v7.2.0. The intent is to clip my DEM raster. I have searched available raster tools but didn't found anything allow me to clip my raster using polygon vector or interactively. ...
1
vote
0answers
25 views

(d.*) of GRASS GIS does not execute from standalone script

I am in windows 10. All my module import works well and grass env for standalone script is fine. I tried to execute following commands from standalone script. Neither wx1 display gets executed nor it ...
1
vote
2answers
237 views

How to calculate area of the output of r.water.outlet?

I wrote the following code to use r.water.outlet module in GRASS GIS: import os import sys #set up GRASS environment variables sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python')) ...
0
votes
1answer
179 views

Extracting raster information within/inside polygon (for each contour)

I have raster data of NDVI and DEM I have already created contour from DEM. Now I'm trying to find following: for each contour find the raster information within the contour. Can anyone suggest ...
0
votes
1answer
110 views

Possible to convert v.net.spanningtree to QGIS custom script so don't need GRASS installed?

Is it possible (and if yes then how or has this been done) to convert v.net.spanningtree in to a QGIS/python (custom) script that can be accessed in the QGIS graphical modeler in a way that GRASS is ...
2
votes
1answer
859 views

Connecting Python script external to Grass GIS 7 program in Windows 10?

I've tried to find resources online to link and run my Python script externally from Grass GIS 7, however, I have not been successful. I found resources here that provide instructions (e.g., https://...
1
vote
0answers
295 views

Use Function V.clean of the grass tool in a script pyhton

I need to integrate V.clean functionality of Grass in a script python. this functionnality is accessible in Qgis (Processing->tools). I found that I should use Grass API but I don't know the code ...
5
votes
3answers
2k views

GRASS 7 environment setup for Python

I would like to use some GRASS functionality from a Python programme. With GRASS 6 this required the set up of various environment variables, as detailed in the GRASS Wiki. I am trying a similar ...
1
vote
1answer
36 views

Problem with numeric variable in i.topo.corr

I have a script to do topographic correction on landsat images. Following the manual, I first have to create the illumination model. I do it with the following line: i.topo.corr -i --overwrite ...
2
votes
0answers
160 views

GRASS GIS: how to run g.run_command(“v.extract”) in Python with sqlite, smooth-spline in GRASS GIS?

I would like to solve several problems by using a python script in GRASS GIS: I already uploaded collected GPS-waypoints and tracks ("v.in.org"), patched several GPS-vector data ("v.patch") and ...
2
votes
1answer
103 views

Pygrass reading raster issue

I'm tring to read a raster map from my grassData. I'm using this code import os import grass.script.setup as gsetup from grass.pygrass import raster gisbase = os.environ['GISBASE'] gisdbase = os....
4
votes
1answer
98 views

GRASS GIS temporal raster individual layer statistical summary

I have created a temporal raster in GRASS GIS which has 90 layers. I would like to extract the mean of each raster layer and export it as text file. Right now I have to export the rasters as GeoTiffs ...
1
vote
1answer
195 views

Solar radiation flux at 5 minute interval using GRASS GIS r.sun

I have been trying to estimate instantaneous total solar irradiance(w/m2) at five minute interval for a day (eg. 21 sept). I can do this in SAGA GIS by using "moment, mode 1" and running the solar ...
2
votes
1answer
605 views

Capturing Output Messages from GRASS when Running Python Scripts

Using documentation here: https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_7 I've figured out how to access GRASS modules in Python without ...
1
vote
0answers
129 views

Making GRASS GIS 7 Ubuntu bash file work on Windows 7

I have created this bash file (.sh) while working on watershed analysis stochastic simulation in GRASS GIS 7.0.2RC1, which is running on Ubuntu. It worked perfectly and I received the correct results. ...
2
votes
2answers
865 views

Missing v.in.ogr module of GRASS in QGIS Processing toolbox?

I am a new user to QGIS/GRASS and I am having a problem utilizing GRASS. I have several files that I generated in QGIS that I want to import into GRASS so I can use some of the Grass modules. ...
1
vote
1answer
55 views

Set region with rounded values/coordinates

How do I set a region update with rounded coordinates. I usually set my region from a puffer around my points of interest and round up the north and east coordinates and round down the south and west ...
2
votes
1answer
82 views

Return variable with GRASS GIS on a Windows machine

How do I return a variable in GRASS GIS on a Windows machine? For example I set a list of files to define my region. I already figured out that I can't use the bash command export, I need to use set ...
4
votes
1answer
1k views

Using Spyder IDE to develop python for Grass GIS, get 'ImportError: No module named grass.script'

I am trying to use Spyder IDE to develop a python script using python library from grass-6.4.3. I run the script below, and get ImportError: No module named grass.script I am using python 2.7, ...
0
votes
2answers
3k views

Extract Elevation of Points from DEM using Python QGIS or GRASS

I am utterly new to GIS, so please bear with me if I am providing incomplete information here. I have a DEM file (.dt2). What I am looking to do is as follows: take a series of points specified as ...
3
votes
0answers
158 views

Extract representative slope profiles from hillslope polygons

With the help of the Whitebox Geospatial Analysis Tools I was able to easily extract hill slopes from a river network in combination with a flow direction map. Now I would like to extract ...
1
vote
1answer
268 views

How to fix this “Sorry <1> is not a valid option” in GRASS-Ubuntu using r.water.outlet?

I am working with this .sh code (a while loop, extracted from: http://www.surfaces.co.il/) to create watersheds from drainage raster and outlet point of every watershed, but I obtain this error: "...
1
vote
0answers
72 views

Python script split up

I have a python script which works with Grass 6.4. At some point during the project I decided to split this big python script into several scripts. I have made all necessary variables global, created ...
1
vote
1answer
522 views

GRASS scripting for producing multi-band raster?

I am trying to loop the r.sun function within a Python script. Anyway, I seem not to understand how I can stack the raster maps each loop would produce into a single multi-band raster (preferably in ...
0
votes
2answers
579 views

Problem with Bash loop in GRASS GIS

I'm new to GRASS GIS and programming and I'm running into a lot of what I imagine are beginners problems and something similar to this has been asked before, but not In a way that I understand. I'm ...
4
votes
1answer
425 views

How to use grass.script in MacOS

I have installed Python and Grass6.4 using Macports. When I tried to use "import grass.script" in python environment, it gives "no module found" error. I'd spend much time to fixed it but could not ...
2
votes
1answer
676 views

How to batch-process attribute tables in QGIS (or GRASS)?

I'm using GRASS 6.4.3 in Linuxmint 16. I have a bash script for GRASS which I use to process almost 300 raster files. The script first imports some raster files (r.in.gdal), then does some ...
1
vote
1answer
33 views

Is my code for changing the resolution correct?

I have a raster files of daily minimum temperature (tmin) for the period 1962-2011 at a resolution of 1.125. I need to convert each single day raster file into 0.5 using inverse distance interpolation....
1
vote
0answers
238 views

GRASS and r.viewshed

I'm trying to run the r.viewshed command using co-ordinates held in a .csv file I imported using v.in.ascii. It has over 200 rows and I'm looking to run viewsheds from each line, without doing it ...
0
votes
1answer
2k views

How to use python to set a variable to a value from a vector attribute table for GRASS

I'm adding to a python script for GRASS v.transects.py. I want to set a variable to equal a value from a field in the vector's attribute table using a for loop to cycle through each row. This is one ...
0
votes
0answers
709 views

How to process multiple images in Grass GIS

first of all, I have to mention that I'm almost new working with Grass and I'm using Grass 6.4.3 on Linuxmint 16. I need to process a large number (~300) of Landsat images. I have downloaded the ...
0
votes
1answer
53 views

Problems installing r.roughness

I am trying to install r.roughness in GRASS 6.4.3. It starts compiling but at the end I get this error: ERROR: Module did not install properly I cannot identify the problem. Can somebody that has ...
1
vote
3answers
2k views

Problem with python script to control GRASS GIS from outside - How to import grass.script under Win 8.1?

I am working with GRASS 6.4.3 and python 2.7.6 under WIN 8.1. I am a novice with computer science and coding, and I have seen many posts including those:Is it possible to use GRASS GIS in Python ...
2
votes
1answer
436 views

Can one batch-automate the creation of QGIS heatmaps?

I have 4k point shapefiles, from which I would like to generate heatmap TIFFs using the QGIS heatmap plugin (or a functional equivalent featuring triweigth, radius and cell size selection). Is there ...
2
votes
2answers
788 views

How to do the loop when using GRASS module r.water.outlet?

I have seen this post:Watershed Analysis with GRASS, and I have a .txt file which contains coordinates of many points, and I want to use r.water.outlet to get basin area of each point. I type the ...
1
vote
0answers
219 views

Is there any GRASS command to measure the distance between a point in rastermap and another in vector map?

I have a question about WinGRASS 6.4.3. Is there any GRASS script command to measure the distance between a point in rastermap and another in vector map? I have a raster map and a vector map. Raster ...
0
votes
1answer
698 views

d.rast problem in GRASS command line

Update#1: @gene, thank you for your reply and I type d.mon in command line, getting a popout GUI look like this: I choose the top three flags(-l, -L, -p), and I got this: And I don't know what to ...
1
vote
1answer
222 views

g.list problem in GRASS command line

I am using GRASS 6.4.3 (installed with osGeo4w), and I have this question: As I type g.list, a function window will pop out, and all functions and results are fine. But when I type g.list rast, I got ...
1
vote
1answer
306 views

libfreetype-6.dll lost when using GRASS command line

Update#1: Following the instruction of Sorin Călinică, I have installed libfreetype-6.dll using the OSGeo4W Network Installer, and the command d.rast can launch successfully. I am using GRASS 6.4.3 (...
2
votes
1answer
611 views

How to iterate GRASS region definition?

I am using GRASS r.skyview command (v.7, Windows) to determine "urban canyon effect" on pollution due to the presence of buildings. The command nicely works, unfortunately I need to process a very ...