[GRASS5] r.profile

Hello list,

is there a way to feed profile-coordinates into r.profile through a file
instead of stating them on the command line ?

cat mycoordinates.txt |r.profile input=foo output=bat profile=-

and similar approaches do not seem to work.

Regards,
Peter

--
Dr. Peter Löwe

Diplom-Geograph

<loewe@geomancers.net>
<peter.loewe@gmx.de>

Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner

is there a way to feed profile-coordinates into r.profile through a
file instead of stating them on the command line ?

cat mycoordinates.txt |r.profile input=foo output=bat profile=-

and similar approaches do not seem to work.

use a shell script:

for coord in `cat mycoord.txt` ; do
   east1=`echo $coord | cut -f1 -d'|'`
   north1=`echo $coord | cut -f2 -d'|'`
   east2=`echo $coord | cut -f3 -d'|'`
   north2=`echo $coord | cut -f4 -d'|'`
   echo >> output.txt
   echo "LINE: [$east1, $north1 ; $east2, $north2]" >> output.txt
   r.profile input=foo output=- \
      profile=$east1,$north1,$east2,$north2 >> output.txt
done

that assumes format of mycoord.txt is "east1|north1|east2|north2"

Hamish

Hamish, could this be incorporated into r.profile or at least provided as a script? There are many applications where this capability is needed and I am sure that many users would appreciate it (especially those who work with coastal data, including myself).

thanks, Helena

Hamish wrote:

is there a way to feed profile-coordinates into r.profile through a
file instead of stating them on the command line ?

cat mycoordinates.txt |r.profile input=foo output=bat profile=-

and similar approaches do not seem to work.

use a shell script:

for coord in `cat mycoord.txt` ; do east1=`echo $coord | cut -f1 -d'|'`
   north1=`echo $coord | cut -f2 -d'|'`
   east2=`echo $coord | cut -f3 -d'|'`
   north2=`echo $coord | cut -f4 -d'|'`
   echo >> output.txt
   echo "LINE: [$east1, $north1 ; $east2, $north2]" >> output.txt
   r.profile input=foo output=- \
      profile=$east1,$north1,$east2,$north2 >> output.txt
done

that assumes format of mycoord.txt is "east1|north1|east2|north2"

Hamish

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Helena & Hamish,

I sent Peter a test version of r.profile this morning that allows coordinates to be piped in. Basically coordinates could be provided in three ways ...

coords from file
cat mycoordinates.txt | r.profile input=foo output=bat

select coords interactively
r.profile -i input=foo output=bat

coords on command line
r.profile input=foo output=bat profile=e,n,e,n,...

If you are interested I can make this available for testing.

--
Bob

Helena Mitasova wrote:

Hamish, could this be incorporated into r.profile or at least provided as a script? There are many applications where this capability is needed and I am sure that many users would appreciate it (especially those who work with coastal data, including myself).

thanks, Helena

Hamish wrote:

is there a way to feed profile-coordinates into r.profile through a
file instead of stating them on the command line ?

cat mycoordinates.txt |r.profile input=foo output=bat profile=-

and similar approaches do not seem to work.

use a shell script:

for coord in `cat mycoord.txt` ; do east1=`echo $coord | cut -f1 -d'|'`
   north1=`echo $coord | cut -f2 -d'|'`
   east2=`echo $coord | cut -f3 -d'|'`
   north2=`echo $coord | cut -f4 -d'|'`
   echo >> output.txt
   echo "LINE: [$east1, $north1 ; $east2, $north2]" >> output.txt
   r.profile input=foo output=- \
      profile=$east1,$north1,$east2,$north2 >> output.txt
done

that assumes format of mycoord.txt is "east1|north1|east2|north2"

Hamish

I sent Peter a test version of r.profile this morning that allows
coordinates to be piped in. Basically coordinates could be provided in
three ways ...

coords from file
cat mycoordinates.txt | r.profile input=foo output=bat

select coords interactively
r.profile -i input=foo output=bat

coords on command line
r.profile input=foo output=bat profile=e,n,e,n,...

If you are interested I can make this available for testing.

This sounds like a nice feature to have in the main CVS version.

regards,
Hamish

Hello Hamish, all,

On Fri, 16 Sep 2005 14:16:16 +1200 Hamish <hamish_nospam@yahoo.com>
wrote:

> I sent Peter a test version of r.profile this morning that allows
> coordinates to be piped in. Basically coordinates could be provided
> in three ways ...
>
> coords from file
> cat mycoordinates.txt | r.profile input=foo output=bat
>
> select coords interactively
> r.profile -i input=foo output=bat
>
> coords on command line
> r.profile input=foo output=bat profile=e,n,e,n,...
>
> If you are interested I can make this available for testing.

This sounds like a nice feature to have in the main CVS version.

I second that.

best
  Stephan

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

Hello,

