[GRASS-user] Off Topic: Importing GRASS tiffs to GMT
Patton, Eric
Eric.Patton at NRCan-RNCan.gc.ca
Tue Apr 7 09:21:09 EDT 2009
>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.
More information about the grass-user
mailing list