English

How To: Create a world file from a GeoTIFF image using ArcInfo Workstation

Summary

The geospatial information contained in the GeoTIFF file can be used to generate a worldfile.

There are third party utilities that can be used to extract worldfile information from a GeoTIFF image. A search on the internet can locate these.

If ArcInfo Workstation is available, the procedure described herein provides another approach.

Procedure

The following AML extracts the spatial information from a GeoTIFF image and creates a worldfile. To make this function available from any Arc session, regardless of workspace, copy the AML in the $ARCHOME/atool/arc directory.


Code:
/* worldfile.aml 1.0 Sep 7 '00
/*********************************************************************/
/* NAME: worldfile.aml
/* MODULE: Arc
/* PURPOSE: Extracts the spatial information from a GeoTIFF image
/* and creates a world file.
/*
/* Usage: WORLDFILE <In_Image> {Out_Worldfile}
/*
/* - When no Out_Worldfile name is specified, the name of
/* the input image will be used.
/* - The AML will not overwrite an existing world file.
/*
/* Note: Do not use .tfw extension on output worldfile name. It
/* will be applied automatically.
/*
/* This is not an ESRI supported AML. Please use at your own risk.
/* Also, please make a backup of your data before running this AML
/* and carefully check the output. This is just a skeleton AML with
/* no real error checking. It is meant only as a guide to developing an
/* AML specific to your data inputs and desired outputs.
/*********************************************************************/

&args in_image out_wrld

&if [null %in_image%] and [null %out_wrld%] &then &goto usage

&if [null %out_wrld%] &then &do
&sv out_wrld = %in_image%
&end

/* check if file already exists
&if [exists %out_wrld%.tfw -file] &then &do
&type ' Specified output worldfile name already exists.'
&return
&pause
&end

/* obtain spatial parameters of image
&describe %in_image%

/* calculate values to be used in output worldfile
&sv xdim = %IMG$DX%
&sv ydim = %IMG$DY%
&sv xul = [calc %IMG$XMIN% + [calc %IMG$DX% / 2 ]]
&sv yul = [calc %IMG$YMAX% - [calc %IMG$DX% / 2 ]]

/* write world file
&sv worldfile = [open %out_wrld%.tfw openstat -write]
&sv writestat = [write %worldfile% %xdim%]
&sv writestat = [write %worldfile% 0.000000000000]
&sv writestat = [write %worldfile% 0.000000000000]
&sv writestat = [write %worldfile% -%ydim%]
&sv writestat = [write %worldfile% %xul%]
&sv writestat = [write %worldfile% %yul%]
&sv closestat = [close %worldfile% ]

&return

/* display usage
&label usage
&type ' ' Usage: WORLDFILE <In_Image> {Out_Worldfile}
&return