2

I am new in GRASS GIS and i wanted to know how i could translate GRASS manual operations to GRASS commands in the console.

I imported a raster and i was able to see the command

r.import input=XXXXX\XXXXX\...\XXX.grd output=XXXX

However, i then added some maps to the GIS Map display but i did not see any code in the command line, does anyone know how can i get the commands of each operation i do in GRASS?

  • If you are using linux, then the bash/shell command history will show you the past command you typed on the console. If you run commands from the GUI, then you'll see the full command, and it's output in the "Command output" tab of the module window. But there's no history of the commands run from the GUI. – Micha Aug 7 '18 at 21:50
5

Start any GRASS module through the GUI (e.g., File > Import raster data > r.in.gdal), and set all the options as you want them. Then, instead of clicking the "run" button, instead click "Copy." This copies a correct terminal command to the clipboard. You can then past this into a text editor to save for later, or paste into the GRASS prompt in the terminal or the console tab of the Layer Manager.

2

To add to Computarch's answer, some of the actions you do in the GRASS GUI does not appear. For example, if you right click on a data layer and select 'Display layer' you will not see any command.

If you want to do this from the command line you have to use d.rast and d.vect with specifying the data. Please see the manual pages (just google it) for more details.

d.mon is another command to control your display which is only command line based. You can automate big and repetitive geoprocessing by sequentially placing these commands in a bash shell script, or even better with Python scripting. Search 'Bash and Grass' and 'Python and GRASS' if you want to walk along this line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.