[GRASS-dev] script output for g.list

Michael Barton michael.barton at asu.edu
Tue Sep 4 11:13:43 EDT 2007


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





More information about the grass-dev mailing list