[GRASS-user] v.coordinate.sh - improve this script?

Michael Barton michael.barton at asu.edu
Thu Jan 24 10:56:53 EST 2008


On Jan 24, 2008, at 8:34 AM, Nikos Alexandris wrote:

> Michael,
>
> thank you for these important details for new GRASS users (like  
> me). On
> the web I have found some good resrources for bash scripting. Is there
> something for Python (for beginners) and maybe GRASS-oriented as well?
>
> Thank you,
>
> Nikos
>
> On Thu, 2008-01-24 at 08:28 -0700, Michael Barton wrote:
>> On Jan 24, 2008, at 6:52 AM, grass-user-request at lists.osgeo.org  
>> wrote:
>>
>>> Date: Thu, 24 Jan 2008 05:12:03 -0800 (PST)
>>> From: "Gabriele N." <gis.gn at libero.it>
>>> Subject: [GRASS-user] v.coordinate.sh - improve this script?
>>> To: grass-user at lists.osgeo.org
>>> Message-ID: <15063748.post at talk.nabble.com>
>>> Content-Type: text/plain; charset=us-ascii
>>>
>>>
>>> Hi list.
>>> I made a script (attached) for the definition of interactive text  
>>> file
>>> (containing the coordinates input and output) to be loaded later in
>>> v.transform.
>>>
>>> It is useful to write automatically coordinates in the text file.
>>>
>>> Operation is simple:
>>> - A load map (not georeference) and the map B (which may be  
>>> raster or
>>> vector) and will open 2 monitor.
>>>
>>> - We need to move the first monitor to the side of the second  
>>> monitor.
>>>
>>> - Proceed doing a zoom (if necessary) on the first monitor (A map)
>>> and then
>>> identifying the input point (GCP) with one click. After this
>>> transaction
>>> will be made to locate the point on the second monitor (B map).
>>> The pairs of points are identifying 4 (at least 4). For more points
>>> see a
>>> graphic which will require to continue with the process or not.
>>>
>>> - After the inclusion of the points in your / home will be a text  
>>> file
>>> 'coordinate.txt' formatted for use in v.transform.
>>>
>>>
>>> The script is certainly improved. For example viewing points
>>> included (as eg
>>> in i.points on in d.path) or shifting automatically monitors or
>>> using snap
>>> for the insertion points etc. ...
>>>
>>> I have no programming experience, and I hope that someone can  
>>> help me
>>> improve.
>>>
>>> Gabriele
>>>
>>> PS
>>> Necessary installing xdialog and xmessage
>>> 		
>>> http://www.nabble.com/file/p15063748/v.coordinate.sh v.coordinate.sh
>>> -- 
>>> View this message in context: http://www.nabble.com/
>>> v.coordinate.sh---improve-this-script--tp15063748p15063748.html
>>> Sent from the Grass - Users mailing list archive at Nabble.com.
>>
>> Gabriele,
>>
>> It is good to learn scripting of some kind because it really expands
>> the analytical capabilities of GRASS. However, I'm not sure why you
>> are trying to create a bash script for interactive georectifying.
>>
>> i.points already does with with xmonitors. However, this will not
>> work on Windows because it doesn't support the underlying socket code
>> for the monitor drivers.
>>
>> The TclTk GUI already has a more sophisticated replacement for this
>> function that works on all platforms.
>>
>> Also, given issues (long known) that we've run into again with
>> running bash scripts on Windows, I think that now is the time to
>> begin to strongly encourage GRASS users and developers to try to
>> begin shifting their scripting to a platform that works on all OS's.
>> Since the new GUI will be in Python, I strongly suggest that we start
>> developing new scripts in Python and for anyone with time on their
>> hands ;-) start to create Python versions of existing scripts. The
>> more scripts that are available in Python, the more people will make
>> sure that Python is installed and will take a look at it, which will
>> lead to more scripts in Python, etc...
>>
>> Already, a Python script can pop up the same TclTk GUI that a bash
>> script can, and has the option of popping up a wxPython GUI if this
>> is installed.
>>
>> Michael
>>
>> ____________________
>> C. 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-6262
>> Fax: 480-965-7671
>> www: <www.public.asu.edu/~cmbarton>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
> -- 
> Nikos Alexandris
> .
> Department of Remote Sensing & Landscape Information Systems
> Faculty of Forestry & Environmental Sciences, Albert-Ludwigs- 
> University Freiburg
> .
> Tel.  +49 (0) 761 203 3697 / Fax.  +49 (0) 761 203 3701 / Skype:  
> Nikos.Alexandris
> .
> Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany

Hi Nikos,

There is a Python scripting guide on the GRASS WIKI at <http:// 
grass.gdf-hannover.de/wiki/GRASS_and_Python>

There are many excellent tutorials for Python listed on the Python  
home site <http://www.python.org>, including the 'learn Python in 10  
minutes' tutorial at <http://www.poromenos.org/tutorials/python>.  
There are also many books availale.

Python is much easier to work in than bash, as well as much more  
powerful. It is also fully cross-platform meaning that your scripts  
will work on Windows, Mac, and Linux. Since Python is also free and  
easily downloaded, everyone can install it.

I strongly recommend that you work with the current version--2.5.1-- 
although we are trying to support 2.4 in the GUI.

Michael
____________________
C. 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-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>
 >


More information about the grass-user mailing list