=============================================================================== ============== DOQHEAD TOOLKIT ==================== ============== TO CREATE .HDR HEADER FILE FOR USGS DOQ ==================== ============== 06/22/98 ==================== =============================================================================== ---------------- QUICK ARC USAGE: (See RUNNING TOOL FROM ARC/INFO section below for details): ---------------- (Individual mode): Arc: &r doqhead Or (Mass-process mode): Arc: &r doq_masshdr {xshift} {yshift} -------------------- QUICK NON-ARC USAGE: (if running on PC Windows 95/NT): -------------------- Refer to TOOLKIT FILES section below for a list of all files. The following PC executables, compiled for Windows 95/NT4.0, will work from a command-line prompt and do not require ARC/INFO. ## (For all keyword-header DOQs, both B&W (BIL) and Color (BIP)): doq2archdr_nt.exe Ex: doq2archdr_nt.exe o118305.nes o118305.hdr (Note: image extension need not be .bil for executable, but must be renamed to .bil if using image in ARC or ArcView) ## (For older non-keyword-header B&W (BIL) DOQs): bilhdr_nt.exe < 27 | 83 > Ex: bilhdr_nt.exe morrison 83 0 0 (Note: executable assumes .bil as image name) ## (For older non-keyword-header Color (BIP) DOQs): doq2bip_nt.exe < 27 | 83 > Ex: doq2bip_nt.exe c118355 83 0 0 (Note: executable assumes .bip as image name) INTRODUCTION: ------------- Creates a separate header file (.hdr) for USGS 1:12,000-scale DOQQ image files. DOQQ is Digital Orthophoto Quarter Quadrangle, i.e. each image covers 1/4 of a 1:24,000-scale quadrangle. The tool also works for any other scale DOQ (eg. for Alaska 1:25,000-scale DOQQ images). DOQQ images are typically black & white, but also may be mutli-band color (color infrared, true-color, etc.). Black and white files are stored in band-interleaved-by-line (BIL) format, while color DOQs are stored as band-interleaved-by-pixel (BIP). FILE SIZE: B&W BIL DOQQs are typically 40-70 Mbytes, while multi-band Color BIP DOQQ are upwards of 150 Mbytes each. These sizes are for ONE-QUARTER of the quadrangle's extent. Both BIL and BIP image formats are supported in ARC/INFO, but ARC requires each image to have a separate ".hdr" file containing pertinent georeferencing and cellsize information. This DOQHEAD toolkit creates these ".hdr" files by reading the ASCII information at the beginning of the DOQ file, and populating the separate .hdr file. This DOQHEAD toolkit supports both BIL (black & white) and BIP (color) DOQ images, as well as images with ASCII header information in both the new KEYWORD format (implemented by the USGS around mid-1997 or later) and the old coded (non-keyword) format. USGS DOQQ files have a header which contains coordinate information on NAD27 and NAD83 image positions, and product information. Unlike ERDAS image files, this header "record" may vary in length. The C programs bilhdr and doq2bip (or, doq2archdr_nt.exe, bilhdr_nt.exe and doq2bip_nt.exe if running on Windows NT) read the DOQQ header information, and construct an ARC/INFO-compatible header file which contains information on the image size and upper-left pixel coordinate, and byte length of the header record. If possible, run this toolkit in ARC/INFO. The ARC AMLs and menus check for new vs. old DOQ header formats and automatically rename the input image as either ".bil" or ".bip", which ARC requires. For the new ASCII DOQ header format, an AML (doqnewhdr.aml) creates the .hdr file for both BIL and BIP. For the old ASCII DOQ header format, two C programs are used to create the .hdr file (bilhdr for BIL images, doq2bip for BIP images, or if on NT, bilhdr_nt.exe and doq2bip_nt.exe, respectively). These C programs can be run stand-alone if desired, but they assume the input image already has a .bil or .bip extension, and they only work on the old DOQ format. The C program doq2archdr_nt.exe will work on all keyword-header DOQs, both BIL and BIP. To run the C programs without this packaged AML toolkit, refer to the two README files "bilhdr.readme" and "doq2bip.readme". If running in mass-process mode (see step 5b below), then the raw DOQ files must be named with the proper file extensions: ".bil" for B&W DOQs, and ".bip" for color DOQs. This is not a requirement if running in individual mode (see step 5a below). ******************************************************************************** ************************** RUNNING TOOL FROM ARC/INFO ************************* ******************************************************************************** The DOQHEAD toolkit provides an ARC/INFO interface to manage the creation of an image's .hdr file. The existing C-executables were compiled on Data General UNIX workstations running DG/UX 5.4R.3R10. Recompile the ".c" source code if necessary, as described below: To run this procedure in Arc: 1. The source code bilhdr.c must be compiled as bilhdr (for B&W DOQs), and doq2bip.c must be compiled as doq2bip (for color DOQs), for UNIX OS's. This source code was written on the Data General UNIX (DG/UX) operating system, but should be compilable for other OS types (UNIX or Windows NT). These programs were recompiled as bilhdr_nt.exe and doq2bip_nt.exe on NT 4.0. In the case of compilation errors, the source code may have to be tweaked for the user's OS. The programs "bilhdr" (for B&W) and "doq2bip" (for color images) only work on old-header-format DOQs. New keyword-header- format DOQs are proceesed entirely by the AML program doqnewhdr.aml. 2. All AMLs and C executables can exist in the same directory as the image file. A more organized approach is to put all the AML and C programs into a separate directory, and then set the &amlpath to that directory. See Step 4 below. The AML parent programs will attach the appropriate path when calling the C programs. 3. Use ARC/INFO version 7.0 or higher. If the AML is unable to automatically define the window device (&TERMINAL), then a message will be returned, and the user will have to define the device before re-running Step 5 below. (NOTE: older versions of ARC/INFO can be used by substituting the Unix:mv command for the AML function [RENAME] in makhead.aml) 4. (Optional -- see Step 2 above) From the Arc: prompt, type: &amlpath /path/path/to/aml/code/etc... 5a. TO PROCESS ONE DOQ IMAGE AT A TIME USING A MENU INTERFACE: From the Arc: prompt, type: &r doqhead OR 5b. TO MASS-PROCESS MANY DOQs USING A USER-CREATED LIST FILE: From the Arc: prompt, type: &r doq_masshdr to see the usage, then re-run with the proper arguments. If mass-processing, then the raw DOQ files must be named with the proper file extensions: ".bil" for B&W DOQs, and ".bip" for color DOQs. This is not a requirement if running in individual mode. The DOQHEAD toolkit allows for any mixture of old-header/new-header and B&W/color DOQs all in the same location. Read the AML headers and comment lines for more specific information. ******************************************************************************** ******************************************************************************** ******************************************************************************** PROGRAM CALLING SEQUENCE: ------------------------- doqhead.aml or doq_masshdr.aml first calls makhead.mnu, and then calls makhead.aml, which in turn calls one of the following depending on B&W or color, new or old DOQ header format: bilhdr (C on UNIX), doq2bip (C on UNIX), bilhdr_nt.exe (C on NT), doq2bip_nt.exe (C on NT), or doqnewhdr.aml TOOLKIT FILES: -------------- README.DOQ -- this readme file bilhdr -- C executable, builds .hdr for B&W-Old format DOQ bilhdr_nt.exe -- C executable as above, compiled for Windows 95/NT4.0 bilhdr.c -- source code for bilhdr bilhdr.readme -- instructions on how to run C program outside of toolkit doq2archdr_nt.exe -- (NEW, not used), works on BIL and CIR keyword-header DOQs doq2bip -- C executable, builds .hdr for Color-Old format DOQ doq2bip_nt.exe -- C executable as above, compiled for Windows 95/NT4.0 doq2bip.c -- source code for doq2bip doq2bip.readme -- instructions on how to run C program outside of toolkit doq2bip_mrf.c -- (not used), another version modified for Windows 95/NT doq2bip_mrf.exe -- (not used), another version modified for Windows 95/NT doq_masshdr.aml -- main DOQHEAD parent AML to mass-process many DOQs doqhead.aml -- main DOQHEAD parent AML to individually process a DOQ doqnewhdr.aml -- builds .hdr for B&W and Color, new-format DOQ makhead.aml -- renames image if necessary, calls .hdr-building programs makhead.mnu -- user interface menu EXAMPLE .HDR FILES: ------------------- These are examples of .hdr files created by this DOQHEAD toolkit from both the new and old DOQ ASCII header formats: BIL (B&W) BIP (Color) Description --------- ----------- ----------- nrows 7640 nrows 7640 number of rows ncols 6872 ncols 6872 number of columns ulxmap 653489.00 ulxmap 653489.00 UL pixel's UTM X coordinate (meters) ulymap 3084750.00 ulymap 3084750.00 UL pixel's UTM Y coordinate (meters) xdim 1.00 xdim 1.00 image cell size X dimension (meters) ydim 1.00 ydim 1.00 image cell size Y dimension (meters) skipbytes 27488 skipbytes 82464 number of bytes of header to skip nbands 3 number of bands, BIL defaults to 1 layout bip image data format, defaults to bil NOTE: skipbytes = ncols x nbands x 4 for pre-keyword-header DOQ files skipbytes = ncols for keyword-header DOQs Ex: skipbytes = 6872 x 1 x 4 = 27488 (pre-keyword format, B&W image) skipbytes = 6872 x 3 x 4 = 82464 (pre-keyword format, color 3-band) skipbytes = 6872 (keyword-header B&W or color image) MISCELLANEOUS: -------------- The bilhdr C program was extracted from the USGS NMD Digital Revision and Product Generation (RevPG) system. The interface was extracted from NMD Research Project 5880-23281, "Generalization Tools for GIS II" David E. Catts Branch of Research, Technology, and Applications Rocky Mountain Mapping Center National Mapping Division, U. S. Geological Survey Phone: (303) 202-4320 PC-EMail: dcatts@usgs.gov Unix-EMail: dcatts@avsrvr-1.cr.usgs.gov Fax: (303) 202-4354 Mail: Mail Stop 516 P.O. Box 25046 Denver Federal Center Lakewood, CO 80225-0046 Refer to the individual program headers for authors of specific AML and C files. The doq2bip C program was written by Steve Helterbrand (573) 308-3624 whelterbrand@usgs.gov (MCMC) The additional Color and new-header functionality was added in April 1997 by John Kosovich (303) 202-4301 jjkosovich@usgs.gov (RMMC) The mass-processing capability was added in January 1998 by John Kosovich (303) 202-4301 jjkosovich@usgs.gov (RMMC) A fixed version of the doq2bip_nt.exe program was placed in toolkit June 1998. compiled by: Steve Helterbrand whelterbrand@usgs.gov (MCMC) replaced in toolkit by: John Kosovich jjkosovich@usgs.gov (RMMC) The doq2archdr_nt.exe C program was added to the toolkit in June 1998. written by: Brian Maddox bmaddox@usgs.gov (MCMC) tested/spec-ed by: Steve Helterbrand whelterbrand@usgs.gov (MCMC) included in toolkit by: John Kosovich jjkosovich@usgs.gov (RMMC)