[GRASS-dev] GSoC Week 5 Report: Graphical User Interface for the hydrological tools r.stream* in GRASS GIS

Margherita Di Leo dileomargherita at gmail.com
Fri Jun 24 02:17:17 EDT 2011


Hi all,

I am in delay with my project, this is due to the fact that I am used to
code in python in procedural way and now I am facing the object oriented, or
better, the "event oriented" way. I am studying the Wxpython reference book
and I am learning a lot. I am not giving up at all!!

I also need a little help from you devs to solve some issues.

In the Layer Manager I have added "Network Modeling" under Raster ->
Hydrologic Modeling. This command should raise the GUI of wx.stream. When
user has filled every box dialogs, he/she should select a point on Map
Display and click a button in wx.stream called "update preview", in order to
see the preview over a small region. If user doesn't select any point and
clicks the button, raises a warning message like "please select a point on
the map display". When the point is selected, ad the parameters are
correctly inserted, the wx.preview GUI raises (this should be a second
independent module). It shows an image browser and a bigger image display.
User can click over an image in the image browser and the image is displayed
in the bigger frame. User can change the parameters in wx.stream GUI and
then clicking the same button "update preview" a new image is generated in
the preview image browser and can be selected to be displayed.

Preview widget, as Hamish suggested, should be as general as possible, so it
can be used by all commands instead of just r.stream. Preview widget IMHO
should generate png images stored in a temp folder. And here are my issues.

1) First problem is that input of preview widget are passed by r.stream GUI
(as a command line, so actually a string), and by Map Display (as a point,
actually a tuple). String can be processed by preview GUI using
os.system(cmd), BUT in order to convert the output of the command in a png
file and to export it in the temporary folder, it is necessary to know the
name of the output map that has to be exported. Output has a name given by
user and passed as string (actually parsing a command line is not big deal,
but problem is how to recognize output name, because every command has
different name for output, it's not always output = something, but can be
acc = something for instance). And also:

2) How to convert the output of the command in a png file and how to export
it in the temporary folder in G7? In grass 6.5 I simply would do:

    grass.run_command( 'd.mon', start = 'x0' )
    grass.run_command( 'd.rast', map = 'sc_elev' )
    grass.run_command( 'd.out.file', output = os.path.join(fpath, prefix +
'_elevation'), format = 'png', resolution = 2, flags = 't' )

Thanks for any suggestion..

madi

-- 
Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20110624/07ef238e/attachment.html


More information about the grass-dev mailing list