[GRASS-user] Use variables in GUI?

Richard Chirgwin rchirgwin at ozemail.com.au
Sat Sep 25 02:27:27 EDT 2010


  Hamish,

Being more a scripter than a programmer, I suspect g.pnmcomp is beyond 
me ... I can't really see how to pass a map to the module, and can't 
really find any examples to help.

So here's what I would like (ideally) a script to do:

1. set a variable (eg state)
for i in NSW QLD VIC; do
g.region vect=$i

2. Load gis.m with a .grc file
gis.m dmrc=Mymaps.grc

3. Pass $i to the "where" variable in a vector.

4. Zoom to the region.

5. Output the image to $i.png

6. Quit gis.m for the next state.

Is it feasible?

Cheers,
Richard
On 24/09/10 11:43 AM, Hamish wrote:
> Richard wrote:
>>   This may be beyond Grass-GIS, but here goes.
> nothing is impossible :-)
>
>> I have to generate many output maps (50) and I need
>> transparency - which means I can't just use d.vect and
>> d.out.file in a script.
> i.e. you need blending? that is done for the GUI by the g.pnmcomp
> module.
> Use the PNG driver (it is map filename extension aware to avoid .png)
> or d.out.file to create the files. or just use NetPBM's version of
> pnmcomp yourself.
>
>
>> But in the outputs, I have to restrict the display to a
>> named area (eg: state="NSW").
>>
>> So I'm wondering - is there any way within the GUI - either
>> TCL or Python - to use a variable within the SQL query?
>>
>> That way, it may show "state=$variable" in the select
>> window, and I just need to set the variable, zoom to a
>> region, and produce an output rather than having to adjust
>> the variable in 50 or so outputs!
> my only idea would be to write a script which created a GUI session
> file dynamically, then load those.  but g.pnmcomp could bypass the issue?
>
>
> Also of note, r.out.png in 6.5svn has a new -t flag to make the NULL cells
> transparent, and a new -w flag to output a world file. r.out.tiff will get
> the same for NULL cells at some point. The main reason for this is that it
> makes nice rasters for WMS, TMS, gdal2tiles&  OpenLayers web maps. I see
> no reason why these shouldn't be backported to 6.4.1 after some quick
> testing in 6.5.  (trac #1077)
>
>
> Hamish
>
>
>
>
>



More information about the grass-user mailing list