Design Document for GEOTIFFIN

GEOTIFFIN

AUTHOR: Deb Hames

Functional Summary:

Convert a geoTIFF image to a LAS image.

Comments:

The current LAS specification does not support the following projections:
  • Oblique Mercator Laborde
  • Oblique Mercator Rosenmund or its alias Swiss Oblique Cylindrical
  • Oblique Mercator Spherical
  • Lambert Conformal Conic 1SP or its alias Lambert Conformal Conic Helmert
  • Oblique Stereographic
  • Cassini Soldner or its alias Transverse Equidist Cylindrical
  • New Zealand Map Grid
  • Transverse Mercator SouthOriented or its alias South Oriented Gauss Conformal
  • Background:

    There was a request to modify TIFF2LAS to read the geographic information from the geoTIFF keys and output it to the LAS ddr. It was later decided to keep TIFF2LAS and create a new module, GEOTIFFIN. GEOTIFFIN will ingest geoTIFF images from CD or disk. It will also support multi-volume and multi-resolution products. Other applications that support tiff and geoTIFF images are LAS2GEOTIFF, LAS2TIFF and TIFF2LAS.

    Requirements:

    
    Main Requirement:
    -Convert files in geoTIFF format to LAS format.
    
    Input Formats:
    -Support images stored in BIL and BIP format 
              -translas will not ingest BIP so convert BIP to BIL format
    -Support tiled images
    -Support image files greater than 2 gigabytes. 
    -Support multi-volume CD's 
    -Support the capability to issue a mount request for the CD instead of
     assuming the CD is already mounted and pull the path to the CD from
     the device information returned.
    -Support a minimum of 9 CDs in a multi-volume CD
    -Support projections currently in geoTIFF
    -Support input image windowing where the window can be in units of 
     line/sample (LS), projection coordinates (PRO), latitude/longitude in
     degrees (DEG), or latitude/longitude in packed degrees minutes seconds (DMS)
    -Band numbers and data source are extracted from the tiff file name.
    
    Output Files:
    -LAS image files with the associated DDR
            - The LAS format is constrained to holding a single resolution in each
              file (but multiple bands may be included in each file)
            - Merge files of the same resolution from different volumes as
              directed by the NBANDS input parameter.
            - Remove temporary BIL files created during the conversion process 
            - Sort the band list in ascending order, grouping files as directed by
              NBANDS.
            - Separate multi-resolution bands into separate LAS images. If a 
    	  specified output file name contains more than one resolution,
              the different resolutions will be placed in separate files and have
              a "_r#" appended to the output file name specified.
            - Output file names should be all lower case.
    
    

    Scope/Limitations:

  • The input GeoTiff file must be an uncompressed Grayscale, Palette-color or RGB image. 1-bit Bilevel GeoTiff files are not supported.
  • Only 8, 16, and 32-bit images are handled.
  • 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:

    
    

    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: