For a very long time, well since my ZX Spectrum days back in the early 1980s, I’ve wanted to be able to explore virtual places on my computer. Nowadays I can, and not just made up places but real places too. My recent virtual adventure took me exploring the area around Carlisle — once I’d first built it of course using some Open Data, the Unity 3D engine, some coding skills and the tech I’ve still not got bored of — my Oculus Rift VR headset.
As the rain continues to fall and parts of the UK flood, or threaten to be flooded, there is once more great interest in the lie of the land. Using a mix of the LIDAR Digital Terrain Model (DTM) and LIDAR Digital Surface Model (DSM) open data available from Data.Gov.UK as my source data and Unity to visualise it I created a simple way to wander around the landscape and explore its ups and downs where the water flows.
So what is LIDAR, DTM and DSM? To quote the metadata that accompanies the data:
‘Light Detection and Ranging (LIDAR) is an airborne mapping technique, which uses a laser to measure the distance between the aircraft and the ground. Up to 100,000 measurements per second are made of the ground, allowing highly detailed terrain models to be generated at spatial resolutions of between 25cm and 2 metres. The Environment Agency’s LIDAR data archive contains digital elevation data derived from surveys carried out by the Environment Agency’s specialist remote sensing team. Accurate elevation data is available for over 70% of England. This dataset is derived from a combination of our full dataset which has been merged and re-sampled to give the best possible coverage. Data is available at 2m, 1m, 50cm, and 25cm resolution. The dataset can be supplied as a Digital Surface Model produced from the signal returned to the LIDAR (which includes heights of objects, such as vehicles, buildings and vegetation, as well as the terrain surface) or as a Digital Terrain Model produced by removing objects from the Digital Surface Model.
Attribution statement: © Environment Agency copyright and/or database right 2015. All rights reserved.’
Before I get on to the specifics, a quick detour — or not as the case may be. No, I’ve not fallen for that all too often seen habit of not exploring what’s on your doorstep whilst being dazzled by the glamour of far off places. As parts of Aberdeen continue to fill up with water I would have liked to be able to explore locally but the LIDAR data for Scotland is not yet open data. Whilst doing my initial search for open Scottish LIDAR data for this project the closest I got was a mention in a 2013 document on the Scottish Government’s website about needing to decide how to make it available to the public sector — but no mention of making it available to us taxpayers who funded its collection. Come on, what’s the delay? Some open data is better than no open data after all. Of course there is the possibility that it is out there already and I’ve just not been able to find it but then hidden open data is as bad as closed data.
Unity lets you create virtual objects and put them in a virtual world that you can moved around as you — or the developer — wishes. One of the kinds of stock objects is called a Terrain and is basically a slab of land you can wander around. By default Terrains are flat, but with built in visual tools you can sculpt the terrain by raising and lowering parts of it. This simple technique is okay for random landscapes but not the most effective use of your time if you want to try to sculpt a replica of a real landscape.
Another way of terraforming the terrain is to use a grey scale image to act as a height map — the darker the shade the lower the land. That is a technique I used for building the virtual 1871 Aberdeen demo at last year’s CodeTheCity 5.
This time round though I went for creating the height map using the DSM and DTM LIDAR data. The downloadable data comes as ESRI ASCII raster files, for which I wrote a parser to turn them into the height map. I worked with the 1m resolution dataset and each file in that dataset covers 1km square and relates to an Ordnance Survey tile. That meant that I had to process multiple files, creating a terrain tile for each one and placing them correctly in relation to each other in my virtual space. This did leave me with some gaps though as there is not yet full coverage of England. However the gaps were small enough not to impact the final result.
The current visualisation is based purely on the height information. There is no indication of what type of terrain is at each location nor what any of the structures that scatter the landscape are. However it does provide a more solid something to wander around.
As always with these quick ‘just for fun’ projects this one is not feature complete and there are lots of nice extras that I might one day get around to implementing. Of course if someone sees a use for this and would like to help fund further development then those features will happen for sure.