Wales Terrain Map

On the wall above my desk I have a satellite image titled “Wales from Space”. I’ve probably had it for over 20 years but I still think that it’s a great picture. ( Apologies for the dodgy copy here but the paper is very glossy and difficult to photograph without reflections. ) Part of the text at the bottom left reads “… This map issued from our data ( more than 250 pictures covering all of Europe ) supplied by LANDSAT 5 an American civilian observation satellite. To build up the map of a whole country several images have to be collated.

Now that satellite image data is available under a public domain licence I wondered whether it would be possible to create my own version but also using the SRTM terrain maps to create a 3D model.

Unfortunately the short, TL;DR answer is “no, not easily”. The process I followed and the problems I found are described below but I did manage a consolation prize of a 3D model with terrain shading which is not bad I think:


Creating the model is a multi-step process:

  1. Find a way of trimming the overlay image and 3D model to the correct shape. The “Wales from Space” image uses a rectangular format including parts of England but I wanted a model of just Wales.
  2. Get the SRTM data to cover the required area. In this case the 3 arc second / 90m resolution data should be fine.
  3. Get the Landsat images and stitch them together to cover the required area.
  4. Do the usual merging and exporting of the data and conversion to a 3D model.

Note that all the commands in italics below refer to the SAGA GIS tool.

Trimming the Data

I’ve put this step first because it’s critical to creating the model. SAGA GIS has a feature to clip the models using a shapefile and this is quite a common approach. The problem is of course in creating these shapefiles. It’s possible to do them manually which is OK if you want somewhere like Utah or Colorado but a right pain otherwise πŸ™‚ Fortunately I found a suitable Creative Commons licenced file from the University of Edinburgh which did the job nicely. Thanks guys!

Using it in SAGA GIS was relatively straightforward:

  • Import the shapefile using: Tools -> Import/export -> GDAL/OGR -> Import shapes – pick the .shp file
  • Set to OSGB36 projection in this case – Geoprocessing -> Projection -> Set Coordinate Reference System ( remember to set both dropdowns to OSGB 36 )
  • Clip grids using: Geoprocessing -> Grid -> Grid System -> Clip Grids ( extent = polygon )


I’ve used the high resolution SRTM data before but in this case the lower resolution data will be fine. These are in GeoTIFF format and I imported them using: Import/Export – GDAL/OGR – Import Raster -> pick TIF file. One problem that I had was that there seemed to be one pixel gaps between adjacent files. The original files are on the left below and on the right are the same files but in OSGB 36 projection.

In either case this is a problem because those gaps will make their way into the 3D model. I’m still not entirely sure why this happens. It’s either a feature or maybe a problem with the SAGA GIS GeoTIFF import? After much fiddling with gap filling options I eventually fixed it by manually setting the values of the missing pixels. SAGA GIS has a tool: Tools > Grid > Change Cell Values [interactive] which allows you to manually edit cell values. By ticking the Show cell values box ( right ) it’s relatively easy to interpolate between the two surrounding values.

It was a slightly painful way of fixing the problem but it only took about 20 minutes so it wasn’t too bad.

Landsat Images

Landsat image data is available in the public domain, using a free login, and I’ve written about it before. The interface is quite easy to use ( right ) and it’s a case of selecting the area, date range for images and maximum cloud cover. You’re then presented with a list of possible images with thumbnails and, clicking the footprint icon, shows them on the map.

I found two likely candidates from September this year with not much cloud cover. The only problem was that it looked as if the very bottom right of the model would be missed ( yellow arrow ).

