importing TIFF files

Steve Franklin franklin at ug.cs.dal.ca
Fri Nov 20 10:00:42 EST 1992


> 
> Hello GRASS Users,
> Does anyone have experience importing tiff files into GRASS? 

It's not that hard, unless I have gravely misundestood your question...
Try this:

(already had this done)

#!/bin/sh
# This command must be executed as convert filename.tiff
# It takes a tiff file and converts it to a GRASS cell file
# It must be executed from within GRASS
# The filename MUST end with .tiff, not .tif
# This is because of the basename function, and could be modified if need be

file=`basename $1 .tiff`
# Acquire the beginning part of the filename (cut off .tiff)

tifftopnm $file.tiff | pnmtorast -standard > $file.ras
# Convert the file from tiff -> PGM -> SunRaster

r.in.sunrast input=$file.ras output=$file.cell
# This is a GRASS command
# This converts a sun raster file to a GRASS raster file

rm $file.ras
# Remove the Raster file, now that the GRASS raster file is in place

So, as you can see, you will need the pnm utilities. They simplify things
beyond belief. Of course, you could also convert a file from tiff
to sunrast via xv... Just be sure you have the latest version of xv,
or it will crop the resolution of your images needlessly (depending on their
size)

Christine, we spend most of our time with tiff -> sunrast -> grassrast
conversions. If your'e still having problems, then you're more than welcome
to mail me at franklin at ug.cs.dal.ca.

Steve Franklin



More information about the grass-user mailing list