Ok, firstly you'll need a reasonably beefy PC to do this, as the data crunching is quite intense.
You will need the following:
* Google Earth (http://earth.google.com)
* MicroDem (http://www.usna.edu/Users/oceano/pguth/ ... crodem.htm)
* SRTM Overlay for GoogleEarth (Run from URL once you've installed Google Earth - http://www.ambiotek.com/topoview).
* A graphics program, such as Photoshop, Paintshop Pro etc.. to covert a TIF to PNG.
* As mentioned above, a fairly beefy PC, esp. if you are trying to generate a map covering a large (continents) area.
* (I have a AMD 64x2 3800 with 2GB of ram and it can take a while on mine!)
OK, before we start, make sure you've installed Google Earth, the SRTM Overlay & Microdem.
Overview
The steps involved are to find the DEM data for the area you're interested in. Load up Google Earth (GE) and if the SRTM overlay has installed correctly, you should have an SRTM2 category in the Places list in GE. Put a tick in the box next to SRTM2 and you should see loads of boxes appear over the globe, each with a green dot in the middle.
If you click on the Green dot, you then have the option to download the DEM data for that cell. Once we have the cell(s) we need, we then need to load them into Microdem, reduce the definition of the data from really detailed to detailed enough for what we want.
Once we've done this, we then merge the thined DEM files into a complete DEM file, which we then load back into Microdem and then export it out as a TIF, convert the TIF into a PNG and then use it in OpenTTD!
Sound simple? Yes? You're mad, its not simple its a ball ache! Anyway, here goes.
Google Earth
Firstly, if you're running NT4, Windows 2000, XP or Vista, you may want to enable folder compression in the folder you're going to save the DEM files to. Zipped the Dem files are 20odd MB, unzipped they're often 150mb, by using the built in file compression within NTFS, you save a fair amount of disk space. To turn it on, right click on the folder you're going to save the DEMS to (I'd recommend c:\Mapdata\DEMs\). Select Properties & then click the 'Advanced' button at the bottom, next to File Attributes. Put a tick in the 'Compress contents to save disk space' and click OK. Done
![Smile :)](./images/smilies/icon_smile.gif)
Now, in GE locate the area you want to generate a map for - in this example I'm going to do The Carribean island of Hispanola (Haiti & the Domincan Republic).
Now, on the pic, you'll notice the two green buttons for S_22_09 and S_23_09 - these are the two DEMs we'll need.
Click on the Green buttons and you'll see a page pop up, scroll to the start of the links and you'll want to download either of the first two links (Either from the US or UK Servers, it doesn't matter), its the data file in ARCASCII format.
Save the files into the C:\mapdata\dems\ folder.
Once you've done that for both DEM cells, close GE, you don't need it any more.
MicroDem
Unzip the DEM files from their zips and then fire up MicroDem.
Click on File->Open DEM In the Files of Type box, make sure ASCII Arc Grid (*.asc) is selected, browse to the folder and select either of the two files. Microdem will now load the DEM file.
By default you get all the legends and other stuff you don't need, to turn these off. You'll only need to do this the first time, as it remembers these settings. Right click on the map & select 'Legends / Marginalia'. Click on 'Scale Bar' and untick the 'Include on Maps' box. Do the same with the Elevations button.
Then click OK to close the Map Marginalia window.
Right, by default the DEM files we downloaded are way too detailed to be of use, so we need to 'thin' them. To do this, select Raster GIS->Thin DEM (Decimate). Select a Thin Factor of 3. Then click File->Save DEM->ASCII Arc Grid. Save the file under a new name in the same location as the maps (S_22_09_Thin.asc) is a good suggestion, basically just add '_thin' to the filename.
Close the two Micodem map windows & repeat the process with the 2nd map. (Or as many maps as you need).
You should now end up with a 'thin' DEM file for each of the cells you have.
Note, the next step is to merge the DEM files into one single file. The program does have a limit to the number of columns and rows of data it can handle in a DEM file. If you find that you are exceeding this limit (default at a thin factor of 3 would result in a maximum grid of 12 cells x 12 cells. (24000x24000). If you are needing more cells then you will need to thin by a factor of 4 or even 5. Don't worry about the degration in quality of the map, as you're using so many cells it won't matter.
Ok, from the File menu select 'File->Data Manipulation'. On the new window, select 'Merge->DEMs->DEMs -- pick multiple'. Browse to the 'thin' files you saved and select them all in one go. This will add them into the merge list. When you have added the last file, click 'Cancel' on the Open dialog.
Microdem will then ask you for the name of the file to save to, save it into the same folder under the name of Hispanola.DEM (obviously change this name if you're not doing hispanola).
Close the Data Manipulation window by clicking File->Close.
Now load up the saved DEM file by clicking 'File->Open DEM', change the Files of Type list to 'Any Likely DEM'. You should now see the two DEM cells merged into one.
Right, we now need to crop the map to the area we want. On the tool bar of the Map window (not the main microdem toolbar), you'll see a button which looks like a dotted rectangle with an arrow at the bottom right (7th in from the left). THis is the create subset button, click it and then click and drag across the map area (You must click & drag from the top left to the bottom right of the area, if you do this wrong, you'll get a message anyway.).
Microdem will automatically zoom into the cropped area. If you made a mistake and cropped off an area you want, simply undo the crop (the crop operation is called a subset), by clicking the 'undo subset' button (to the right of the create subset button).
Right, now we need to change this to a grayscale map. Right click on the map and select 'Display Parameter' and then from the popup menu, select 'Elevation'.
Select 'Gray scale' from the list of radio options and then click on the Z Range button. The Z Range basically controls how the heights are mapped onto the grayscale colours, the greater the height, the lighter the colour.
Normally you'll want to select the defaults, but if you find the OpenTTD doesn't get the coast lines right, its probably because the ground is too dark and OpenTTD can't tell what's land and what's sea. If this is the case, lower the Max value until the problem goes anyway. you may also want to lower the Min Value too, as this will effectivly start 'sea level' at a lower position on the map. In this case we need to tweak these values, so enter a min of -150 and a max of 2500.
Update
I've just generated a UK heightmap and the defaults I suggested above left half of East Anglia under water. Perhaps a preview of things to come when sea levels rise!? (You could use these figures to create such an example, btw).
Anyway, I got the best results by leaving those two figures at the MicroDem suggested defaults. It may be worth trying that first and seeing what you get generated in OpenTTD.
/end update
Click OK and then OK again and the map will redraw.
Finally, we need to resize the map to 1:1 pixel mapping. To do this, on the map window's toolbar, you will see zoom and unzoom buttons, between them is a number 1 in a magnifying glass. Click this button. You may or may not get a warning about memory usage, depending on the size of the DEM data, but its not that much of an issue.
Now we need to save this out. Microdem doesn't export to PNG, so we need to export as a TIF file, a GeoTIFF to be precise. Click on 'File->Save Map as Image->GeoTIFF, screen scale'. This will automatically default to the folder c:\mapdata\Images, which is fine. Enter an appropriate name and click save.
Now fire up the image editing software, for this tutorial, I'll be using PaintShop Pro. Photoshop would do as an alternative, but its like using a sledgehammer to crack a walnut! Paintshop pro is great for simple things like this.
Paintshop Pro
Open the TIF file. The next thing we need to do is try and match the resolution of the file to the resolutions of the OpenTTD maps.
Normally you'll probably create a 512 or 1024 longest edge sized map. So you need to work out the best image size.
This particular example is pretty much an obvious 1024x512 map size. (Would be ideal if you could enter a custom map size though!)
For land locked maps (i.e. with no sea on one or more sides, its imperative that you match the image size with the map size, otherwise you'll end up with sea off the side of the map.
We can resize this map to 2048 x 1024 This will need a bit of cropping and resizing to do it, so I'll leave it up to you as to how you do this, as it will really depend on how tightly you cropped the DEM file. What I did was to resize the width to 2048 and then resize the canvas to 1024, so it added more sea to the top and bottom of the image.
Now click File->Save As and save it as a PNG file. Probably best to save this in OpenTTD's heightmaps directory.
There you go, one heightmap! Load it up into the scenario editor in OpenTTD (remembering to select the right map size, in this case a 2048 x 1024 heightmap would equate to a 2048x1024 map for the best quality, or a 1024x512 map or a 512x256 map. As long as the ratio stays the same, it will be fine
![Smile :)](./images/smilies/icon_smile.gif)
If you find that the shorelines have crept inland a bit then you'll need to go back to the step where you created the grayscale map and alter the Z range numbers abit. Alternatively, in the image editor software you could try selecting the sea, inverting the selection and altering the gamma of the land, effectivley lightening it.
As you can see from the finished map, by comparing it to the Google Earth image, it hasn't quite got the north coast quite right. its probably quite low lying land. You can either fill gaps like this in by hand or simply retweak the grayscale map and try again.
If you have any questions, feel free to post
![Smile :)](./images/smilies/icon_smile.gif)
[EDITED] - made this a sticky - Bjarni
[Updated 24th Sept 2008, reflected changes to Microdem, v10.0 Build 2008.8.11.2]
[Updated 1st July 2010, updated image URLs following server move, sorry about that - MGSteve]