Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Fri Oct 31, 2014 5:41 pm

All times are UTC




Post new topic Reply to topic  [ 318 posts ]  Go to page 1, 2, 3, 4, 5 ... 16  Next
Author Message
PostPosted: Sun Aug 27, 2006 5:32 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Sun Aug 11, 2002 3:07 pm
Posts: 133
Location: Walsall, England
(Can one of the mods make this a sticky, a lot of people may find it very useyfull!)

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/website/microdem.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 :)

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).

Image

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).

Image

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.

Image

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.).

Image

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.
Image

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 :)

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.

Image

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 :) I hope people find this of some use.

[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]


Last edited by MGSteve on Thu Jul 01, 2010 12:11 am, edited 5 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 8:20 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Mar 30, 2004 12:30 pm
Posts: 16654
Location: Almere, The Netherlands
Whoo, nice! I'd say make this a sticky, or link to it from a sticky.

I guess all necessary tools are freeware?

EDIT: For the image convertor tools, perphaps link to IrfanView?

_________________
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 8:47 am 
Offline
Traffic Manager
Traffic Manager

Joined: Sun Aug 11, 2002 3:07 pm
Posts: 133
Location: Walsall, England
Purno wrote:
Whoo, nice! I'd say make this a sticky, or link to it from a sticky.

I guess all necessary tools are freeware?

EDIT: For the image convertor tools, perphaps link to IrfanView?


Yup, all except the Image conversion software I used were free!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 9:09 am 
Offline
Engineer
Engineer
User avatar

Joined: Wed Jan 07, 2004 6:37 pm
Posts: 109
Location: Norway
This is, by far, one of the best tutorials I've seen in a while. Thanks a lot :)

_________________
- Rexxie
Sanity is a full time job.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 9:48 am 
Offline
Traffic Manager
Traffic Manager

Joined: Sun Aug 11, 2002 3:07 pm
Posts: 133
Location: Walsall, England
Rexxie wrote:
This is, by far, one of the best tutorials I've seen in a while. Thanks a lot :)


No probs, comes from writing help manuals for a couple of game editors I wrote a few years back!

Glad I could put something back into the community :D Took me about a day of googling and experimentation to find out how to do it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 12:40 pm 
Offline
Engineer
Engineer

Joined: Tue Jun 27, 2006 11:52 am
Posts: 21
Location: Europe, Norway
Is there a program for linux that's can do the same as this program you linked to?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 2:43 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Sun Aug 11, 2002 3:07 pm
Posts: 133
Location: Walsall, England
QtanJ wrote:
Is there a program for linux that's can do the same as this program you linked to?


I don't know, its the only one I found. It may run under a Windows Emulator on Linux.

tbh, I was surprised I found a freeware program to do it.


Top
 Profile  
 
PostPosted: Mon Aug 28, 2006 6:05 pm 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jan 02, 2004 4:38 pm
Posts: 20
Location: Hungary, Érd
I've a little project which aims to provide complete map support for the earth, this is called mapgen.
It's a small project written in C by me. This project based on 30" DEM maps downloaded from NOAA 4 years ago (no longer available in original form).
I've merged the downloaded raw files into 1 big raw file (1.8GB). The 30" DEM maps means each pixel is 1 square km at the equation, above and below it's smaller.
Current generator capable of generating simple, naive projections (treats each pixel as 1 square km), which causes some distortion. I'm working on the anti-distortion generator engine currently.

I've generated the map of the whole earth (43200 x 21600 pixel), and made it available in a downscaled version (4320 x 2160) here (4 MB).

Generator supports:
    projections based on real geographics coordinates (topleft and bottomright long/lat coords). Each projection could have a name (eg. the name of the country/continent).
    different colorschemes, so one picture is good for real maps whilst the other picture is an OpenTTD heightmap.


I'll open the source of mapgen once I'll finish the anti-distortion generator engine and beautified the code somewhat :-)

Now comes the part where I ask for help: I need coordinates for the countries.
Each country should have a format like this:
Code:
[hungary]
; top lat is -49° 0' 0"
  top = -49,00,0
; left long is 14° 14' 0"
  left = 15,14,0
; right long is 23° 46' 0"
  right = 23,46,0
