Questions tagged [pygrass]
Object-oriented Python API for GRASS GIS.
16 questions
0
votes
1
answer
136
views
Running GRASS GIS from PyCharm
I follow the Working_with_GRASS_without_starting_it_explicitly with GRASS 7.8.8 (2023), but it did not work as intended. The Python line "gs.message" runs, but the line "gs.run_command('...
0
votes
1
answer
233
views
How to process multiple GRASS GIS jobs with different regions in parallel?
I want to send requests from a web frontend to GRASS GIS. I am currently using the Python Web Framework FastAPI for communication between the frontend and GRASS GIS.
I built the API as follows:
First ...
2
votes
2
answers
435
views
PyGRASS error: Could not load grass_gis.8.2
In PyGRASS I can only import objects from the module modules:
from grass_session import Session
from grass.pygrass.modules import Module, MultiModule, ParallelModuleQueue
print(Module)
If I'm trying ...
2
votes
0
answers
151
views
Optimizing memory usage when running r.viewshed in GRASS
Short explanation:
I am using r.viewshed as part of a script. The viewshed analysis is the most costly (time) part of the script and I'm trying to optimize how quickly it runs (I need to run the ...
1
vote
0
answers
209
views
Errors Running Some Commands in GRASS Standalone Script
After much struggle I have managed to get a GRASS standalone script run outside of GRASS. I can successfully get an output from running some commands, while others give a very unclear and unhelpful ...
2
votes
0
answers
94
views
GRASS GIS: r.out.gdal raises an exception and hangs if it's called multiple consecutive times
I'm using a small python routine (grass.script, pygrass) to handle several operations on sentinel2 imagery. I'm calling r.out.gdal inside the script and a very annoying problem occurs: when it is ...
0
votes
1
answer
74
views
PyGRASS r.mapcalc crashes with ERROR: Unable to make mapset element
I'm trying to load a GeoTIFF and then do some calculations on it with r.mapcalc
the code is as follows:
from grass.pygrass.modules.shortcuts import general as g
from grass.pygrass.modules.shortcuts ...
0
votes
1
answer
175
views
Exporting a GeoTIFF with PyGRASS
I want to export a GeoTIFF with PyGRASS but i can't figure out how I can do that.
my code so far:
# import grass python libraries
from grass.pygrass.modules.shortcuts import general as g
from grass....
0
votes
1
answer
74
views
How to load data into R via PyGRASS?
I have a remote machine where my GRASS binaries (7.8) are available and I want to apply this solution https://gis.stackexchange.com/a/255899/36712 to my data set of thousands of small images. In most ...
2
votes
0
answers
90
views
Using Pygrass Functions in Jupyter gives XML Error
I have been trying to use pygrass from grass78 with Python 3.7 inside a Jupyter notebook and have run into an issue where I can import grass modules, but cannot call any pygrass functions, e.g, r....
1
vote
0
answers
45
views
Can't create a vector map with VectorTopo in new mapset after switching
I need to create vector maps in different mapsets with pygrass. However, there seems to be a "hidden" global variable which prevents mapset in pygrass from changing. It sort of "memorizes" the mapset ...
2
votes
1
answer
247
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
1
answer
278
views
pyGRASS on MacOS: unable to import pygrass.raster
I am running GRASS 7.3 on Mac OS 10.11.5 El Capitan. I'm trying to figure out how to get GRASS GIS running via python scripting (pygrass). I'd like to be able to access raster data programatically. ...
1
vote
0
answers
91
views
Running Python script in GRASS every time map extent is altered
I am looking to develop a python script that triggers every time the user zooms or pans to a new map extent. The script I have in mind will clip a raster to the visible extent thus reclassifying the ...
1
vote
1
answer
1k
views
GRASS python API [closed]
I have Ubuntu 16.04 64 bit and python 2.7.12 on my system. I have installed GRASS GIS 7 from the Ubuntu software support (I thing not is the better choose for install).
Now I want to take GRASS ...
2
votes
1
answer
3k
views
Exception using PyGRASS: "No module named 'core'"
I am trying PyGRASS on Ubuntu 14.04. I have GRASS 7 installed from the UbuntuGIS PPA:
$ dpkg -l | grep grass
ii grass 7.0.4-1~trusty1 ...