[GRASS-dev] Re: simple script to draw a path and compute length, climb, etc...

stefano negri ste.negri.liste at gmail.com
Thu Apr 10 07:53:26 EDT 2008


2008/1/3, stefano negri <ste.negri.liste at gmail.com>:
> Hello,
> I have written for my use a simple script that lets the user draw a path on a map (like r.profile, on which the script is built) and then outputs the path's length, cumulative uphill and downhill climb, highest and lowest altitudes, maximum and average slope (up and down).
> Unfortunately I was not able to make it work with ash, because (in my understanding) ash does not support arrays. I am also thinking about rewriting everything in C or Tcl.
> Te script is attached to this email, in case it can be of any interest to anybody.
> Regards and happy new year,
> Stefano.


Hello,
there is now a python version of basically the same script (and also
removed a bug that was there in the bash version). Both python and
corrected bash version are attached.
The python version, of course, does not depend on external commands
(awk, bc...) and is incomparably faster. Ideas and comments are
welcome.
If you think it could be worth going into the addons, I would be glad
to add it there, but I don't have write access to the repository.

As I have read some posts in the past about scripting GRASS with bash,
Tcl and python, I feel I can give my 2 cents on that (for others that
are considering learning one of the three), because before deciding
for python I have also tried to learn some Tcl. I don't want to
comment on the language itself, just on how easy it can be to learn.
On this respect I think python is for sure the best to choose: I found
it very natural, while I had exactly the opposite feeling with Tcl.
That's just *my* experience... it could also be a matter of what kind
of background you have: mine is mainly in Java and Delphi (but I have
also used in the past C, a bit of Lisp, and bash).

Best regards,
Stefano.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hikereport.py
Type: text/x-python
Size: 10482 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20080410/2144dda4/hikereport-0001.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.hikereport
Type: application/octet-stream
Size: 6420 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20080410/2144dda4/r-0001.obj


More information about the grass-dev mailing list