DEM - How to generate EE 2 maps with GDAL

ImageImageTalking about Modding for EE2 and EE2 AOS. New maps, patches, programs and Multiplayer scenarios.
Post Reply
User avatar
Loewenherz
Posts: 174
Joined: 23 Sep 2017, 17:26

DEM - How to generate EE 2 maps with GDAL

Post by Loewenherz »

Thanks to: Schwarzer Reiter
https://ee.heavengames.com/cgi-bin/foru ... =17#post18



How to generate EE 2 maps with GDAL:

First we need to install Python and GDAL. An easy to follow guide for this can be found here:
https://sandbox.idre.ucla.edu/sandbox/t ... or-windows

Once installed, we can proceed to acquire the elevation data from which we'll generate the maps. Go to:
https://maps.ngdc.noaa.gov/viewers/grid ... index.html

Select ETOPO1 (bedrock) as data set. Select the area which you want to use for your map with the rectangle tool. You can optimise your selection by altering the coordinates in the Area of Interest field. Once satisfied with your selection download the data. You'll receive a file called exportImage.
Feel free to rename it to something more fitting, e.g. europemap. Just make sure to not use any spaces in the name. Add the file extension .tif to the file. Our example file would thus be europemap.tif. Take note of the directory where the file is located, e.g. your downloads folder.

Open now the windows command line by going to the Start Menu -> Run ->Type in cmd and hit Enter.
Type in cd followed by the directory where the .tif file is located, e.g. your download folder. Thus you should type:


cd C:\Users\User\Downloads

and hit Enter. We're now in the directory with the .tif file. Now type:

gdal_translate europemap.tif europemap.bil


and hit Enter.

A bunch of different files will be generated in the folder. Locate the file with the .bil extension, e.g. europemap.bil. Copy and paste it into your Elevation Maps folder, e.g. at
C:\Users\EE2Player\Documents\Empire Earth II\import

Change the file extension from .bil to .bin

Now create a new file in the Elevation Maps folder and give it the same name that your .bin file has, e.g. europemap.fmt. Paste this Text file now in your EE2 import Folder.

Code: Select all

input_eqv
begin name_equiv
	$minimum_value min__value
	$maximum_value max__value
end name_equiv
begin constant
	data_byte_order text little_endian
	file_title text My%Selection
end constant

ASCII_input_file_header_separate_varied	"selection header"
create_format 0 0 text 0

binary_input_data	"PC binary::elev_m"
elev_m 1 2 ARRAY["lat" 45.000000 to 35.000000 by 0.00833333333]["lon" -8.000000 to 0.000000 by 0.00833333333] OF int16 0
Now create a second text file which is now called europemap.hdr. In the generated files from GDAL is a own .hdr file. Open this file with Notepad and copy paste the following values:
BYTEORDER I
LAYOUT BIL
NROWS 2308
NCOLS 6889

NBANDS 1
NBITS 16
BANDROWBYTES 13778
TOTALROWBYTES 13778
PIXELTYPE SIGNEDINT
ULXMAP -123.983336665687
ULYMAP 55.6500018082917
XDIM 0.0166666686268745
YDIM 0.0166666686268745
... and put there in the .hdr file for Empire Earth 2.
file_title = europemap.hdr
data_type = raster
grid_cell_registration = center
map_projection = Lat/Lon
left_map_x = -123.983336665687
right_map_x = 55.6500018082917
upper_map_y = 0.0166666686268745
lower_map_y = 0.0166666686268745

number_of_rows = 1846
number_of_columns = 3401

grid_size = 0.00833333333
elev_m_unit = meters
min__value = -30
max__value = 4984
elev_m_min = -30
elev_m_max = 4984
elev_m_missing_flag = -500
number_of_display_colors = 256
data_value_unit = elev_m
data_byte_order = little_endian
If everything was done correctly you should now be able to generate a map in EE2's map editor from the .bin file we created. Have Fun. :D
At least here is a example file:
europe.zip
(20.02 MiB) Downloaded 7 times
Last edited by Loewenherz on 28 Dec 2020, 01:12, edited 1 time in total.
List of tutorials, useful threads and utilities (look here before posting): Here

Add Pics to Map: viewtopic.php?f=54&p=25184#p25184

Loews Work: viewtopic.php?f=54&t=5160

User avatar
Gonzalo
Posts: 252
Joined: 24 Aug 2018, 08:56

Re: DEM - How to generate EE 2 maps with GDAL

Post by Gonzalo »

Good job! Congratulations!!
User avatar
Loewenherz
Posts: 174
Joined: 23 Sep 2017, 17:26

Re: DEM - How to generate EE 2 maps with GDAL

Post by Loewenherz »

It works to create own Pics for EE2 import. Just create a own picture and add the size of the pic in the .hdr file. I personally use this import values.
Highland.png
Highland.png (10.19 KiB) Viewed 158 times
value.jpg
value.jpg (11.72 KiB) Viewed 158 times
List of tutorials, useful threads and utilities (look here before posting): Here

Add Pics to Map: viewtopic.php?f=54&p=25184#p25184

Loews Work: viewtopic.php?f=54&t=5160
Post Reply

Return to “EE2 files, modding, maps, testing, etc.”