Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
60 views

Importing GRASS GIS into another Python Environment on Windows

How do I access GRASS GIS modules from inside a brand new Python environment such as venv, pipx, uv, pixi, or just regular Python?
Gregory's user avatar
  • 23
1 vote
0 answers
145 views

GRASS paths in Python standalone from QGIS install

I am trying to access GRASS from Python (Spyder). I have: Installed via pip install grass-session Started GRASS from OSGEO4W, loaded the mapset and location Started Spyder from Anaconda Tried to ...
william3031's user avatar
1 vote
1 answer
93 views

Looping GRASS "v.extract" in python

I have a multipolygon shapefile representing different cities. I am trying to loop the "v.extract" GRASS command through the different polygons via the Python interface. This is the code I ...
okapina's user avatar
  • 103
2 votes
1 answer
458 views

How to use Python packages (GeoPandas, rioxarray) inside GRASS Python scripts?

I want to combine the functionality of GRASS GIS with other Python packages such as GeoPandas and rioxarray. My OS is Windows. It is possible to import other standard packages such as numpy and Pandas....
pittyplaetsch's user avatar
2 votes
0 answers
281 views

Problems with python GRASS module setup outside GRASS

I currently have GRASS version 78 installed with my OSGEO4W. I am trying to utilize the boilerplate instructions here to call the GRASS module in my python script outside of the GRASS console (ie in ...
gwydion93's user avatar
  • 1,975
2 votes
1 answer
1k views

How to fix "No module named grass.script" error in Linux PyCharm?

I'm trying to use v.generalize in the GRASS GIS library within a python code in PyCharm on my Linux Ubuntu system to make a shapefile that originally was a raster look less "blocky" by ...
user2031's user avatar
  • 231
1 vote
1 answer
147 views

Can't access rasters from PERMANENT mapset from Python

I'm having trouble accessing files from my PERMANENT mapset in the Python code editor inside GRASS. I am able to access the raster I would like to set my projection to from the console, but for some ...
Nabeel Rajabali's user avatar
1 vote
0 answers
235 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 ...
sobmortin's user avatar
1 vote
1 answer
644 views

Error while performing actions in GRASS GIS in Python

While performing actions in python console as described in the module of GRASS GIS,am getting following error: import grass.script as gs r.in.gdal -e input="D:...\ASTGTMV003_N19E073_dem" ...
Omkar Kadlag's user avatar
3 votes
0 answers
220 views

CalledModuleError: Module run None g.gisenv -n ended with error

I am trying to use r.horizon GRASS module(version GRASS 7.8) in Python script. But I couldn't able to access the grass modules. Everytime, I am getting the following error. File "C:\OSGEO4~1\apps\...
bs karthik reddy's user avatar
0 votes
1 answer
41 views

GRASS GIS 7.8 trigometric function of vector attribtue

I need to calculate the sin and cos of a vector attribute column, but these functions do not appear to be available. In Python I've tried using v.db.update: gscript.run_command('v.db.update', map='...
Forrest Williams's user avatar
1 vote
1 answer
66 views

run r.random through script in python shell

Trying to run r.random using the script but receiving an error message. It works when the module is run outside of the python shell so it must be te code, I'm new to this so I can't figure out what is ...
grassgis1234's user avatar
0 votes
1 answer
82 views

Creating reclass-rules-textfile within Simple Python Editor of GRASS GIS

We are writing a script with the simple Python editor (GRASS GIS). We try to set the rules for a reclass command within the script (without creating a txt.file manually). Is it possible to set the ...
Eddi's user avatar
  • 1
2 votes
1 answer
165 views

Creating cumulative friction map

I am looking at bottom friction (Manning's n) values in relation to storm surge as large volumes of water flow over a surface. In order to calculate total head loss occurring as water passes from the ...
Carter Rucker's user avatar
1 vote
1 answer
288 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 ...
Federico Gómez's user avatar

15 30 50 per page