[GRASS-user] Off Topic: Importing GRASS tiffs to GMT

Eric wrote:
> I'll post here before checking on the GMT list;
> hopefully I can get some answers from a GRASS/GMT guru...

Moritz wrote:

I can't help you on your precise questions, but have you seen
Dylan's article:
http://casoilresource.lawr.ucdavis.edu/drupal/node/561
(see link to pdf on that page) ?

and of course the GRASS Wiki:
  http://grass.osgeo.org/wiki/GMT

(which of course forever needs updating)

Hamish

Hamish wrote:

Eric wrote:
    

I'll post here before checking on the GMT list;
hopefully I can get some answers from a GRASS/GMT guru...
      
Moritz wrote:
  
I can't help you on your precise questions, but have you seen
Dylan's article:
http://casoilresource.lawr.ucdavis.edu/drupal/node/561
(see link to pdf on that page) ?
    
and of course the GRASS Wiki:
  http://grass.osgeo.org/wiki/GMT

(which of course forever needs updating)

Hamish

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

By a tiff, do you mean a georeferenced map? I've plotted aerial photos that I rectified in GRASS using the following to export the RGB bands:

r.mapcalc "image.red=r#image; image.green=g#image; image.blue=b#image"
r.out.bin -h input=image.red output=image.red.grd
r.out.bin -h input=image.green output=image.green.grd
r.out.bin -h input=image.blue output=image.blue.grd

Followed by:

grdimage image.red.grd image.green.grd image.blue.grd -J -R -B ...etc.

I've just put the same workflow onto the wiki. I've also used r.his to make coloured shaded relief maps, and plotted them in GMT using the same method. I don't think that it is the optimal method, but at least it preserved my colour rules.

Cheers

John

--

Dr John Stevenson
Postdoctoral Research Associate
School of Earth, Atmospheric and Environmental Sciences
Williamson Building (Room 2.42)
University of Manchester
Manchester M13 9PL, UK
tel. +44(0)161 306 6585; fax. +44(0)161 306 9361;
john.stevenson@manchester.ac.uk

By a tiff, do you mean a georeferenced map? I've plotted aerial photos
that I rectified in GRASS using the following to export the RGB bands:

r.mapcalc "image.red=r#image; image.green=g#image; image.blue=b#image"
r.out.bin -h input=image.red output=image.red.grd
r.out.bin -h input=image.green output=image.green.grd
r.out.bin -h input=image.blue output=image.blue.grd

Followed by:

grdimage image.red.grd image.green.grd image.blue.grd -J -R -B ...etc.

I've just put the same workflow onto the wiki. I've also used r.his to
make coloured shaded relief maps, and plotted them in GMT using the same
method. I don't think that it is the optimal method, but at least it
preserved my colour rules.

Cheers

John

I had forgotten about r.cpt2grass; thanks for the note, Hamish.

I found a posting by Allen Cogbill on the GMT mailing list last night,
and with a lot of clunky tweaking, worked for me:

1. Convert the .tif file to a Sun Rasterfile (I use ImageMagick).
2. Use Unix tools to read the .tfw file that accompanies the .tif
file and calculate the real-world coordinate extrema.
3. Using g.region or imagemagick's identify, list the number of rows
and columns, and along with the image resolution, calculate the N-S-E-W extents.
4. Once real-world extents are known, use your psbasemap mapping scale to calculate
image width and height on paper.
5. Pass this information to psimage -W.

As long as the region defined in psbasemap's -R flag is identical to the region
of the generated tiff from GRASS, the image will plot correctly.

John, I was trying to import colored, shaded-relief tiff images using r.out.tiff.
For whatever reason, r.out.tiff always preserves my color table as opposed to r.out.gdal.
Your solution sounds a lot easier to use than mine; I'll have to try it out - thanks!

Regards,

~ Eric.

On Tue, Apr 7, 2009 at 2:58 AM, John Stevenson
<john.stevenson@manchester.ac.uk> wrote:

Hamish wrote:

Eric wrote:

I'll post here before checking on the GMT list;
hopefully I can get some answers from a GRASS/GMT guru...

Moritz wrote:

I can't help you on your precise questions, but have you seen
Dylan's article:
http://casoilresource.lawr.ucdavis.edu/drupal/node/561
(see link to pdf on that page) ?

Which of course should be updated....

and of course the GRASS Wiki:
http://grass.osgeo.org/wiki/GMT

(which of course forever needs updating)

Sigh... on my to-do list, really!

By a tiff, do you mean a georeferenced map? I've plotted aerial photos that
I rectified in GRASS using the following to export the RGB bands:

r.mapcalc "image.red=r#image; image.green=g#image; image.blue=b#image"
r.out.bin -h input=image.red output=image.red.grd
r.out.bin -h input=image.green output=image.green.grd
r.out.bin -h input=image.blue output=image.blue.grd

Followed by:

grdimage image.red.grd image.green.grd image.blue.grd -J -R -B ...etc.

I've just put the same workflow onto the wiki. I've also used r.his to make
coloured shaded relief maps, and plotted them in GMT using the same method.
I don't think that it is the optimal method, but at least it preserved my
colour rules.

Cheers

John

Yep. This is nealry the same general approach that I use, however- I
tend to pipe the output from r.out.bin to xyz2grd.

Here is a script with a pile of commands that may be useful to some:
http://169.237.35.250/~dylan/temp/where_2.0/template.sh

... note that it could use some updating as well.

Cheers,
Dylan