Creating elevation data

This week I did some work on creating elevation data for our Dutch NL2000 scenery. I would like to share the challenges and solutions I encountered.

For the NL2000 scenery we have been looking for replacement elevation data for quite a while already. The default FSX elevation data is OK, but it is not really detailed. Although the Netherlands is not mountainous, it would be nice to see more detail in the hills and dunes.

Our first challenge was to find source elevation data that we could use. Given that it is a freeware project we we looking for free or contributed data sources. Just this week I found at that the Dutch government has made 25 meter resolution elevation data available for free. So this sounded like good news. However an examining the data a bit more, it turned out that certain parts of the data were not filtered. This means that the data does not only contain the terrain there, but also elevation points that belong to buildings and other structures. When I tried this elevation data in FSX, especially the cities turned out to have a lot of noise in the data.

So this did not look good. But fortunately a vector file was provided that contained the areas were the data had not been filtered. So using this vector data it should be possible to replace the elevation data in those areas with another source. But where to find another source?

In the end I decided to use the vector data set of the Netherlands that the government has also made available. This vector data set does contain contour lines and elevation points. So how to turn this data into raster data so I could merge it with the other set?

In the end it turned out that with GDAL this was not so hard to do. Using gdal_rasterize I could make a raster burning in the elevation data of the contour lines and elevation points. And with gdal_fillnodata I could fill the parts in between. Here are the scripts I used:

gdal_rasterize -a hoogte -a_nodata -32768 -ts 10000 10000 IsoHoogte.shp test.tif
gdal_rasterize -a hoogte HoogteOfDieptePunt.shp test.tif
gdalwarp -t_srs "+proj=latlong +datum=WGS84" -srcnodata -32768 -dstnodata -32768 test.tif test_wgs84.tif
gdal_fillnodata test_wgs84.tif test_wgs84_fill.tif

The results of gdal_fillnodata are not perfect, sometimes you can see some artifacts in the elevation data. But since I mainly wanted to use this data to replace elevation data in cities, it was not a big issue. Most cities in the Netherlands are relatively flat.

So how did I merge the two? With GDAL again. First I burned a big negetive value into the elevation data based on the vectors of the cities. And then I replaced those parts with the other dataset. Here is the script again:

gdal_rasterize -b 1 -burn -1000000 stadspolygonen.shp ahn_stad.tif
gdal_calc -A ahn_stad_wgs84.tif -B ..\top10\test_wgs84_fill.tif --outfile ahn_merge.tif --calc '(A==-1000000.0)*B + (A!=-1000000.0)*A'

The final GeoTIFF could be put in FSX very easily with resample. So that resulted in nicer elevation data for the Netherlands. As NL2000 team we are still testing the new data, but it might end up in a future update of the scenery.

ElevationStPietersberg

4 thoughts on “Creating elevation data

  1. Kevin Firth says:

    Hi Arno,

    I’m very intersted in this, but not greatly familiar or competent with things like the command line scripts you seem to have used in GDAL above 🙁 Could you explain a little more about how to go about it please, even if its just the basic outline steps and I’ll try to figure out as much as I can from that? Many thanks if you can explain it to a simpleton like me, but I’m not a programmer 🙁

    Thanks
    kevin

    • arno says:

      Hi Kevin,

      Do you have good high resolution contour lines for your area? Else it will be hard to create elevation data from them. But I can show you how to process it.

      Arno

  2. Kevin Firth says:

    Yes, I’ve been looking at doing some scenery for Jersey island. One of the problems is that there is no high res DEM data for it. From what I can gather the entire of the rest of europe has at least 5m data available, but it looks like Jersey was just missed out, no-one seems to have anything better than 30m. The only data I can find information on is 5m contour data held by the Jersey government and they’ve agreed to make it available to me along with 50cm photos, and buildings/water/land use/other GIS data layers (for a price of course). The only other option I could find available was to hire a satelite and obtain the data myself but the cost of tasking a satelite to do that (yes I did get a quote!) was in excess of $10,000 🙂 So I was very interested to read how you managed to process the contours as it might make it possible to create much more detailed coastlines and and cliff elevations than relying on less precise 30m data….

    Any assistance you can give would be greatly appreciated.
    Cheers
    k

    • arno says:

      Hi Kevin,

      In my blog post you’ll see I first use gdal_rasterize to convert the contour lines into a raster image. You need to specify which attribute contains the elevation values. That will differ per data source, in my case it was called hoogte (Dutch word for height).

      Then next step is the gdal_fillnodata to fill the areas between the contour lines. If the contour lines are far apart this might give some artifacts.

      And then you have your raster that can be used in resample.

      Arno

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.