[GRASS-user] Loops & v.extract for fire data

Richard Chirgwin rchirgwin at ozemail.com.au
Tue Jul 19 19:50:16 EDT 2011


On 20/07/11 2:00 AM, grass-user-request at lists.osgeo.org wrote:
> Message: 3
> Date: Mon, 18 Jul 2011 12:14:19 -0700 (PDT)
> From: mmann1123<mmann1123 at yahoo.com>
> Subject: [GRASS-user] Loops&  v.extract for fire data
> To:grass-user at lists.osgeo.org
> Message-ID:<1311016459687-6595999.post at n2.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
> Ok I have a fairly complex vector of fire burn areas.   Show below:
> http://osgeo-org.1803224.n2.nabble.com/file/n6595999/data.jpg
>
> I want to be able to do a v.extract and create a new file for each year
> (data spans 1910-2010).  I know how to run v.extract with a simple SQL query
> on the command line but I can not figure out how to iterate in a loop.  Any
> ideas?  Can this all be done within the grass command console?   Thanks!!!!
>
>
>
> Mike M
Without any information about your maps! ... here's an example for the 
command line (ie, bash):

for i in [variable list of some kind]; do
v.extract [parameters];
done

If (for example) "year" is stored as a database field, you could do this:

for i in `v.db.select [input map] column=year -c`; do
v.extract [input map] output="name_"$i where='cat=$i';
done

Cheers
Richard



More information about the grass-user mailing list