blankblank blank




Converting DEM Files To .asc Format For Terrain Bender; Creating Matching Raster Overlays



In an earlier post, I covered Terrain Bender, a program that lets you create varying-angle terrain views from digital elevation models (DEMs), with optional overlay imagery, analogous to the view you get from the window of an airplane:

One problem with Terrain Bender is that the only DEM format it accepts as input is ESRI ASCII grid files, *.asc; these aren’t always easily available. But you can use the free GIS program SAGA to convert DEMs from other formats to *.asc:

1. Load the DEM into SAGA.

- If the DEM is in a standard raster format like a GeoTiff, use the Import/Export – GDAL/OGR: Import Raster module

- If the DEM is in a grid format (e.g. SRTM30 Grid, Surfer, XYZ), look in the Import/Export Grids folder for the appropriate import module, and use that to import the data.

2. Open the Import/Export Grids: Export ESRI Arc/Info Grid module, select the data loaded in step 1, and export it as a *.asc file. Terrain Bender seems to read this file successfully, as long as it’s not too large.

3/12/10: The latest version of Terrain Bender now supports more variants of the .asc format, including that created by MicroDEM.

Another problem is that Terrain Bender can be picky about the exact format of the *.asc file; if it’s not in the precise “correct” format that Terrain Bender wants, it may reject it or crash, even if that file opens successfully in other programs. You can use SAGA to “launder” the *.asc file so that Terrain Bender will accept it:

1. Load the *.asc file into SAGA with the Import/Export Grids: Import ESRI Arc/Info Grid module.

2. Export the data into a different *.asc file with the Import/Export Grids: Export ESRI Arc/Info Grid module.

Another problem is with raster image overlays, like the topo map in the image above overlaid on top of a “bent” terrain view. In order for the map to align with the terrain, the geographic extents of both have to be exactly the same, and that can be tricky. But the free GIS program MicroDEM can make this easier.

1. Load the DEM into MicroDEM.

2. Load into MicroDEM the georeferenced raster image you want to use as an overlay for that DEM in Terrain Bender. The raster image should cover at least the same geographical extents as the DEM, and preferably overlap those extents.

3. Select the DEM by clicking on it, then choose File => Match other maps => This coverage area from the menu. The raster image will be cropped to match the extents of the DEM exactly.

Note: If the “This coverage area” option doesn’t show up for the DEM, it may be a bug/quirk with the program. Click on the raster image to select it, and choose that option. Click on the DEM again, and that option should appear on the menu.

4. Click on the magnifying glass with the “1” inside on the raster map (the “No zoom 1:1 view” control); this will blow up the image to a 1:1 image pixel to screen pixel size.

5. Choose File => Save image from the menu; Terrain Bender supports all 4 image format export options (BMP, JPG, PNG, and GIF). You can now use this image as a perfectly-matched overlay for the DEM in Terrain Bender.

If the geographic extents of the raster image are smaller than those of the DEM, you’ll need to crop your DEM to reduce its extents to within the boundaries of the raster image. You can do this in MicroDEM, then match the raster image to the cropped DEM, and save the cropped DEM as well as the matching raster image. Save the cropped DEM in ESRI Grid *.asc format, but you’ll have to run it through SAGA as described above to “launder” it into a new *.asc file; Terrain Bender won’t accept *.asc files created by MicroDEM.

You’ll also need to crop out any null-elevation values on a DEM, like those on UTM DEM grids covering a lat/long area, as in this example where the black areas are null values:

BORDERS

Terrain Bender will treat these null elevation values as zero elevation, creating a “pedestal effect”.

nocropdem

Crop out the areas with null values, and you won’t have this problem.


Looking for something else? Enter some keywords below, then click "Search".    




7 Responses to “Converting DEM Files To .asc Format For Terrain Bender; Creating Matching Raster Overlays”


  1. 1 Sorbus

    Or by using VTBuilder, in the VTP suite of programs…

  2. 2 Dan Markert

    Landserf will do this conversion very easily as well. Easier interface than SAGA.

  3. 3 pguth

    Do you know why Terrain Bender does not like the ASC files from MICRODEM, in which case it should be trivial to fix?

  4. 4 Leszek Pawlowicz

    Bernie Jenny (one of the authors) asked me to send him a copy of an .asc file generated by MicroDEM, and he says that it will now read those files. On my system, another bug has popped up that keeps me from confirming this.

  5. 5 pguth

    There appears to be a new version of TerrainBender (posted today) which will read the MICRODEM files (but keeps crashing on my system).

    It looks to me like the old problem was Terrain Bender insisting on a CR/LF at the end of each each row, but it did not like my attempt to put those in.

  6. 6 Leszek Pawlowicz

    Yes, that’s the problem I’m having. Bernie says it doesn’t crash on his system; he sent me a special version with extra error tracking, and I’ve just sent him my error log.

  7. 7 Leszek Pawlowicz

    Problem with Terrain Bender was resolved, at least on my system. You need to have the very latest OpenGL drivers installed on your system; when I updated mine to the latest version, Terrain Bender worked fine.

Comments are currently closed; feel free to contact me with questions/issues.