How to make a geotiff image file from a BYU .sir file 28 May 2001 Unfortunately, incompatible tiff libraries complicate matters and lead to a need to run multiple programs to generate geotiff images. Use of the pointer file improves performance when multiple files with the same projection are processed. The following procedure uses an unmodified program (geotifcp) and a modified program (listgeo) from the geotiff distribution, along with two custom C programs (sir2geotiff_map and sir2geotiff) written for unix/linux systems to generate a geotiff image file using data from a SIR file. 1. A prototype geotiff image and its corresponding geotiff .lgo file are needed. The product file will have the same projection and size as this prototype. If you have an existing geotiff to use as a prototype, continue to to step 2. Note: ONLY proj.4-type geotiff images are supported. If you want to generate a prototype geotiff from scratch, you first need to generate a geotiff .lgo file and a conventional tiff file with dimensions of the desired output geotiff image. a) first create a geotiff .lgo file (say SPstereo.lgo). This file contains the projection information included in the geotiff file. Note that tiff image origins are in the UPPER left corner while .sir images have their origin in the LOWER left corner. b) next make a dummy tiff of the desired pixel dimensions (say temp.tif) c) create an initial geotiff image which has the same number of pixels (but which the image is not correctly projected) using geotifcp -g SPstereo.lgo temp.tif SPstereo.tif 2. Run the modified listgeo program (in the libgeotiff/bin directory) with the prototype geotiff file as input. This program generates a file with a .defn extension which is used in the next program listgeo SPstereo.tif (Creates the small file SPstereo.tif.defn) 3. Generate the geotifff->sir remapping file using sir2geotiff_map the .defn file from step 2 and a prototype (same size and projection as the .sir file to be converted) .sir file. For each output file pixel, the remapping program determines the nearest .sir file pixel. sir2geotiff_map SPstereo.tif.defn prototype.sir (Creates prototype.sir.gtpnt, can be very large) 4. Generate a ordinary (non-geotiff) tiff file from the sir file using the pixel remapping/tiff conversion program sir2geotiff and the pixel remapping file defined in step 3. sir2geotiff -g prototype.sir.gtpnt input.sir temp.tif low_val hi_val (creates temp.tif; low_val and hi_val are optional) 5. Create the final geotiff file by running libgeotiff/bin/geotifcp using the original .lgo file and the conventional tiff file from step 4. geotifcp -g SPstereo.lgo temp.tif output_geotiff.tif (creates output_geotiff.tif file) Note: for multiple files with the same .sir and geotiff projections, after the remapping file is made in step 3, only steps 4 and 5 need to be repeated for other files. The temporary files temp.tif, SPstereo.tif.defn, and prototype.sir.gtpnt can be deleted after output_geotiff.tif is produced. More information on geotiff is available from URL More information on proj.4 is available from URL More information on tiff is available from URL ******************* Compiling sir2geotiff.c and sir2geotiff_map.c The sir2geotiff_map.c program links only with csir and proj.4 libraries. The sir2geotiff.c program links only with tiff libraries. It can use older tiff (<3.5) libraries. The modified listgeo.c program uses both new tiff libraries and proj.4 libraries. The geotifcp in the standard geotiff distribution can be used. Installing sir2geotiff requires some expertise: While both proj.4 and geotiff have very nice configurtion scripts for a variety, sir2geotiff* compile scripts have to be hand modified for each platform. Code was tested with the libgeotiff-1.1.4, proj-4.4.3, and tiff-v3.5.6-beta libraries. ******************* Notes on installing libgeotiff and proj.4 Note: due to conflicts between the old (version 3.4) and new tiff (>3.4) libraries, the latest tiff library must be used with geotiff. Install-private must be used with tiff. Also, specify location of tiff and proj4 library (see configure script options) when running the libgeotiff configure script. See following note from geotiff documentation. Install tiff-v3.5.6-beta first, then proj-4.4.3, and finally libgeotiff-1.1.4. Run geotiff's configure script with options --with-libtiff= and --with-proj= with paths to the appropriate library location after the =. Contact maintainers of libtiff, libgeotiff, and proj.4 for problems with installing these libraries. Use of LIBTIFF -------------- The default configuration assumes that the public-domain LIBTIFF package for reading and writing TIFF files has been installed, with the development kit (include files). The latest version of libtiff may be found at: For this build to work you must use libtiff version v3.4beta018 or newer. If you are building it yourself, and have libtiff 3.5.6 or later, you should use the "install-private" make target of libtiff instead of "install" to install some private include files required by libgeotiff. PLEASE NOTE: Use of libgeotiff with a version of libtiff (as a shared library for instance) other than what it was compiled for is likely to result in crashes as libgeotiff depends on knowledge of the size and offsets into libtiff data structures that do change from time to time. In particular use of a libgeotiff compiled with libtiff 3.5.x include files will not work properly with libtiff 3.4.x.