[GRASS-dev] script output for g.list
Martin Landa
landa.martin at gmail.com
Wed Sep 5 03:46:26 EDT 2007
Hi Michael, Markus, ...,
that's true, '--q/--v' should not influence format for listing in this
way! I added parameter 'ncols' for "Number of elements per line". But
the verbose listing still uses G_list_elements(), so 'ncols' doesn't
work together with '-f' flag.
Path attached.
For scripting
$ g.list rast ncols=1 --q
$ g.list help
Description:
Lists available GRASS data base files of the user-specified data type
to standard output.
Keywords:
general, map management
Usage:
g.list [-f] type=datatype[,datatype,...] [mapset=string] [ncols=value]
[--verbose] [--quiet]
Flags:
-f Verbose listing (also list map titles)
Prints one element per line
--v Verbose module output
--q Quiet module output
Parameters:
type Data type
options: rast,rast3d,vect,oldvect,asciivect,icon,labels,sites,
region,region3d,group,3dview
mapset Mapset to list (default: current search path)
ncols Number of elements per line (0 for autodetect)
default: 0
Martin
2007/9/4, Michael Barton <michael.barton at asu.edu>:
> Thanks very much Martin. Not knowing C, I'm not exactly sure what to do with
> this, but will try to work with it if no one else gets to it first. I'm not
> sure I'd hang the different format on the --q flag. Maybe a -l (for
> listing?) flag would be better.
>
> Once this is worked out and in the cvs, I'll put it into select.py. I don't
> know if you've had a chance to look, but I added a class to allow select to
> be called in a separate dialog and a method that lets you update the element
> list after you've created a selection control.
>
> Michael
>
>
> On 9/4/07 2:37 AM, "Martin Landa" <landa.martin at gmail.com> wrote:
>
> > Hi Michael,
> >
> > I tried to modify g.list. Instead of G_list_element(), the patch call
> > G_list() and G_ls_format() .
> >
> > Patch attached (not committed to CVS).
> >
> > E.g.
> >
> > $ g.list rast
> > ----------------------------------------------
> > raster files available in mapset <martin>:
> > asp
> > ----------------------------------------------
> > raster files available in mapset <PERMANENT>:
> > aspect elevation.dem fields landuse roads
> > soil.br.depth soils.ph strm.dist trn.sites
> > bugsites elevation.dted geology owner
> > rstrct.areas soils soils.range texture uparea
> > density erode.index landcover.30m quads
> > rushmore soils.Kfactor spot.image tractids
> > vegcover
> > elevation.10m erosion1 landcover.orig railroads slope
> > soils.Tfactor streams transport.misc
> >
> > $ g.list rast --q
> > asp
> > aspect
> > bugsites
> > density
> > elevation.10m
> > elevation.dem
> > elevation.dted
> > erode.index
> > erosion1
> > fields
> > geology
> > landcover.30m
> > landcover.orig
> > landuse
> > owner
> > quads
> > railroads
> > roads
> > rstrct.areas
> > rushmore
> > slope
> > soil.br.depth
> > soils
> > soils.Kfactor
> > soils.Tfactor
> > soils.ph
> > soils.range
> > spot.image
> > streams
> > strm.dist
> > texture
> > tractids
> > transport.misc
> > trn.sites
> > uparea
> > vegcover
> >
> > Martin
> >
> > 2007/9/3, Michael Barton <michael.barton at asu.edu>:
> >>
> >> Awhile ago, I think g.mlist output was changed so that it sent out a single
> >> list of maps or other GIS elements rather than a multicolumn list. Is there
> >> a way to add a flag to g.list so that it can produce output in the same way?
> >>
> >> As it is, the output of g.list cannot easily be parsed within a script
> >> because of it's multicolumn output. If the output could be a nice, clean
> >> single list, it *would* be parsable. Within a script, g.list is preferable
> >> over g.mlist for finding all relevant files in a mapset because it seems
> >> considerably faster.
> >>
> >> Michael
> >> __________________________________________
> >> Michael Barton, Professor of Anthropology
> >> Director of Graduate Studies
> >> School of Human Evolution & Social Change
> >> Center for Social Dynamics & Complexity
> >> Arizona State University
> >>
> >> phone: 480-965-6213
> >> fax: 480-965-7671
> >> www: http://www.public.asu.edu/~cmbarton
> >>
> >>
> >> _______________________________________________
> >> grass-dev mailing list
> >> grass-dev at grass.itc.it
> >> http://grass.itc.it/mailman/listinfo/grass-dev
> >>
> >
>
> __________________________________________
> Michael Barton, Professor of Anthropology
> Director of Graduate Studies
> School of Human Evolution & Social Change
> Center for Social Dynamics & Complexity
> Arizona State University
>
> phone: 480-965-6213
> fax: 480-965-7671
> www: http://www.public.asu.edu/~cmbarton
>
>
>
--
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: g-list-vq-2.diff.gz
Type: application/x-gzip
Size: 2521 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070905/d9e4b94a/g-list-vq-2.diff.gz
More information about the grass-dev
mailing list