5

Using GRASS shell, I know that I can use the -help suffix to get information about a particular module.

E.g. r.relief -help will return this:

Description:
 Creates shaded relief map from an elevation map (DEM).

Keywords:
 raster, elevation, relief, terrain, hillshade

Usage:
 r.relief input=name output=name [altitude=value] [azimuth=value]
   [zscale=value] [scale=value] [units=string] [--overwrite] [--help]
   [--verbose] [--quiet] [--ui]

Flags:
 --o   Allow output files to overwrite existing files
 --h   Print usage summary
 --v   Verbose module output
 --q   Quiet module output
 --ui  Force launching GUI dialog

Parameters:
     input   Name of input raster map
    output   Name for output shaded relief map
              Name for output raster map
  altitude   Altitude of the sun in degrees above the horizon
             options: 0-90
             default: 30
   azimuth   Azimuth of the sun in degrees to the east of north
             options: 0-360
             default: 270
    zscale   Factor for exaggerating relief
             default: 1
     scale   Scale factor for converting meters to elevation units
             default: 1
     units   Elevation units (overrides scale factor)
             options: intl,survey
              intl: international feet
              survey: survey feet

Therefore, it seems reasonable to me, that there must be a command to list all the available modules names. Is there? What?

  • May be you are looking for g.extension -l? – Zoltan Feb 2 '16 at 14:50
  • It might. But now I'm getting some strange error "Connection Refused". I will try it at home. – Alexandre Neto Feb 2 '16 at 15:42
  • Actually this only list external extensions modules. I was searching for a command that lists the core grass modules as well. – Alexandre Neto Feb 2 '16 at 16:19
  • Within a GRASS shell, you could return all GRASS raster commands as follows: compgen -c | grep 'r\.' (nb it may return some other standard linux commands too) – dmci Feb 2 '16 at 21:39
  • Thank you, It works, but I was trying to find something more elegant since my objective was adding it to the qgis users manual (docs.qgis.org/testing/en/docs/user_manual/grass_integration/…) – Alexandre Neto Feb 2 '16 at 22:30
4

There is a relatively new module g.search.module which lists modules based on keywords. Perhaps could be helpful for what you are trying to do. This module is so far in GRASS 7.1 only.

  • I believe that's what I'm looking for. It's a petty that is not available in 7.0., but... I need to have patience. Can you confirm if I can use it without any keyword to list all modules? – Alexandre Neto Feb 3 '16 at 16:43
  • I think you have to specify at least one keyword, but you can specify multiple, like raster, vector, imagery, ... which should give you pretty much all modules. – Anna Feb 3 '16 at 18:55
  • 1
    I have just backported it to 7.0.svn: grass.osgeo.org/grass70/manuals/g.search.modules.html - It will be published with 7.0.4 in the near future (but it is now available in the snapshots of 7.0). Enjoy... – markusN Feb 7 '16 at 15:31
1

I don't know of a command that lists the modules per se. But if I wanted to list the modules that were available to me, I would list what was in the bin folder, e.g. on Windows,

dir %GISBASE%\bin\r.*

I looked in the env.bat file, and bin appears to be the only folder that is added to the path and has GRASS modules in it. So it seems the result of listing files in bin would accurately reflect the available modules.

1

Not exactly what I was looking for, but until now this the best solution for versions below prior to 7.1 that I was able to find.

In the command line, during a GRASS session, one can type for instance, v. and then press the TAB key twice, then say yes when asked to display all possibilities. I will show all vector modules.

GRASS 7.0.3 (alaska):~/git-repos/QGIS-Documentation > v.
Display all 123 possibilities? (y or n)
v.buffer               v.in.lines             v.out.svg
v.build                v.in.mapgen            v.out.vtk
v.build.all            v.in.ogr               v.overlay
v.build.polylines      v.in.region            v.pack
v.category             v.in.wfs               v.parallel
v.centroids            v.kcv                  v.patch
v.class                v.kernel               v.perturb
v.clean                v.krige                v.proj
v.colors               v.label                v.qcount
v.colors.out           v.lidar.correction     v.random
v.db.addcolumn         v.lidar.edgedetection  v.rast.stats
v.db.addtable          v.lidar.growing        v.reclass
v.db.connect           v.lrs.create           v.rectify
v.db.dropcolumn        v.lrs.label            v.report
v.db.droprow           v.lrs.segment          v.sample
v.db.droptable         v.lrs.where            v.segment
v.db.join              v.mkgrid               v.select
v.db.reconnect.all     v.neighbors            v.split
v.db.renamecolumn      v.net                  v.support
v.db.select            v.net.alloc            v.surf.bspline
v.db.univar            v.net.allpairs         v.surf.idw
v.db.update            v.net.bridge           v.surf.rst
v.delaunay             v.net.centrality       v.timestamp
v.dissolve             v.net.components       v.to.3d
v.distance             v.net.connectivity     v.to.db
v.drape                v.net.distance         v.to.lines
v.edit                 v.net.flow             v.to.points
v.external             v.net.iso              v.to.rast
v.external.out         v.net.path             v.to.rast3
v.extract              v.net.salesman         v.transform
v.extrude              v.net.spanningtree     v.type
v.generalize           v.net.steiner          v.univar
v.hull                 v.net.timetable        v.unpack
v.import               v.net.visibility       v.vect.stats
v.in.ascii             v.normal               v.vol.rst
v.in.db                v.out.ascii            v.voronoi
v.in.dxf               v.out.dxf              v.what
v.in.e00               v.outlier              v.what.rast
v.info                 v.out.ogr              v.what.rast3
v.in.geonames          v.out.postgis          v.what.strds
v.in.lidar             v.out.pov              v.what.vect

Note: I'm not sure if it will work in non-linux machines.

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.