; bottom lat is -44° 44' 0"
  bottom = -44,44,0


The above projection results in this map using simple generator engine (and tradition map colorscheme).

I also have a list of cities for each country (data from 1993) on the earth with long/lat coordinates. I'm thinking about give support for it in OpenTTD. I'm already having discussions with TGP authors about it...

We're also thinking to built in the support for the above into OpenTTD thus allowing users with internet connection to choose from the available maps and download the map from the server.

I have the necesarry hardware to generate the pictures.

Comments, ideas, feedback and help are welcomed.

Cheers,
Miham.

PS: the server xenon.bibl.u-szeged.hu will may be unreachable tomorrow due to moving.

_________________
EOF


Top
 Profile  
 
 Post subject: Thank you!!!!
PostPosted: Mon Aug 28, 2006 6:17 pm 
Offline
Engineer
Engineer

Joined: Sat Jul 24, 2004 4:39 am
Posts: 25
Wow, this is what i was looking for, how to make it, so, now i'm gonna creat chile by parts :)

This is what i take after your guide and a few image manipulations ;)


Attachments:
File comment: This is a heightmap for the chilean south lakes and the "Chiloe" island. Look that in that places the "Andes" mountains are declining...
chiloe-512-1024.png [346.7 KiB]
Downloaded 2610 times
Top
 Profile  
 
 Post subject: Re: Thank you!!!!
PostPosted: Mon Aug 28, 2006 6:21 pm 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jan 02, 2004 4:38 pm
Posts: 20
Location: Hungary, Érd
Luxor wrote:
This is what i take after your guide and a few image manipulations ;)


Could you please supply the geographic coordinates of Chile?
I need the top-left and the bottom-right coordinate in long/lat format (see example above).

Cheers,
Miham,

_________________
EOF


Top
 Profile  
 
PostPosted: Mon Aug 28, 2006 6:40 pm 
Offline
Engineer
Engineer

Joined: Sat Jul 24, 2004 4:39 am
Posts: 25
miham

