0

I have just installed GDAL ver 1.11.4 and Python ver 2.7. I am trying to create a relief map using Ordnance Survey Terrain 50 ASCII data using gdal_merge.py.

Being new to GDAL, I don't know how to handle the many .asc files in the dataset. What are the tools available in GDAL to help transform these into a format like GeoTiff and merge the many separate files into one larger raster?

1

If you want to create a color shaded relief map from you .asc files, than you can use gdaldem as described below.

Firstly you will need to create a text file (`color_relief.txt') with the elevation classes and corresponding RGB values. For instance:

140 90 220 90
200 240 250 160
250 230 220 170
300 220 220 220
350 250 250 250

Where the first column is the Z (elevation value) and the subsequent three columns are the RGB values.

Then using gdaldem:

gdaldem color-relief input.asc color_relief.txt color_relief_output.tif 
1

Ordnance Survey Terrain 50 is distributed as a set of 10 km x 10 km tiles, each labeled geographically by a two-letter key (map here). There is a hierarchy to the data directory so that each tile is a directory, and within that directory there are a set of smaller tiles. I am going to assume that you just downloaded the entire dataset and have unzipped it somewhere, called root_OS50_terrain. Within that directory there is a data directory and licence.txt.

/root_OS50_terrain/
  | data/
     | hp/
     | hu/
     ...
     | tr/
        | tr01_OST50GRID_20160726.zip
        | tr02_OST50GRID_20160726.zip
        | ....

Let's say you only want the tr 10km x 10km tile. It might be easiest to merge the ascii files into a single raster and then transform that merged dem into a hillshade.

$ cd root_OS50_terrain/data/tr  # go into the tile directory
$ unzip '*.zip' -d tr_unzip     # unzip all zip files into a new directory
$ gdal_merge.py tr_unzip/*.asc -o tr_tile.tif # merge all ascii files into a geotiff
$ gdaldem hillshade tr_tile.tif tr_tile_hillshade.tif

If you need a single raster representing all the two-letter tiles, then do this procedure (except hillshade) for each 10km tile, merge these DEMs, then hillshade that merged DEM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.