If a world file exists, it will be ignored. The same information is
obtained from the geoTIFF tags.
Overall design:
Flow diagram:
GEOTIFFIN
|
|---GTIF
| |---c_inlas
| |---getpar
| |---mount_cd
| | |-----c_tpopen
| |
| |---process_band
| | |
| | |-----XTIFFOpen
| | |-----fopen
| | |-----fwrite
| | |-----bip2bil
| | |-----fwrite
| | |-----fwrite
| | |-----TIFFClose
| | |-----fclose
| |
| |---c_tpclos
| |---lng2tae
|
|---GTIF2DDR
| |
| |---c_inlas
| |---g2d_getpar
| |---XTIFFOpen
| |---geographic
| | |
| | |---get_coordinates
| | |---get_datum
| | |---update_ddr
| | | |---c_intddr
| | | |---c_getddr
| | | |---c_recalc_pixel_size
| | | |---recalc_corners
| | | |---c_rtcoef
| | | |---convert_window
| | | |---c_putddr
| | | |---c_intbdr
| | | |---c_putddr
| | |
| |---utm
| | |
| | |---get_datum
| | |---get_utmzonegen
| | |---get_zone_datum
| | |---update_ddr
| | | |---same as geographic
| |---stpl
| | |
| | |---get_stateplanezone
| | |---update_ddr
| | | |---same as geographic
| |---tm
| | |
| | |---get_datum
| | |---c_getdatum
| | |---c_recip2minor
| | |---c_get_spheroid
| | |---c_degdms
| | |---update_ddr
| | | |---same as geographic
| |---alaska
| | |---same as tm
| |---om
| | |---same as tm
| |---mercat
| | |---same as tm
| |---lamcc
| | |---same as tm
| |---lamaz
| | |---same as tm
| |---albers
| | |---same as tm
| |---azmuth
| | |---same as tm
| |---equidc
| | |---same as tm
| |---stereo
| | |---same as tm
| |---ps
| | |---same as tm
| |---eqrect
| | |---same as tm
| |---gnomon
| | |---same as tm
| |---miller
| | |---same as tm
| |---ortho
| | |---same as tm
| |---poly
| | |---same as tm
| |---robin
| | |---same as tm
| |---snsoid
| | |---same as tm
| |---vgrint
| | |---same as tm
| |---TIFFClose
|
|---SORT_BANDS
| |
| |---c_inlas
| |---sb_getpar
| |---lng2tae
|---TRANSLAS-IN
|---GTIF2DDR (same as above)
|---UMNTCD
|---CMDEL-F
Algorithm:
Error check the WINDOW parameter.
If the user did not specify WINDOW but specified UNITS, set the UNITS
value to LS.
Read tiff files from CD or disk and process them to bil files needed for
translas-in
Error check COMMENT and INFILE parameters
Begin Loop
If CD(s) was specified ask operator to mount CD
get drive name
Retrieve list of tiff files from data path supplied by user (for disk)
or use the drive name for the path (for CD path)
If the user specified no bands, then all bands will be processed
Copy all tiff's in tiff_file_ary to files2process
If next_vol_bands does not exist
(Note: this means that the tiff file are either being read from
disk or the first CD.)
If the user specified bands
copy them from long_bands to char_bands
Copy all char_bands to bandnum which will be passed to TAE
else if next_vol_bands does exist
(Note: next_vol_bands is for CD only. It should contain all
the bands the user requested that do not exist on
the first CD and need to be found on the next CD(s))
copy the next_vol_bands to char_bands which will be used
to process tiffs on the next CD
If the user specified BANDS, then compare the bands (char_bands)
with each file in tiff_file_ary until all bands requested are copied
to files2process. If char_bands contains a band that does not
exist in tiff_file_ary then copy that band to next_vol_bands.
Process the tiff files in process_band
open the TIFF file
retrieve tiff tags that are necessary to process the
tiff file and the ones not common to all tiff files
retrieve data type
retrieve pixel size
retrieve number of lines
retrieve number of samples
retrieve number of bands
retrieve planar configuration (bip or bil)
Create the output bil file name
Open the output bil file
inform user of the bil file ready to be processed
Check if the tiff image is tiled or not
if not tiled it is striped. Allocate memory needed
for a line and copy the strip image data to the
output flat file.
if tiff is BIL then process
else if tiff is BIP
then convert the bip to bil and
process BIL
free memory
else if tiled
Allocate memory and copy the single band
tiled image data to the output flat file
free memory
Close the input and output files
Copy the output information from tiff keys into arrays that will be
passed to TAE.
Count the total number of elements that will be passed to TAE
Empty the tiff_file_ary and files2process arrays in case it is
necessary to loop through again.
If CD
If user did not specify bands then all bands will be processed
on all CD's that were requested
if its the last CD the user requested leave mounted
and open.
else close the CD and end loop
if bands were specified use next_vol_bands and comment to
close the CD, close all but the last one and end loop
else if not CD
end loop
End Loop
if there are bands the user requested but they do not exist, update the
nbands, bandnum and outimg and create new ones. Also warn user of the
nonexisting bands.
If bands was not specified by user, we then need a list of all the
bands. Get the band numbers from the outfiles array (which contains all
files on all CD's or all files on disk and copy to bandnum which will
be passed through tae
If nbands was not specified by the user, then nbands and totbands needs
to be given the total number of bands that are on CD(s) or disk
All bil files are processed now. Number of samples will determine the
size of the image. Separate the num_samps array into a temporary two
dimensional array. nbands will decide how the temp_array is grouped.
Using the temporary array, assign a group number to each separate image
size. Group will determine which files will be "grouped" together and
ingested trough TRANSLAS-IN.
The user may not know how many image sizes are in a scene, therefore
may not request enough outs. Since we cannot put two bands of different
sizes (or resolutions) in the same output image, then create one using
the "_r#" extension.
Check the outtiffs array. If this array is empty then the files requested by
the user do not exist.
Output landsat7 and cd flag, number of lines and samples, and array of
resolutions. Also, the number of bands, the groupings, band numbers
and the array of bil, geoTIFF and output file names. Finally, output
the path to the CD, the input data type, and the sceneid. Pass all
of these values to TAE.
Find total bands for each group of the input bil files
Group the bil and tiff files according to their assigned group number
begin loop
start with the first group
bubble sort the group bil and tiff files within their assigned groups.
If windowing was specified and the UNITS are either DEG, DMS or PRO then
convert them to LS.
If CD, retrieve the file names on the CD that is currently mounted and
Read that tiff file for the common geographic information.
Open the TIFF file
Retrieve keys that define the projection
Get the projection specified tags and keys.
Convert the window values to line/sample
Close the input file
If the user specifies only the starting line and starting sample and not
the total line or total samples, in the WINDOW parameter, then add the
total lines and samples to the window array
Sort the bands in ascending order and add the windowing parameters to the
bil files if necessary.
If band numbers exist
sort file in ascending order
else if band numbers do not exist
then there only one tiff file with no band specification in the
tiff name. Sorting is not necessary
Add window to bil file name if window exists
Output values to TAE
Run TRANSLAS-IN
Now that the LAS image is created add necessary geographic information
to DDR
If CD, retrieve the file names on the CD that is currently mounted and
read that tiff file for the common geographic information.
Open the TIFF file
Retrieve keys that define the projection
Get the projection specified tags and keys.
Update ddr with the necessary information
If there another group of files that need to be processed loop again
else break out of loop
end loop
If a CD is currently mounted unmount it and delete the intermediate bil file(s)
If an error occurs
delete bil file(s) and unmount current CD.
Module Design(s):
PARAMETERS:
- COMMENT
- This is the mount message to issue for the CD's to be mounted.
This should only be entered when the source data is CD.
For multi-volume CD's, a message should be specified for each
volume to be mounted.
- INFILE
- Pathname of input file for CD's and disk. When on CD's, the path
returned by the mount request must be added to this path.
- OUT
- List of output file names. If NBANDS is specified, the number of
entries in OUT must equal the number of entries in NBANDS. If NBANDS
is not specified and a single OUT file name is provided, all the
output bands with the same resolution will be placed in the same
file (with the _r# appended to the name for multi-resolution.)
- BANDS
- BANDS is the list of bands to process. The band numbers are the
band numbers assigned to the image files by PDS when it creates the
products. BANDS defaults to all bands present if it is not
specified.
- NBANDS
- NBANDS specifies how the bands in the BANDS parameter should be
grouped together when creating the output files. For example, if
BANDS=(1,3,2,4) and NBANDS=(2,1,1), three output files will be
created with the first output file containing bands 1 and 3, the
second containing band 2, and the third containing band 4. If
NBANDS is specified, BANDS must be specified and the number of bands
in BANDS must equal the sum of the bands in NBANDS.
- WINDOW and UNITS
- Allows sub-windowing of the image files. The WINDOW is an array with
four members. The UNITS parameter may be set to LS (line/sample),
DEG(degrees), DMS(degrees-minutes-seconds), or PRO(projection). When
UNITS is LS, the WINDOW parameter is interpreted as (SL,SS,NL,NS).
For all other values of UNITS, WINDOW is interpreted as
(ULY, ULX, LRY, LRX). If only a portion of the window intersects
with the image, truncate the window to the image. If the window
does not intersect the image, it is a fatal error. If only the first
two window parameters are entered, default the last two to include
the rest of the image.
- ODTYPE
- Data type to use for the output image. Legal values are SAME, BYTE,
I*2, I*4, and R*4. The default is SAME.
REFERENCES:
1. Dr. Niles Ritter (formerly of Jet Propulsion Laboratory)
Mike Ruth, SPOT Image Corp, Product Development Group
GeoTIFF Format Specification, specification Version 1.8.1, Available at:
http://home.earthlink.net/~ritter/geotiff/spec/geotiffhome.html
2. Earth Science Data andInformation system (ESDIS) Level 1 Product
Generation System (LPGS) Output Files Data Format Control Book, Volume 5,
Book 2 May 1999
RETURN VALUE(S):
E_SUCC succsess
E_FAIL failure
Testing criteria:
- Test GEOTIFFIN then LAS2GEOTIFF on same image
- Test with geoTIFF images of each datum and projection
- Test for unsupported projections
- Test unsupported image format
- Test with images greater than 2 gigabytes
- Test with multi-resoulution data sets
- Test sub-windowing
- Test with the different media: CDROM and disk
- Test with files split over volumes
- Test for error conditions