Chile is very long, with this coordinates (doesn't count the antartica territories):

18° 23' 38" S - 74° 23' 47" W (i think this is your top left)
54° 54' 15" S - 65° 32' 37" W (this gonna be your bottom right)

Please, this are innacurate don't officially coordinates of my country, so, consider that is a box with Chile in there.

Now, for the region of the lakes the coordinates are:

39° 26' 52" S - 73° 30' 12" W
43° 40' 8" S - 71° 46' 54" W

Also, approx. coordinates.

Cheers-


Top
 Profile  
 
PostPosted: Mon Aug 28, 2006 7:09 pm 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jan 02, 2004 4:38 pm
Posts: 20
Location: Hungary, Érd
Luxor wrote:
miham

Chile is very long, with this coordinates (doesn't count the antartica territories):

18° 23' 38" S - 74° 23' 47" W (i think this is your top left)
54° 54' 15" S - 65° 32' 37" W (this gonna be your bottom right)
Cheers-


Used the above coordinates, the result is here (3 MB).

Cheers,
Miham.

PS: Sorry for the delay, had a little task to do...

_________________
EOF


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 7:24 pm 
Offline
Engineer
Engineer

Joined: Tue Jun 27, 2006 11:52 am
Posts: 21
Location: Europe, Norway
Norway(this is without svalbard, but with relevant islands)

North 71°08′02″ N
West 04°56′43″ E
South 57°58′46″ N
East 31°03′52″ E

This is the official coordinates.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 8:07 pm 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jan 02, 2004 4:38 pm
Posts: 20
Location: Hungary, Érd
QtanJ wrote:
Norway(this is without svalbard, but with relevant islands)

North 71°08′02″ N
West 04°56′43″ E
South 57°58′46″ N
East 31°03′52″ E

This is the official coordinates.

Picture is here (2.6 MB).

I know, this is very distorted, since it's very far from the equation.
That's why I'm working on the anti-distorsion engine...

_________________
EOF


Top
 Profile  
 
PostPosted: Tue Aug 29, 2006 12:30 am 
Offline
Engineer
Engineer

Joined: Sat Jul 24, 2004 4:39 am
Posts: 25
miham wrote:
Used the above coordinates, the result is here (3 MB).

Cheers,
Miham.

PS: Sorry for the delay, had a little task to do...


Ok, no delays for me. And that is Chile, my beautiful country :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 3:24 am 
Offline
Engineer
Engineer

Joined: Sat Jul 24, 2004 4:39 am
Posts: 25
another question that appears, is it possible to get this maps on the standard 0.4.8 version, only have worked in the nightly and the miniIn, but i wanna get the standard version cause is more popular in the multiplayer world :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 6:13 am 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jan 02, 2004 4:38 pm
Posts: 20
Location: Hungary, Érd
Luxor wrote:
another question that appears, is it possible to get this maps on the standard 0.4.8 version, only have worked in the nightly and the miniIn, but i wanna get the standard version cause is more popular in the multiplayer world :)

AFAIK that is not possible, at least, directly.
One way which might work: use the nightly to generate the map, and save the generated OpenTTD map, then try to load it in the 0.4.8, but I don't think it'll work because of the savegame version bump.

_________________
EOF


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 8:01 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
The way to do it would be to download the latest PNGMap build or patch, and use that to load the heightmaps, then save and load in 0.4.8.

If that doesn't work, back up to a previous build/patch, and so on. I don't know when trunk broke with 0.4.x in terms of savegame compatibility, but any build before 3517 is certain to work, and the nature of the patch is not to go out-of-date very quickly; it shouldn't be too hard to apply the r4351 patch to r3517.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
 Profile  
 
PostPosted: Tue Aug 29, 2006 10:27 am 
Offline
Traffic Manager
Traffic Manager

Joined: Sun Aug 11, 2002 3:07 pm
Posts: 133
Location: Walsall, England
miham wrote:
Luxor wrote:
miham

Chile is very long, with this coordinates (doesn't count the antartica territories):

18° 23' 38" S - 74° 23' 47" W (i think this is your top left)
54° 54' 15" S - 65° 32' 37" W (this gonna be your bottom right)
Cheers-


Used the above coordinates, the result is here (3 MB).

Cheers,
Miham.

PS: Sorry for the delay, had a little task to do...


Problem is, its not in grayscale... It needs to be a grayscale heightmap, not just a grayscale map.

Plus with this method, there is no distortion, its completely accurate. But a combination of our two approaches would be ideal though, problem is it would take about a week to download all the SRTM cells, resize them and in the end, I doubt think they'd be able to be put into a merged DEM of sufficient size or quality anyway.

Mods - It may be worth splitting this thread as Miham's posts aren't really to do with the tutorial I wrote, perhaps split his posts out into another thread? Otherwise I can see us ending up with two conversations in one thread here...


Top
 Profile  
 
PostPosted: Tue Aug 29, 2006 12:22 pm 
Offline
Engineer
Engineer
User avatar

Joined: Fri Jan 02, 2004 4:38 pm
Posts: 20
Location: Hungary, Érd
MGSteve wrote:
Problem is, its not in grayscale... It needs to be a grayscale heightmap, not just a grayscale map.

Yes, I do know this. That's why mapgen has different color schemes, I just generated the above maps with the standard map colorscheme, not with the OpenTTD heightmap scheme.

MGSteve wrote:
Plus with this method, there is no distortion, its completely accurate. But a combination of our two approaches would be ideal though, problem is it would take about a week to download all the SRTM cells, resize them and in the end, I doubt think they'd be able to be put into a merged DEM of sufficient size or quality anyway.

Well, I have full coverage on the earth.. The distortion is a problem until I finish the anti-distortion system, which is nearly complete...

MGSteve wrote:
Mods - It may be worth splitting this thread as Miham's posts aren't really to do with the tutorial I wrote, perhaps split his posts out into another thread? Otherwise I can see us ending up with two conversations in one thread here...


Sorry for hijacking your thread, I just thought, someone might be interested. I also ask for mods to split this topic.
Bye,
Miham.

_________________
EOF


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 318 posts ]  Go to page 1, 2, 3, 4, 5 ... 16  Next

All times are UTC


Who is online

Users browsing this forum: leifbk and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000-2013 phpBB Group

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2013.
Hosted by Zernebok Hosting.