Terrain Generation From Geographical Data
Contents
Introduction[edit]
Special events and historical arenas require geographically accurate terrains. Creating such terrains using TE itself or by using various graphical programs can be hard process. A special tool, created by Artyom Beilis (a.k.a. Artik), called MakeAHMap[1], significantly simplifies the process making many parts of this process automatically
The tool generates following output using geographical data:
- Accurate terrain elevations (.raw file)
- Accurate high resolution shorelines and rivers
- Appropriated ground cover (tiles) according to the geographical data set, i.e. farm, forest, dessert areas, etc. (splattype.bmp)
- Nice looking clipboard map.
Installation[edit]
Basics Installation[edit]
Download the latest zip file from http://cppcms.com/files/makeahmap/, extract it in any suitable location. Note: you need about 1GB of free space on the disk for the geographical data (which would be downloaded automatically on demand) - depending on your interests.
In the extracted folder you would find:
- config.ini - configuration file that defines all the terrain settings, by default pointing to the Battle of Britain area.
- makeahmap.exe - the main program
- makeahmap_cpu.exe - the same program but without use of OpenCL/GPU computations - in case your GPU does not support one.
You can just double click the makeahmap.exe. At the first time your run the program, the required data would be downloaded. There are 3 types of data needed:
- GlobCover database[2] - the mapping of ground types - single tif file of 375MB - the largest file.
- GSHHS[3] - shoreline and river database.
- Digital Elevation Database (DEM) - one of the three: SRTM30 or SRTM3[4].
While the entire data-set for the first two would be downloaded, only the relevant DEM files are downloaded on demand. The generated files would be placed into output directory. Once the program completes you'll need to press an Enter to close the window.
Working Cycle[edit]
The basic working cycle with MakeAHMap program consists of 3 basic steps:
- Ajdusting settings in config.ini file
- Running the makeahmap.exe, watching the output for interesting details
- Using the generated files in TE
Using the MakeAHMap[edit]
Most of the information about various configuration options can be found in config.ini itself. So refer to this file for detailed instructions.
Basic Configuration[edit]
You need to specify, the TE map name, the size of the map, the geographical coordinates of the center of the area you are interested and and the map scale:
- map_size - the size of the map in miles, one of 512, 256, 128 and 64
- map_name - the name of the AH map you selected
- tile_set - the tiles you are going to use in the Terrain editor - one of "europe", "pacific" or "mediterranean"
- lat, lon - the latitude and longitude of the central point of the terrain you are creating
- scale - the map scale, 1.0 for 1:1 maps 2.0 for AH map being twice smaller than real one, etc.
Once you configured them run makeahmap.exe, see if the map covers appropriate areas and continue.
Importing the files into Terrain Editor[edit]
Once the output is generated (files in output directory), you can import the data into TE. For this tutorial we would call the terrain "mymap". Replace it with the name you are actually going to use,
If the terrain does not exist yet, create an empty one using appropriate size and save it.
- Exit the Terrain Editor
- Run the makeahmap.exe, watch it completes the work without errors.
- Copy mymap.bmp to the "ah3terr\mymap\texsrc" folder, create one if it does not exit
- Start TE
- Import altitude map (mymap.raw) File->Import Signed Height Map
- Import splattype.bmp File -> Import Splat map
- Save
- Review the result. If needed adjust the config.ini and go to step 1 again.
Handling Water Bodies[edit]
By default, MakeAHMap would create all lakes and major rivers. AH3 requires that all water bodies would be placed at sea level, so the terrain altitudes are adjusted to preserve local gradients rather than absolute altitudes. In order to find a new optimal sea -level we stretch a 'rubber membrane' over known water bodies. Now we can gradually modify the elevations keeping all local terrain features.
It works in both ways for positive and negative altitudes like Dead Sea.
You can limit the maximal water body altitude by stetting water_alt_limit parameter in config.ini.
You can find the created water bodies in output/water_bodies.pgm and altitude adjustments in output/sea_level.ppm. In certain cases due to altitude adjustments some terrain would move to below sea level and thus would be flatten - you can observe such an areas in the file output/flatten_terrain.pgm and than adjust parameters if the result does not fit the needs.
Advanced Usage[edit]
Most of the information can be found in config.ini. In this section we would mostly review general useful options.
Selecting Digital Elevation Model Database[edit]
MakeAHMap supports 3 databases with 2 different resolutions:
- GTOPO30 and SRTM30 with 30 arc-seconds resolution: 926m/1013yards/0.58mile
- SRTM3 with 3 arc-seconds resolution: 93m/101yars
Note: currently GTOPO30 sources are offline and can't be downloaded
The SRTM3 has much higher resolution but it does not cover areas above N60 (for example areas in Canada, Murmansk etc). Another limitation of SRTM3 that is needs more disk space and more files to download.
Adjusting Ground Types[edit]
There is a predefined table of mapping of GlobCover database ground types to the AH tiles located in the resources/groundmapping directory. There may be a situation were the mapping may be wrong or better adjusted. You can create your own versions of ground mapping, putting them in this directory under alternative names and using tile_set option accordingly
River Width[edit]
Unfortunately the river database does not contain an information about river width. There is some predefined mapping of river level to river width. You can adjust it using river_width family of options. It may be useful if you want wider or narrower rivers for your map.
Clipboard Map[edit]
You can specify the colors for various parts of clipboard maps, change the way the altitude is displayed on the map - via shading or via color changes. The strength of the visual effect can be adjusted as well.
The default map grid is stored in the images directory. You can change them as well to customize the map grids.
Modifying the Program[edit]
MakeAHMap is Open Source software released under MIT license. It is hosted on github: https://github.com/artyom-beilis/makeahmap
If you want to make modification in the program you will need:
- Mingw G++ >= 4.9.
- Following libraries: zlib, libtiff, optionally but recommended OpenCL SDK
It is now known if MSVC is able to build makeahmap.
Common Problems, Issues[edit]
- I run makeahmap.exe and I get and the programs fails to start reporting missing OpenCL.dll
- It means that you don't have OpenCL drivers installed for your graphics card. Modern AMD, NVidia and Intel cards come with OpenCL support, so you may either update your drivers or use makeahmap_cpu.exe that does not use GPU for computation.
- I run the program but get an error message - "Latitude above N60 is not supported with srtm3, please use srtm30"
- It means that you try to use srtm3 data set (default) for territories that include latitude above N60 - and high resolution SRTM3 does not cover them, switch to srtm30 by setting value: dem=srtm30
- I have created a map but I see only water?
- Make sure you use correct sign for longitude, 170°W is -170.0 and 170°E is 170.0
- How do I find the latitude and longitude of the area of interest?
- Go to the google maps locate the area you need. Use measure distance feature of google maps (right click on the map - measure distance) to make sure you have proper map size and scale. Than right click on central point at the map of interest select "What's there?" and you'll see the coordinates of the point at the bottom of the map
- How to upgrade to newer version?
- makeahmap since 1.9 includes a program called upgrade_makeahmap.exe - run it and you'll get up to date version, if you have older version, download upgrade_makeahmap.exe from the web site, put it into the same directory where makeahmap.exe resides and run it.
- Alternatievly you can download the latest zip and copy all its contents to current installation overwriting existing files.
- I have a problem not listed there, how do I get help?
- Write a message on "Terrain Editor" AH forum describing your problem in as much details as possible, providing version of makeahmap you are using, your settings (lat/lon/scale etc), exact error you are getting (if any).
- I have found a bug how do I report it?
- You can open it at the GitHub issues tracker: https://github.com/artyom-beilis/makeahmap