Canada Heightmap Help/Request!!!

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
Posts: 1
Joined: 04 Jul 2019 04:12

Canada Heightmap Help/Request!!!

Post by KMoore »

After messing around with the Canada scenario I found on the content downloader, I was feeling rather cramped on the maps 1024x1024 size.

Seeing as Canada is a huge country with cities and industry fairly space (with some area's being fairly dense like around Vancouver, Calgary, Southern Ontario and Southern Quebec) it just feels wrong having everything so close and cramped

I really want to make a HUGE scenario, perhaps 4096x4096 so I can have the major land features of Canada including the Rockies and waterways.

I already tried looking for DEM/Elevation data stuff for Canada but I just can't figure out how to use anything, plus I dunno how to get a WHOLE map of Canada. Also I dunno if I can even make a map large enough for my needs with my computer.

(3 month old) Windows 10 PRO x64, AMD Phenom II x4 965 (3.4Ghz), 8GB RAM. My computer slows down when trying to edit 4096x4096 and larger pictures in or gimp

I was wondering if someone could help me generate my own huge height map of Canada or if someone could perhaps generate one for me @ 4096x4096 size.

Any help would be greatly appreciated.

User avatar
Posts: 7207
Joined: 28 Sep 2009 17:15
Location: Eastern KY

Re: Canada Heightmap Help/Request!!!

Post by kamnet »

First, you'll want to obtain the DEM files. I would suggest using the 30x30 (90m) files instead of the 5x5 (3m) files, since the 90m is only 4 images to grab versus 50 for the 3m tiles, plus the Canadian files are incomplete since SRTM didn't take photos of all of Canada. Download from here:

Second, you'll want to read this guide on how to use MicroDEM to thin the data and make the file sizes smaller: viewtopic.php?p=1218889

Third, yes this is going to bog down your PC. You're effectively trying to re-create 1/4 of the globe. ;) Be patient and take your time. This is not going to be something you get done in a few days, honestly it will probably take you at least a few weeks.

Here's how I'd go about doing it. Start with editing one SRTM file. Open it in your image editor, and break it down into 4 smaller file sizes. Export each to a grayscale PNG. Then take one individual file, open it in OpenTTD's scenario editor, make tweaks to the landscape, export that back out to a new files. If you need to make further tweaks between your image editor and OpenTTd, do that. Just be careful not to overwrite your source material from the previous edit. I would also look at a command-line tool to stitch the finished images together so that it doesn't bring your PC to a standstill. It's still going to chew up all your processor and RAM, though.

User avatar
Posts: 2482
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: Canada Heightmap Help/Request!!!

Post by Pyoro »

I'm probably misunderstanding something, but how the heck is a 4096x4096 picture slowing down a modern PC? Especially gray scale; that's probably not even 2MB ^^;

Posts: 10
Joined: 28 Jun 2019 20:15

Re: Canada Heightmap Help/Request!!!

Post by SteveF2 »

I've had a bit of a play with this, but I'm not sure you'll really be interested in the results; I've only been able to make a 4096x1024 heightmap of southern Canada, not a 4096x4096 heightmap of the whole country.

I downloaded the four tiles covering Canada from as recommended by kamnet. These don't cover northern Canada, which isn't great for your purposes. (I originally tried downloading the whole of Canada at high resolution via the 'eio' tool, but I got told I was downloading too much data. I could have worked round this, but it seemed unfair, and I certainly didn't want to breach the terms of the site hosting the downloads then post the results in public... I don't know if that data is actually any better, I never got hold of it.)

Anyway, I then shrank the data down to 7% of the linear resolution, joined the tiles together and tweaked the heights to be 8-bit grey values instead of the 16-bit heights in the original data. (To be absolutely honest, the heights in the attached files might actually only have 7-bit resolution, but unless you use >128 height levels in OpenTTD when loading the heightmap you'll never notice.)

There seem to be some voids (areas with no height measurements) indicated in the original data; these are small and I'm not too sure they really are voids, but I thought I'd better not gloss over them. uncropped-showing-voids.png is a greyscale heightmap (10088x2522 resolution) but with the voids coloured bright red. You probably can't load this directly into OpenTTD, but if you replace the voids (eg with pure black) it should be usable - you'll need to crop out and rescale a suitable region, unless OpenTTD can handle a 10088x2522 heightmap.

cropped-4096x1024.png is a 4:1 region cropped out of uncropped-showing-voids.png with the voids converted to pure black, i.e. sea level, and scaled to 4096x1024; I think this includes all the Canadian territory present in the original data at as high a resolution as possible. The southern bit of Canada for which data is available is too long and thin to have a 4096x4096 heightmap. If you wanted you could probably include more of the US and have a 4096x2048 heightmap by cropping uncropped-showing-voids.png yourself.

You'll need to do some tweaking to get the many large lakes in Canada to appear; I'm guessing they aren't *quite* at sea level and so don't appear as pure black in the heightmap PNG and so OpenTTD doesn't treat them as sea. You may be able to do some tweaking of the greyscales using gimp or similar (squash nearly-black-but-not-quite shades down to pure black) and have those created as sea automatically when you load the heightmap. I haven't really played around with this.

I don't know if this is any use to you or anyone else, but I thought I'd share what I have. For licensing purposes, please treat this as you would data downloaded directly from; I'm not going to try to impose any additional conditions.

Some brief technical notes for anyone else who wants to play with this:
  • I used GraphicsMagick ( to do the image rescaling; I only have a 4GB machine so I needed something memory efficient to work with.
  • I downloaded the tiles in the zipped .tif format.
  • To shrink the tiles I used the command: gm convert cut_n30w150.tif -sample 7% cut-n30w150-sample-7pc.tif I think it's important to use -sample to shrink as it doesn't interpolate and this prevents the mid-grey sea-level pixels (which are sort of 32.7km high) interpolating with land around the coasts and causing bizarre artefacts.
  • Do that for all the tiles. Concatenate with: convert +append cut-n30w150-sample-7pc.tif cut_n30w120-sample-7pc.tif cut_n30w090-sample-7pc.tif cut_n30w060-sample-7pc.tif cut-append-7pc.tif
  • Use some good tool to rescale the 16-bit heights in cut-append-7pc.tif if you have one. If you don't, the attached Python program just about works. (You can't use gimp for this, as it only handles 8-bit greyscales and throws away too much data when it imports the image.)
  • You can then load the uncropped-showing-voids.tif file produced by into gimp and save it out as a PNG, then crop and scale to get an actual heightmap for use with OpenTTD.
(4.64 MiB) Not downloaded yet
(941.58 KiB) Not downloaded yet
(654 Bytes) Downloaded 23 times

Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 6 guests