Article Title: Importing a Large Number of DEM Tiles
Article Name: GENERAL11
OS Platforms: ALL
Last Updated: 10/15/2007

TOPIC:

It is frequently necessary to import a large number of DEM tiles in order to create a mosaic with the Prepare → Patch RTG DEMS tool. This tip explains several "tricks" that make it easy to import and mosaic a large number of DEMs that have the same file format.

DISCUSSION:

DEMs are often distributed as "tiles" that span regions of a fixed and easily-managed size, such as 1 degree of latitude by 1 degree of longitude. The georeferencing of the tiles is such that they can be pieced together to cover larger geographic regions. DEM tiles from a particular source, such as the SRTM data for the Earth, typically all have the same data format. They are also typically distributed as files that have been compressed so that they require less storage space and can be downloaded more quickly.

After downloading DEM tiles from a provider, the first step is typically to uncompress each of the tiles. Most software utilities for uncompressing files allow you to select many files and then uncompress all of them as a batch. It is almost never necessary to uncompress them one at a time. For example, if you have the WinZip program installed on a Windows PC, you can select multiple files in a folder, click the right mouse button, choose the "WinZip" submenu and then choose "Extract to here". This will unzip all of the selected files as a batch process. On Windows you can: (1) press Ctrl-A to select all files in a folder or (2) hold down the Ctrl key and sequentially click on each of the files that you want, or (3) click on a file, hold down the Shift key, and then click on another file to select all files between the two, inclusive. On a Mac, the same keyboard tricks will work if you use the Command (or "Apple" or "splat" or "clover") key instead of the Ctrl key. With other "unzipping" utilties, you may be able to select multiple files to be unzipped from within the application. It pays to experiment until you find such a trick for your computer since it will save you so much time later on.

Once you have uncompressed each of the tiles you downloaded, you can then import a large number of tiles with the same DEM file format into RiverTools 3.0 as follows. First, choose the appropriate file format from the File → Import DEM menu and select one of the (uncompressed) tiles. Typically, all of the tiles to be imported will be in the same folder, but this is not strictly necessary. You will then see a dialog with the title Import DEM Dialog at the top. This dialog contains some file format information followed by text boxes for the "Filename of selected DEM" and the "Filename of output DEM". If you enter a single matching wildcard into each of these two text boxes, RiverTools 3.0 will import every DEM that is matched by the wildcard and will give it a corresponding output filename. For example, if you are importing several SRTM tiles (in .HGT format) that all have names of the form "N*.hgt" and you want them to have new names of the form "N*_DEM.rtg", you can simply enter these two strings into the two text boxes and then click OK to import all of them. Notice that RiverTools follows well-established convention by using the asterix, "*", as the wildcard character. Notice also that by changing the path in the output filename, you can cause the output files to be saved in a different directory or folder.

If you happen to know that the file format of the DEMs to be imported is a special case of the RiverTools Grid (RTG) format, then it is permissable for the input and output filepaths to be identical. In this case the original files are not changed in any way (since they're already in RTG format) and the import process simply creates an RTI (RiverTools Information) file for each of the tiles. Note that the following file formats are all special cases of the RTG format: ARC BIL Binary Raster, ARC FLT Binary Raster, ENVI Binary Raster, MOLA DEM for Mars and SRTM DEM (.hgt). (This basic format is widely used because it is so efficient.) As explained in the User's Guide, RiverTools 3.0 does not require the filename extensions of these types of files to be changed to "_DEM.rtg" in order to open them via File → Open Data Set; it only requires the existence of a descriptive RTI file for each tile.

Note that the Prepare → Patch RTG DEMs dialog makes it easy to mosaic a large number of tiles once they have been imported by RiverTools. When you click on the Add button in the Add/Remove dialog, you are allowed to select multiple files using the same keyboard tricks described above. It is often helpful to make the native file selection dialog show only files with a particular extension. This can typically be done by typing a string with a single wildcard into the "File name:" dialog, such as "*.hgt". Once you have added a set of files to the Patch DEMs dialog, you can save the list of filepaths in a plain text file by choosing Save List from the Options menu at the top of the dialog. You can then choose the Use Saved List option at a later time to rapidly add them back into the dialog. Note: In RiverTools 3.0.3 (SP3), you cannot add more than 1000 tiles to this dialog. To mosaic a larger number of tiles you will need to mosaic them into larger "tiles" and then create a mosaic of the new, larger tiles. This limitation will be removed in the next release.


If you have any additional questions or comments, please contact Rivix Technical Support for assistance.

Copyright (C) RIVIX, LLC. 1998-2021