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

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.

I need suggestions.

I used v.to.rast to convert vector in shp file. I assigned one colomn (elevation) in database as value of pixels.
It works well. Then to make it surface, I use r.surf.contour and it took very long time (more than 5 hours) until I finally
canceled it.

Question : How long the r.surf.contour is running normally ?
How to make certain resolution in that command. I want my DEM map will have 30mx30m resolution as landsat image.

Thank you all..

Ard

--------------------------------------
Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar
http://pr.mail.yahoo.co.jp/toolbar/

On 24/01/08 14:45, Ardiansyah wrote:

I need suggestions.

I used v.to.rast to convert vector in shp file. I assigned one colomn (elevation) in database as value of pixels.
It works well. Then to make it surface, I use r.surf.contour and it took very long time (more than 5 hours) until I finally
canceled it.

Question : How long the r.surf.contour is running normally ?

This depends on your region settings. You should make sure that the extents of your region do not go beyond the extents of your dem. I've also found that if you want to speed up the process you can create a mask which covers just the area you need to interpolate.

Also, from the man page: "The speed of r.surf.contour is dependent on how far "apart" the contour lines are from each other (as measured in raster cells). Since a flood fill algorithm is used, the program's running time will grow exponentially with the distance between contour lines.".

How to make certain resolution in that command. I want my DEM map will have 30mx30m resolution as landsat image.

g.region -a res=30.

Moritz

On 24/01/08 14:12, Gabriele N. wrote:

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.

Could you explain how this is different from the existing File->Georectify tool in the gis.m GUI ?

Moritz

Moritz Lennert-2 wrote:

On 24/01/08 14:12, Gabriele N. wrote:

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.

Could you explain how this is different from the existing
File->Georectify tool in the gis.m GUI ?

Moritz
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

I do not know well the File-> Georectify tool in the gis.m GUI and are not
sure if I can even assign coordinates output with the click.
However, I now better study (recently I have switched to GRASS), and if I
was wrong....... I apologize.

Thanks
--
View this message in context: http://www.nabble.com/v.coordinate.sh---improve-this-script--tp15063748p15065908.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Gabriele N. wrote:

http://www.nabble.com/file/p15063748/v.coordinate.sh v.coordinate.sh

...

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.

...

http://www.nabble.com/file/p15063748/v.coordinate.sh v.coordinate.sh

error on line 92:
if [$vettoriale2 == '']; then

you must have spaces next to and should quote variables. better:
(-z means zero length string, -n means non-zero length string)

if [ -z "$vettoriale2" ] ; then

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. ...

if you use d.where with the middle mouse button you can connect points
with a line. Or your script can draw them using "d.graph -m". see
d.mark from the wiki addons page.

You can do some shell math to convert the coordinates to a snapped
version. (e.g. 1234567.89 -> 1234000.00 with some awk '%' modulus or
log transform + round + back transform magic)

you might like "d.zoom -f" to get panning options, etc.

Use "d.where -1" for single point.

coord_1a=`cat coord_1 |head -n 1 | awk -F " " '{ print $1 " " $2 }'`

You don't really need `head` there, only data is sent to stdout.
but it doesn't hurt anything.

You might use g.tempfile for the temporary files so the script will
work from any directoy. (e.g. running script while not in home dir)

I have no programming experience, and I hope that someone can help me
improve.

that's what we're here for, to train others to become grass devels so
that they can help others....

Necessary installing xdialog and xmessage

if using GRASS's xmonitors you can replace those with d.menu + d.ask,
they are neat little under-utilized modules. But they will not be
ported to GRASS 7.

have fun,

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

Gabriele N. wrote:

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.

- Proceed doing a zoom (if necessary) on the first monitor (A map)
and then identifying the input point (GCP) with one click.

be careful because d.zoom changes the region for the entire mapset.
probably better to use $WIND_OVERRIDE if you can.

The script is certainly improved. For example viewing points included
(example i.points,

the POINTS file created by i.points is a simple ascii file saved in the
$MAPSET/group/ dir. you can use standard unix command line tools to get
the coords to give d.graph for drawing.

Hamish

      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

hamish_b wrote:

error on line 92:
if [$vettoriale2 == '']; then

you must have spaces next to and should quote variables. better:
(-z means zero length string, -n means non-zero length string)

if [ -z "$vettoriale2" ] ; then

Ok.

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. ...

if you use d.where with the middle mouse button you can connect points
with a line. Or your script can draw them using "d.graph -m". see
d.mark from the wiki addons page.

You can do some shell math to convert the coordinates to a snapped
version. (e.g. 1234567.89 -> 1234000.00 with some awk '%' modulus or
log transform + round + back transform magic)

you might like "d.zoom -f" to get panning options, etc.

Use "d.where -1" for single point.

coord_1a=`cat coord_1 |head -n 1 | awk -F " " '{ print $1 " " $2 }'`

You don't really need `head` there, only data is sent to stdout.
but it doesn't hurt anything.

You might use g.tempfile for the temporary files so the script will
work from any directoy. (e.g. running script while not in home dir)

I have no programming experience, and I hope that someone can help me
improve.

that's what we're here for, to train others to become grass devels so
that they can help others....

Necessary installing xdialog and xmessage

if using GRASS's xmonitors you can replace those with d.menu + d.ask,
they are neat little under-utilized modules. But they will not be
ported to GRASS 7.

have fun,

Hamish

____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

I am improving the script.
d.mark was exactly what I was looking for. Here's what I did:

  echo "clicca sul punto della mappa di input"
  d.where > coord_1
  coord_mark_1=`cat coord_1 |head -n 1 | awk -F " " '{ print $1 }'`
  coord_mark_2=`cat coord_1 |head -n 1 | awk -F " " '{ print $2 }'`
  coord_mark=`echo $coord_mark_1,$coord_mark_2`
  d.mark -m at=$coord_mark symbol=triangle color=241:0:0 fcolor=yellow
size=12

Now I have to try and make other improvements.

Thanks

Gabriele
--
View this message in context: http://www.nabble.com/v.coordinate.sh---improve-this-script--tp15063748p15086652.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Hamish wrote:

> 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.
...
> http://www.nabble.com/file/p15063748/v.coordinate.sh v.coordinate.sh

error on line 92:
if [$vettoriale2 == '']; then

Note that "[" and "test" use "=" to check for equality, not "==".

--
Glynn Clements <glynn@gclements.plus.com>