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

2009-04-07 Thread Moritz Lennert

On 06/04/09 21:27, Patton, Eric wrote:

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


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) ?

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


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

2009-04-07 Thread Hamish

 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


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

2009-04-07 Thread John Stevenson

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.steven...@manchester.ac.uk 


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


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

2009-04-07 Thread Hamish

John Stevenson wrote:
 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.

you might try 'd.out.file format=geotiff' for that


Hamish



  

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


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

2009-04-07 Thread Patton, Eric



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.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

2009-04-07 Thread Hamish

Eric:
 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,
]

gdalinfo will do all that for you from the geotiff, or from g.region at
time of export.

beware the dreaded cell-center vs grid-center convention issues.

 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. 


Hamish



  

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


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

2009-04-07 Thread Dylan Beaudette
On Tue, Apr 7, 2009 at 2:58 AM, John Stevenson
john.steven...@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
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

2009-04-06 Thread Patton, Eric
I'll post here before checking on the GMT list; hopefully I can get some 
answers from a GRASS/GMT guru...

I've exported a tiff from GRASS using r.out.tiff -t, producing a worldfile in 
the process. I then converted the tiff to an 8-bit Sun raster image using 
Imagemagick's convert utility (GMT will only import imagery in this format). So 
far so good, the image looks fine. My question is how do plot the Sun raster so 
that it is correctly georeferenced on my GMT basemap? The GMT program psimage 
doesn't have a -R flag with which I may feed it geographical coordinates! And 
grd2image is only used for gridding xyz data, not for plotting georeferenced 
images. 

I already wrote a bash script to extract the upper left coordinates from the 
worldfile and then convert these positions into GMT-style -R flag like this:

Worldfile:
  10.000 
   0.000 
   0.000 
 -10.000 
  710175.000 
 5418295.000

Output from my script:

-54.160355/48.399269/-53.359791/48.860100

But can this information actually be used to imoprt the Sun raster? 

Sorry for the off-topic post. I know there are a few GMT users in the GRASS 
community, and maybe they have encountered this problem before.

Thanks,

~ Eric.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user