The International Simutrans Forum

 

Author Topic: Making Simutrans Height Maps using the Tangram Heightmapper.  (Read 383 times)

0 Members and 1 Guest are viewing this topic.

Offline Spenk009

  • *
  • Posts: 242
This is a tutorial to showcase making Simutrans maps using the Tangram Heightmapper and GIMP. Positives are accurate and fast recreations of areas of the earth.
Difficulties in this method are somewhat limited scalability and therefore accuracy, areas below sea level are misinterpreted and some areas of the maps include artefacts that require manual fixing.
Coastlines are also tricky, but you can find a good solution in GIMP in the later stages.



Open the Tangram Heightmapper and find an area to make a copy of.

Enable map lines via the menu on the right (this helps with coastlines and orientation) and zoom into the area you want. Next, you disable "auto-exposure" and set a max and min elevation that seem suitable. Simutrans maps seem to be limited to 25 height tiles, so setting a lower max-elevation can be helpful when you want larger nice elevation changes throughout the map and don't mind cutting peaks short.

I'll be making a map of the island of Majorca. My height max/min in Tangram will be 1400 & 0, excluding ocean data.  As I want this map to be large, I will make three images of the island and merge them together later on.

Outline:

Use the map lines to align the coastline with your screen. Disable them and click on "export". Re-enable the map lines and use the arrow keys on your keyboard to move the map south using the map lines as guidance. You will want a small overlap so you can align the different images later on. Disable the "map lines" and press "export". Repeat until you have copied all the map's North to South you want. If you want more in the east or west, move the map accordingly and repeat.

Next we want to add all the images to one larger image. Start by opening the image representing the Northwest-most image. Extend the canvas of the image to approximately the amount of images you've taken (Image -> Canvas Size). I have taken three pictures, plus I'm leaving extra space, so I'm extending y by 330%.


Next, we open the image South of our first separately in GIMP. Select all of the next , extended image and paste it into the first image. In the layers tab, right click and click "To New Layer" to change the "Floating Selection (Pasted Layer)" to a new layer. Ensure you have the new layer selected and move the layer down with the Move Tool (M) to approximately where the two images should line up (holdding CTRL will restrict the movement to vertical only). Then zoom in to around 1000% and align the images by toggling visibility of the new layer (press the eye icon in the layers window on the new layer) and adjusting the new layer accordingly. When you've aligned the two layers, right click on the new Layer in the layers window and select Merge Down. Add the next image South using the same method and making an image like a column. If you're merging multiple columns of pictures for wider maps, I suggest you stick to making one column at a time and merging the columns later on.


Once you're satisfied with the merged image, crop the image (select the area you want, then select "Image" -> "Crop to Selection") and scale it. If you're making a map for an Extended game with scaling, check the addendum for calculating sizes. I've scaled the image to 800 pixels in width, as the island approximates to 100km West to East.

Next, we will adjust the colour curve in GIMP to produce an image in the colour range we want. This process usually requires quite a few attempts to get right. Select "Colors" and then "Curves...". In the window that appears, click on the line to add points on the line to change how the curve behaves. Use the preview to get an idea of what the map will look like. Press OK. Then export the image to the SImutrans maps folder. To do this, you select "File" -> "Export As..." (Ctrl + Shift + E). Navigate to the maps folder of Simutrans, set a file name and make the extension .ppm . Press "Export" and select RAW when GIMP asks whether it should save in RAW or ASCII. Start Simutrans and make a new map. Select "Load Height Map" and open your created map. Use the "Climate Settings" to adjust the water level to suit your map.

Here's the curve I used to get the result I wanted.


I've noticed that it's possible to improve work speeds using the keyboard shortcuts. Press Alt + C, then C to reach the colour curve. Then Down + Enter to select the last curve used so it can be adjusted and accepted. Then Ctrl + Shift + E, Enter, Enter to save over the previous version of the file. Lastly switching to Simutrans to load up the map.

addendum:
Scaled Maps:
The Tangram Heightmapper does not show what scale the displayed area is in. I use my display resolution to determine the amount of pixels the resulting map will have. For extended paksets that work on a scale, the resolution is divided by the scale (e.g. pakBritain128-Ex is 125m/tile, so 8 tiles per km). In my example, I have used two screens giving me a combined resolution of 3600x1050 that I can use (1920x1080 + 1680x1050) which when divided by 8 (pakBritain's scale) gives me 450km horizontally across the entire screen. Modern operating systems allow for snapping windows to sides of the screen, so I could make maps half or a quarter of my screen sizes without trying to calculate the sizes first.
Next we use the distance measuring tool in Google maps to display how much of our area we would have in focus to achieve the scale. You right click on the map and select "measure distance", clicking elsewhere on the map to set the second point. Here's an image to relate this:




Feedback for improvements is very welcome. I tend to be quite messy in larger posts and jumble information, so there's always room for improvement

Offline makie de

  • *
  • Posts: 94
  • Languages: DE
Re: Making Simutrans Height Maps using the Tangram Heightmapper.
« Reply #1 on: July 12, 2019, 06:14:05 AM »
Quote
Simutrans maps seem to be limited to 25 height tiles, s
more as 32 hight is possible if you set in simuconf.tab
# minimum/maximum allowed height level for the map (too high might cause display errors)
# Also those number must no be the same
world_minimum_height = -12
world_maximum_height = 100
more than 120 i think it is not possible because limit of the datafield

and for loading the height map modify in height_map_loader.h in folder dataobj
return h0/2 - 10;
just you have to compile simutrans

i have do similar, look here
https://www.simutrans-forum.de/mybb/showthread.php?tid=8964
 

Offline Spenk009

  • *
  • Posts: 242
Re: Making Simutrans Height Maps using the Tangram Heightmapper.
« Reply #2 on: July 16, 2019, 05:03:45 PM »
This is a handy trick if you're willing to compile yourself. I tend to just test using builds from github, but if I just script the change in before compiling it could work longer-term.
Tangram uses data from Mapzen, rather than NASA (unless they just copy the NASA data)

i have do similar, look here https://www.simutrans-forum.de/mybb/showthread.php?tid=8964
Thank you for the heads-up, that map looks gorgeous! I'm glad you were able to suppress your C/C++ allergies ;).

Offline makie de

  • *
  • Posts: 94
  • Languages: DE
Re: Making Simutrans Height Maps using the Tangram Heightmapper.
« Reply #3 on: July 17, 2019, 07:28:04 AM »
Well, the change in the program should be properly installed in the program and for everyone. The parameters should be usefully calculated from world_minimum_height and world_maximum_height. And then submitted as a patch, but not by me.

Fortunately, the modified program is only necessary once. Namely, at the time of loading the altitude map. Later, the normal program can be used.