The Landsat image files have separate RGB channels and, as SAGA GIS applies some image processing on import, I found it was necessary to handle them in a particular order:

  • Using: Geoprocessing -> Imagery -> Landsat -> Landsat import with options import the B2, B3, B4 files for each downloaded image.
  • Using: Grid -> Tools -> Mosaicking create three mosaics each joining the appropriate channels of each download. At this point the format of the grids will be changed to a full colour rather than greyscale. Change the colours of the Blue and Green channels by clicking on the Colors -> Histogram Stretch -> Colors option and select greyscale from the presets option. For the Red channel change the type to be RGB composite and pick up the other mosaiced files for the Green and Blue channels.
  • Using Geoprocessing -> Projection -> Coordinate Transformation ( Grid )Β  change the projection to OSGB 36 for the three mosaics and perform the same processing with the channels.
  • If necessary, using Geoprocessing -> Grid -> Grid System -> Resampling resize the three files to match the SRTM grids, not forgetting the usual channel processing. The Red channel should now be suitable for use with the terrain model.

Note: There may be an easier way to do this and if there is I would like to know about it πŸ™‚

Having done all this I went through the processing needed to create a 3D model and there’s a screenshot of the result on the right. This has a number of problems:

  1. I was right about the missing section on the bottom right.
  2. There’s too much cloud cover really. Anybody who lives in or has visited Wales knows that there’s always cloud somewhere and it was monumentally over-optimistic to get clear skies from just one satellite pass πŸ™‚
  3. The model doesn’t look that good in my opinion. There’s not enough contrast to give the 3D effect, it just looks like a flat map. I have a 4x exaggeration on the Z axis and any more just makes it look unnatural.

On the positive side the whole process actually works so that’s something.

I did find a separate satellite pass to fill in the missing section ( left ) but this also has problems. Firstly I can’t find a way to control the order in which the images are overlapped so I get far too much cloud cover introduced from the new image. Secondly, although SAGA GIS offers a few ways to blend the edges of the images, it’s likely that a lot more manual intervention is going to be needed, for example to make sure that the exposures and contrasts are correct.

Both of these problems could ( probably ) be solved by combining the images in a photo editor before import into SAGA GIS but the Landsat files are in a GeoTIFF format and finding an open source GeoTIFF editor has proved tricky [1, 2].

At this point I decided that Landsat image manipulation was getting too complex so I moved on to …

Plan B

SAGA GIS has a number of built in terrain visualisation options. One of these colour codes the terrain depending on height with blue the lowest and brown the highest. This is initiated quite simply via the Geoprocessing -> Visualization -> GridΒ  ->Terrain Map View command. Then it’s a question of exporting the overlay image using the Tools -> Import/export -> Images -> Export image command.

In the end this option produced a better 3D model in my opinion. However I’ve not totally given up on the Landsat image route and investigating an open source GeoTIFF editor is certainly on my to-do list πŸ™‚






Posted in 3D Model | Tagged , , , , | 5 Comments

Photo #80

After what seemed like a whole month of rain during October the start of November was clear and sunny. This coincided with the sunset being visible from our garden again so I decided to have another photo session. Below are some images taken over the course of three evenings:

Evening 1

After a clear day and just as the sunset approached the clouds rolled in on the horizon. ( This was to prove a repeating theme 😦 ) However there was enough orange glow on the clouds to make it interesting and the dark cloud at the top adds an extra framing element.

Evening 2

A slightly different cloud pattern this evening and the resulting photo looks a somewhat apocalyptic / other worldly. I cropped this one a little closer and I quite like the sun’s reflection on the sea.

I hung on a little longer this particular evening to see if I could get any Blue Hour action and I was rewarded with this photo of a tree in a neighbour’s garden. This is easily my favourite over the three evenings and I love the black silhouette against the transition from orange to blue in the sky.

I had some problems with the exposure on this one and it was originally about two stops too dark. It looked fine on the camera LCD but I obviously didn’t check the histogram. God bless RAW files!

Evening 3

The clouds ruined the sunset for the third evening and the Blue Hour wasn’t much better. However I managed to find an alternative viewpoint from a different part of the garden. You’re never going to hide the electricity pylon so why not make a feature of it πŸ™‚ If only the top part of the sky was a little bluer …

Overall it was an entertaining few evenings especially as I didn’t have far to go πŸ™‚ I’ve since noticed a few more tree / pylon possibilities so expect more of these in the future.

Posted in Photography | Tagged , , , | Leave a comment