The modified r.profile is now in CVS. This version now accepts coordinates directly from stdin (plus the original methods). At this time it expects coordinates as space or tab seperated easting and northing. Any labels after these are ignored.

I have also added an additional flag "-c" which will output the RGB color values for each profile point. This can then be used to plot a color coded cross section.

Please give it a try and let me know if there are any problems.

--
Bob

Hamish wrote:

I sent Peter a test version of r.profile this morning that allows coordinates to be piped in. Basically coordinates could be provided in
three ways ...

coords from file
cat mycoordinates.txt | r.profile input=foo output=bat

select coords interactively
r.profile -i input=foo output=bat

coords on command line
r.profile input=foo output=bat profile=e,n,e,n,...

If you are interested I can make this available for testing.

This sounds like a nice feature to have in the main CVS version.

regards,
Hamish

The modified r.profile is now in CVS. This version now accepts
coordinates directly from stdin (plus the original methods). At this
time it expects coordinates as space or tab seperated easting and
northing. Any labels after these are ignored.

can you provide a short example? (preferably added to the help page)

I have also added an additional flag "-c" which will output the RGB
color values for each profile point. This can then be used to plot a
color coded cross section.

Please give it a try and let me know if there are any problems.

Nice, I look forward to checking it out.

It took me a little while to grasp what the new RGB flag did, but
yeah, I like it. (grabs the raster's color value at that coordinate)

One thing -- it outputs "RRR GGG BBB". While I think most places in
GRASS will understand that format, I've been trying to standardize on
"RRR:GGG:BBB". Mostly because the r.colors rules looked like:

0 255 255 255
1 255 255 255
2 255 255 255
etc.

Which is ok, but when the color values are closer to the data values
it makes it really hard to read, eg

0 0:255:0

is a lot easier for my eye to follow & my brain to register vs

0 0 255 0

or were you thinking of feeding the color values into multiple columns
to pass to external software? (vs r.profile with -g flag -> v.in.ascii
-> GRASSRGB column that d.vect and ps.map might understand and take
advantage of)

Hamish

Hello,

I have updated the help page in CVS. I have included some examples, and updated some of the other descriptions. Check it out and see if I missed anything.

You are proably right about the RGB values. I have also updated the program to now output the colors as RRR:GGG:BBB.

Check it out and let me know if you find any errors or problems.

As an example, I have attached a plot made from the RGB output. The data is display with a 15x vertical exxageration.

--

Bob

Hamish wrote:

The modified r.profile is now in CVS. This version now accepts coordinates directly from stdin (plus the original methods). At this time it expects coordinates as space or tab seperated easting and northing. Any labels after these are ignored.

can you provide a short example? (preferably added to the help page)

I have also added an additional flag "-c" which will output the RGB color values for each profile point. This can then be used to plot a color coded cross section.

Please give it a try and let me know if there are any problems.

Nice, I look forward to checking it out.

It took me a little while to grasp what the new RGB flag did, but
yeah, I like it. (grabs the raster's color value at that coordinate)

One thing -- it outputs "RRR GGG BBB". While I think most places in
GRASS will understand that format, I've been trying to standardize on
"RRR:GGG:BBB". Mostly because the r.colors rules looked like:

0 255 255 255
1 255 255 255
2 255 255 255
etc.

Which is ok, but when the color values are closer to the data values
it makes it really hard to read, eg

0 0:255:0

is a lot easier for my eye to follow & my brain to register vs

0 0 255 0

or were you thinking of feeding the color values into multiple columns
to pass to external software? (vs r.profile with -g flag -> v.in.ascii
-> GRASSRGB column that d.vect and ps.map might understand and take
advantage of)

Hamish

(attachments)

profile.jpg

Hello Bob,

On Fri, 16 Sep 2005 12:26:11 -0300 Bob Covill <bcovill@tekmap.ns.ca>
wrote:

Hello,

I have updated the help page in CVS. I have included some examples,
and updated some of the other descriptions. Check it out and see if I
missed anything.

You are proably right about the RGB values. I have also updated the
program to now output the colors as RRR:GGG:BBB.

Check it out and let me know if you find any errors or problems.

As an example, I have attached a plot made from the RGB output. The
data is display with a 15x vertical exxageration.

Cool stuff! Works great here after a short test. Bob, would you let us
know which programm produced the nice plott attached by your last email?

Cheers

  Stephan

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

Stephan Holl wrote:

Cool stuff! Works great here after a short test. Bob, would you let us
know which programm produced the nice plott attached by your last email?

I made the plot with a little TCL GUI that I had thrown together. I had hunted around for a simple plotting package that would plot the simple XY data to scale (with a set vertical exaggeration) and optionally allow RGB color input.

If interested I can make the GUI available. It probably has some bugs and could use more enhancements. Basically it loads the data and display the profile on a TCL canvas. The user can set size, vertical exaggeration, grid lines and annotation. The plot can then be saved as an EPS file. This EPS file can then be placed in a map with ps.map (eps argument).

--

Bob