Image Catalog Tool

The header from the ImageCatalog script within the file is:

 ' @application: ImageCatalog
 ' @precis     : A general purpose tool for working with ESRI-style image catalogs. Similar to
 '               Microsoft TerraServer's TerraCutter application.
 ' @version    : 3.0
 ' @description: ESRI Image Catalogs are a method for organising large numbers of images
 '               under a single structure that can be used as a single "theme" in a mapping application.
 '               Generally, these Image Catalogs are simple and are based on a DBF (or INFO) table
 '               whose attributes are:
 '               IMAGE - String - Full path name to the actual image file eg c:\myimages\col234\c234r123.tif
 '               XMIN - Number - X ordinate of Lower Left (LL) corner of the image in real world coordinate system.
 '               YMIN - Number - Y ordinate of LL corner of image in real world coordinate system.
 '               XMAX - Number - X ordinate of Upper Right (UR) corner of the image in real world coordinate system.
 '               YMAX - Number - Y ordinate of UR corner of image in real world coordinate system.
 '               This attribute file-base approach does have shortcomings. For example, it is not possible to
 '               "visualise" tile boundaries as vector objects. Nor is it easy to see the "extent"
 '               of the image catalog.
 '               Another limitation of ESRI Image Catalogs is that they do not require that the individual
 '               images that it references be non-overlapping. They provide no logical metadata to
 '               control tile creation or organisation.
 '               Constructing Image Catalogs is tedious and requires specialist software: Manifold
 '               provides all the required functionality to construct individual images but does not
 '               have the higher level "framework" or "ease of use" tools for constructing actual
 '               image catalogs.
 '               This Image Catalog application addresses all these issues as follows:
 '               1. Individual Image Catalogs are hosted as Drawings and exported to disk as
 '                  shapefiles whose DBF files contain the ESRI attributes.
 '                  The approach taken here is similar to UNC's MapServer: image catalogs constructed
 '                  using this tool should work within MapServer.
 '               2. An additional shapefile - called the boundary shapefile - is maintained which only
 '                  shows the outer extent of the tiles in the image catalog: this is useful in mapping
 '                  applications where one shows the boundary at small scales and only shows the image
 '                  tiles themselves at larger scales.
 '               3. Any single image catalog is defined as a logical grid (like a matrix) over a
 '                  particular piece of geographic space. Each tile or cell in the grid has a predefined
 '                  size in X and Y. The logical grid is "sparse" in that cells are not created unless
 '                  a tile exists in that logcal.
 '               4. The size information is used to construct a logical address for each cell as a col/row address.
 '                  The images resulting from each each tile are organised on disk into a hierarchical
 '                  folder structure in which folders are created for each logical column and all row tiles
 '                  in that column are stored in that folder.
 '                  This is done to minimise directory search problems which result in most operating systems
 '                  when the number of files in a directory become too large. This is still fairly coarse and
 '                  could be refined so that the rows were themselves organised perhaps into Base16,32 or 64 buckets.
 '                  Another improvement would be for the images to be organised by a Peano, Morton or
 '                  some other space curve key (this would help in DBMS based image catalogs by creating a single
 '                  searchable primary key column).
 '               5. An image catalog has attached projection information.
 '               6. An image catalog has a defined minimum precision of the pixels in each tile's image in X and Y.
 '                  New images to be inserted into a catalog can have better precision but images with worse
 '                  precision are resampled to that pixel size IF the user requests. Otherwise they are ignored.
 '               7. Image catalog metadata is managed by a CatalogRegistry table (stored on disk as a DBF file).
 '               To minimise the number of disk files all images are stored on disk as GeoTiffs. All
 '               Manifold XML files are removed after each image has been exported to disk. The XML
 '               is superfluous as the projection information is a fundamental part of the image catalog's
 '               metadata.
 '               New images to be inserted into a catalog are processed as follows:
 '               1. The logical tiles that overlay the image are constructed in the projected space
 '                  of the image catalog.
 '               2. Each tile is then processed (via 2 nested for loops).
 '               3. Image creation:
 '                  A. If an image already exists in the original image catalog it is loaded.
 '                  B. If an image exists in the output "changes" directory (see later) it is
 '                     loaded in preference to A.
 '                  C. If neither A nor B apply a new image component is created.
 '               4. A Query is constructed to select those pixels in the source image that
 '                  pertain to the new image (with sufficient overlap).
 '               5. The selected pixels (if non the tile is skipped) are then copied and pasted
 '                  to the image component representing the tile. Note: missing pixels will not
 '                  over-write existing pixels. If the selection is of one colour it is skipped if the
 '                  user ticks the appropriate box.
 '               6. The image is written to disk and an entry placed in the image catalog's drawing
 '                  if a new tile had to be created.
 '               When all tiles and images have been processed the image catalog drawing is written
 '               to disk and any related Boundary shapefile updated via an import, update UnionALL query,
 '               and export process.
 ' @usage      : Simply select the ImageCatalogTool component and run. Follow the Tab boxes to set up
 '               the required processes and execute.
 ' @requires   : The following options are required when running this script:
 '               * Fill new pixels with current colour - Off
 '               * Import data to separate folders - Off
 '               * Import empty columns in tables - On
 '               * Confirm expanding images or surfaces when pasting - Off
 ' @return     : Nothing.
 ' @tobedone   : Mosaic a selection of tiles in an Image Catalog.
 ' @history    : Simon Greener - 2003 - Converted from ArcInfo AML and Avenue.
 '               Simon Greener - 2004 - Numerous fixes.
 '               Simon Greener - Jan 2005 - Totally re-wrote using VBScript Classes. Also took advantage of new Query capabilities in 6.00 SP1.
 '               Simon Greener - Apr 2005 - Fixed bugs and improved performance using new 6.5 features.
 '               Simon Greener - Sep 2005 - Added in support for CSPreset and Allows for CatalogRegistry component to already exist.
 '                                        - Support for Logos in folder not being detected as images to tile
 ' @History    : Simon Greener - Oct 2005 - Added support for history shapefile
 ' @History    : Simon Greener - Jan 2006 - Support for image catalogs being NON-updateable if its CatalogRegistry.OutImgFldr is empty
 '                                        - Modified handling of image coordinate system parameters (bug fix).
 '                                        - Added in "Remove Projection (XML) capability"
 ' @history    : Simon Greener - Feb 2006 - Support for user definable image folder prefixes
 '                                        - Support for CatalogRegistry based RemoveXML, Resample, ESRIWorld, Image Format, Compressions and Options
 '                                        - Support for resampling existing tiles if pixelsize > desirable pixel size
 '                                        - Added in Mosaicing from Catalog and Components
 '                                        - Removed create catalog records only and tile from catalog records options.
 '                                        - Integrated Jamie Keene's work wherein a selection that contains a single colour is ignored (using flag)