Using DEMs and Google Earth Tutorial

Use the simple World Editor tool and other advanced developer tools to create your own world, whether it's fictional or based on a real world location. You'll find help and advice here.

Moderator: Moderators

Locked
moranb
Well Established Forum Member
Posts: 859
Joined: Tue Oct 05, 2004 7:41 am

Using DEMs and Google Earth Tutorial

Post by moranb »

Tutorial on using DEM data and Google Earth to build new Routes in
Rail Simulator


Updated 25 July 2008


EDIT: This tutorial was written in late 2007 shortly after Railsimulator was launched. Please note that Jim Nobbs has developed a tool that enables the whole process of creating and installing decals for route building to be done quickly and automatically. The tool can be downloaded from his web site: http://www.rwdecal.co.uk/index.php and is available in both a freeware and donation-ware versions (the latter providing decals of higher resolution). There is a discussion of the tool in the Railworks forum at http://forums.uktrainsim.com/viewtopic. ... 04&t=99228.

BFM



If you are building a modern route and Google high resolution images exist, especially for the major stations and yards in your route, there is an almost foolproof way of accurately building your route. As compared with the elaborate procedures that have been used to get a similar result in MSTS this is a remarkably simple process and a large number of images can be made and transferred to your route in a very short period of time compared with MSTS. The only requirement is that you have a graphics programme capable of saving images in Direct Draw format (DDS) or RS Ace format. If you are using PS or PSP, I strongly recommend that you download from the Railsimulator site art plugins for these programmes which allow you to save image files directly as RS compatible *.ace files (you will need to register with RS in order to access these plugins - registration is free), thus speeding up the process considerably. With other graphic programmes, you will need to get a plugin which will permit saving in *.DDS format and convert the *.DDS file to RS ace format using the ToAce tool from RS.

The process described is most useful for complicated trackwork at terminal and major stations and yards where the normal named and series markers are difficult to follow.

There are three main steps to achieving this. The first is to create a new template for your route using the Asset Editor to set up a blueprint for the route. This involves setting the start coordinates for your route so that when you open it in the main RS programme you are brought directly to your start point. You can do this manually following the instructions in the RS documentation, but I recommend using Mike Simpson's RS-Tools where you only need to enter the latitude and longititude of the starting point of your route.

The second is to download the DEM data for the area where your route is located and place it in a new folder in Route Simulator as described in detail in the RS documentation (World Editor User Guide supplied with the game which is normally found in C:\Program Files\RailSimulator\manuals - not the developer documents). The data must be in *.hgt format and should be placed in the folder .........\Rail Simulator\DEM\SRTM . Once you have done this, you can load up your route, which will bring you to the start point for your route, switch to the Route editor, click on the 'house' in the top left panel and press ‘t’. The dem data will be loaded. If you suddenly see the world disappear, it means that the DEMs have raised the ground above you and you need to bring your camera up to above the ground level.

Now for the slightly more complicated task of getting Google images into your route. The process which I will describe owes a lot to Pauls experimentation creating Decals from OS maps in the UKTS forum.

All the decals that will be created will be stored in the Rail Simulator\Source\Developer\Addon\ Environment\Terrain\Decals folder. You can substitute your own name for ‘Developer’ and your route’s name for ‘Addon’ - or create a second \Source\Yourname\Routename\folder, but make sure all the sub-folders from the Developer\Addon are included. Again, RS-Tools will now do this automatically.

Open your Google Earth and zoom to the area where your route is located and to a height of between 400 and 500 metres. Click on the ‘N’ (north) in the compass at the top right corner to ensure that your image is facing north. This is important as your image/decals will now be correctly orientated when you load them in Route Editor.

Now, using the ruler tool provided in Google Earth, carefully measure the distance from the top to the bottom of your image (in metres). Depending on the resolution of you computer, it will probably be between 350 and 500 metres. Carefully zoom in or out until the line from top to bottom of the screen is about 400 metres. It does not have to be exact. (In the zoom control, use the centre icon which gives you greater control over the zooming speed). I find that around 400 meters is a good compromise between resolution and ease of use of the Decal in World Editor. Note down the actual figure. This will be your 'length'. When you are satisfied, measure with the ruler the left to right distance and note this figure also. This is your 'width'. Now you can save your image as a jpeg file, naming it , for example, ‘yourroute001’ in any convenient folder that you will remember. I store mine in a subfolder called – not very original - Google Images in the ‘My documents’ folder. If you find that your line is not straight, you are probably working in a hilly area. In that case, its advisable to switch to a 2D view by unticking the 'terrain' box in Google Earth.

Depending on the area you are working on you will probably need more images. For example, to build a terminal station , you will probably need four or five images. Without touching the zoom control, move your Google image to the next area, ensuring a slight overlap with the previous image and save the new image. Continue this process until you have the required number of images.

To ensure that our eventual decals are located in the correct position, you now need to place a few pushpins in significant landmarks in one of your the images. For example, I placed four pushpins at the four corners of my terminal station and a few more at the end of various sidings. Five or six fwill be sufficient. Save these as a KML file. These will be converted in due course to named markers.

Open your graphics program (I assume you have already installed the Nvidia plug-in or the art plugin in the case of PS or PSP). Load the first of your images. Re-size it to 1024 x 1024 pixels or 512 x 512. You will need to ensure the ‘constraint’ box is not ticked so that you can convert to an exactly square image). If your original image is not square, it will look slightly distorted, but this will be fixed later on. Create an alpha channel for the image and draw a very thin border (1 or 2 pixels in width) in black on the alpha channel. This is very important to avoid smearing as explained by Paul in his posting on OS Map Decals in UKTrainSim.

[To create the alpha channel in PS, if the channel/layers tool is not already open (this is the small window with the tabs 'layer' 'channel' and 'path') select 'show channels' from the Windows drop down menu. The tab 'channel' will open and you should see four thumbnails of your image in the RGB, Red, Green and Blue channels. At the bottom of the window are four buttons. Click on the third button from the left (the one beside the trash can) and an alpha channel will be created immediately below the blue channel. Deselect the RGB, Red, Green and Blue channels by clicking on the 'eye' to make the alpha channel active (it will be in a blue bar and have an 'eye') so you can edit it. The alpha will be black. Paint it white with the paintbrush or bucket tool. You will need to draw a line about one or two pixels wide around the edges of the alpha to prevent the smearing. Save it as an ace or dds file, depending on which plug-in you have installed, making sure you have ticked the 'save alpha' box].

If you have saved the image as a DDS file, the next step is to convert the DDS images to Ace files, using the ToAce tool provided by Kuju - or again use RS Tools. Save the ace files to your source\ …..\environment\terrain\decals folder. If you saved with the ace plugin you can save the image directly to your Source\...Environment\Terrain\Decals folder

Now open Asset Editor (this must be in windows mode – see the option when opening the main RS programme). Click on the folder titled Developer or whatever name you gave your source\developer folder and continue opening the sub-folders until you reach the Environment\terrain]\decals folder. There you will find the ace files you saved. You will see that there are some decals already there. Right click on your *.ace file and a number of options, including ‘new blueprint’ will appear. Click on this and from the drop-down list in the small window that appears, select decal blueprint and an empty blueprint will appear in the right hand pane. It will be automatically given the same name as the ace file. You can change this if you wish, but later when you will have many ace files, it will be easier to identify which blueprint refers to which ace file. In the right hand pane you need to enter some information – the name of the decal (you can ignore other languages unless you are working with Windows OS in one of the other available languages, the category (I use People/animals category) and the ID at the bottom. Here you type Environment\Terrain\Decals\’name of ace file’.ace. Click on ‘save’ and then ‘export’. (You can click on one of the provided blueprints to see how they are filled). If all is well you will receive a message saying ‘successful build’. In Windows Explorer or similar programme, go to your asset folder and keep opening the subfolders until until you reach the ....Environment\Terrain\Decals sub-folder. Now, referring to the actual width and height you noted down earlier, it is necessary to edit the 'width' and 'length' entries to the real world 'width' and 'length (height)' represented by the decal in the *. BIN file in the Decals sub-folder. So, if your original Google image represented an area 430m by 400m, change the default figure of 20 by 20 to 430 by 400. Otherwise your decal will look more like a postage stamp. The lines to look for are <Width d:type="sFloat32">20.000000</Width> and <Length d:type="sFloat32">20.000000</Length>. These entries are about two thirds of the way down the file. The image.Bin file can be edited best with Mike Simpsons RS Tools.

You now need to convert the kml file you saved earlier to a marker file following the procedure set out in the RS documentation or again by using RS_Tools. However, I strongly advise you to use the data from the …\coordinates\points column of the spreadsheet as I find that this data is more accurate than that in the lat and long. column. Note: RS_ Tools_TMB is now set up to use the correct data.

That completes the process. Repeat for the number of images you wish to use, creating a new blueprint for each image. To speed up the process, assuming you have installed the art plugins, you can load your first ace file (having checked that it displays properly in World Editor) into PS or PSP and copy /paste subsequent Google images (after they have been 'squared' ) onto this image and saving them as new images. This will avoid the need to create separate alphas for each image as the loaded ace file will automatically have included the alpha channel.

When all is ready, load up your route, open the world editor, make sure the markers button in the lower left panel is active, find one of the named markers, click on the object (House) in the top left panel and on the head in the second panel (assuming you used the category people\animals) and your images will appear in the list. Click on one of the images and place it convenient to one of your markers for that image. Lining up your image is simply a matter nudging it into position and aligning it with the markers. Continue until all the images are loaded. Now you can start accurately laying tracks.

This all takes a long time to describe , but in fact once you get the hang of it, can be done very rapidly.
Last edited by moranb on Mon Nov 23, 2009 12:58 pm, edited 8 times in total.
User avatar
MultiNL
Getting the hang of things now
Posts: 76
Joined: Thu Oct 11, 2007 3:02 pm

Re: Using DEMs and Google Earth Tutorial

Post by MultiNL »

thanx for this great tutorial! at the moment i'm trying your tutorial but got stuck at the alpha channel point

How do i get a good alpha channel picture in Paint Shop Pro?
this is one of the screens in google earth i made:
Image
moranb
Well Established Forum Member
Posts: 859
Joined: Tue Oct 05, 2004 7:41 am

Re: Using DEMs and Google Earth Tutorial

Post by moranb »

Unfortunately, I am not familiar with PSP as I use Photoshop, but I would have assumed both programmes work the same way. In the case of Photoshop, there is an icon in the tool box to create a mask. A quick Google search shows several tutorials on creating alpha channels in PSP e.g. http://www.axialis.com/tutorials/tutorial-misc002.html
User avatar
RobertsN
Been on the forums for a while
Posts: 110
Joined: Thu Dec 06, 2001 12:00 am
Location: Patagonia

Re: Using DEMs and Google Earth Tutorial

Post by RobertsN »

moranb wrote: ...
The second is to download the DEM data for the area where your route is located and place it in a new folder in Route Simulator as described in detail in the RS documentation.

...

Excellent tutorial. However, could you elaborate on where to put the DEM data?

My installation is in spanish just because KUJU prefers not to pay attention to my language request when installing (my windows is in spanish) and there are no manuals installed by the product. I've checked the documentation that came with the development tools and cannot find how to.

Any help would be very appreciated.

Thanks,

Nicholas Roberts
Patagonia
Nicholas Roberts
Patagonia
User avatar
ianm42
Very Active Forum Member
Posts: 2749
Joined: Sat Oct 27, 2001 12:00 am
Location: Basingstoke, UK
Contact:

Re: Using DEMs and Google Earth Tutorial

Post by ianm42 »

The .hgt files should be put in the folder ...\Rail Simulator\DEM\SRTM which you need to create.

8)
User avatar
RobertsN
Been on the forums for a while
Posts: 110
Joined: Thu Dec 06, 2001 12:00 am
Location: Patagonia

Re: Using DEMs and Google Earth Tutorial

Post by RobertsN »

Many thanks.


Nicholas Roberts
Patagonia
Nicholas Roberts
Patagonia
shuffer4
Getting the hang of things now
Posts: 23
Joined: Fri Aug 17, 2007 7:06 pm

Re: Using DEMs and Google Earth Tutorial

Post by shuffer4 »

There is a link here to a Google Earth overlay.....it puts the UK OS (Ordnace Survey) 1kilometre grid (1000metres) over your Google earth view.

http://bbs.keyhole.com/ubb/showthreaded ... 980/page/0


Its just a little file to download, then double click on it when your Google earth window is somewhere over the UK or Ireland, and a small portion of the grid will show, then as you move around, just double click on it again to re-activate it again for your new viewing area.
It fairly distorts the closer you get to it! :roll:
I'm going to have a bash at a different way using TransDEM to make UTM aligned 1000m tile/textures, it'll be a bit better than using this OS grid overlay thing. :wink:

Why do you have to put the black border around the texture?
Is it to stop the colours leaking out/distorting?
Do you actually put a black colour onto a texture....or are you using an alpha channel mask black border? :argue:

Thanks.
moranb
Well Established Forum Member
Posts: 859
Joined: Tue Oct 05, 2004 7:41 am

Re: Using DEMs and Google Earth Tutorial

Post by moranb »

If you do not use an alpha channel, the edge of the decal distorts significantly and makes it impossible to align correctly two or more adjoining images. If you make 1,000 m square decals, this might not matter so much as probably all the information you need is within the 1,000 metres and the distortion is proportionally less. But I suspect that you will have very large files if you use 1,000m images or else the resolution will not be very good. The alpha is very simple - a black line of 1 or 2 pixels around the edge of the mask.
User avatar
dlljones
Well Established Forum Member
Posts: 662
Joined: Sun Nov 05, 2006 5:39 pm
Location: Criccieth, North Wales

Re: Using DEMs and Google Earth Tutorial

Post by dlljones »

I've posted this question under a different topic heading but it seems to have reached a siding so here it is again!
"My BluePrint is Blue!!! I've successfully created a route template using Mike's excellent RS Tools and managed to get terrain contours using HGT files from this website ftp://e0srp01u.ecs.nasa.gov/srtm/versio ... 3/Eurasia/. I'm now trying to experiment by creating a decal to overlay an arial view of the area I wish to recreate (Bangor Station) onto the terrain as a template for track, buildings etc. I'm using Virtual Earth which gives me excellent detail to work with and far superior to Google Earth (http://dev.live.com/virtualearth/sdk/). I took a print screen of the required area and pasted it into PSP. I then created a DDS file etc and managed to convert it to an ACE file. Then I created a decal from this file and seemed to get a successful result. However when I opened RS and my new "route", found my newly created decal and inserted it on the terrain all I got was a BLUE BLUEPRINT!!! I tried the other way of creating a tga file instead of a dds file and this did not work either. Any of you guys out there able to throw any light on this please (as long as it's not blue light that is!!!!)"

Llew Bach :crazyeyes:
pauls
Very Active Forum Member
Posts: 1461
Joined: Wed Jan 14, 2004 6:47 pm

Re: Using DEMs and Google Earth Tutorial

Post by pauls »

Hi,

What option did you use in ToACE when converting your DDS to ACE ??

Regards
Paul
dlljones wrote:I've posted this question under a different topic heading but it seems to have reached a siding so here it is again!
"My BluePrint is Blue!!! I've successfully created a route template using Mike's excellent RS Tools and managed to get terrain contours using HGT files from this website ftp://e0srp01u.ecs.nasa.gov/srtm/versio ... 3/Eurasia/. I'm now trying to experiment by creating a decal to overlay an arial view of the area I wish to recreate (Bangor Station) onto the terrain as a template for track, buildings etc. I'm using Virtual Earth which gives me excellent detail to work with and far superior to Google Earth (http://dev.live.com/virtualearth/sdk/). I took a print screen of the required area and pasted it into PSP. I then created a DDS file etc and managed to convert it to an ACE file. Then I created a decal from this file and seemed to get a successful result. However when I opened RS and my new "route", found my newly created decal and inserted it on the terrain all I got was a BLUE BLUEPRINT!!! I tried the other way of creating a tga file instead of a dds file and this did not work either. Any of you guys out there able to throw any light on this please (as long as it's not blue light that is!!!!)"

Llew Bach :crazyeyes:
User avatar
dlljones
Well Established Forum Member
Posts: 662
Joined: Sun Nov 05, 2006 5:39 pm
Location: Criccieth, North Wales

Re: Using DEMs and Google Earth Tutorial

Post by dlljones »

Hi Paul

Thanks for your reply. I think I've found a workaround that I'm happy with. Last night I looked at all the other ace files for decals and all seemed to be small sizes (around 150 kb). The file I produced however was 3686kb! I decided therefore to try and reduce its size to see if that would make a difference. I saved the image from Virtual Earth as a tga file using PSP and then converted it to an ace file as before with Aceit but this time as an Alpha. This gave me a b&w ace file which I've managed to export as a working decal in RS. Its size is now 1203kb. I don't know if this is the solution to my original problem but it seems to work. All I need to do now (as if I knew what to do!!) is to get the scaling right and I'll be able to start building the station. I gave up the idea of using the DDS format but I see that Alpha channels feature in that too.

The reality is that I'm very much an amateur with such issues but it's nice but sometimes frustrating to learn!!!

Cofion (Welsh for Regards)

Llew Bach :)
chandramohan
Been on the forums for a while
Posts: 264
Joined: Sun Jul 23, 2006 5:58 pm

Re: Using DEMs and Google Earth Tutorial

Post by chandramohan »

Google eart does not have excellent coverage of Kent - is there any other program which be better?
From what you are saying you can get the DEM data and overlays for track in a few moments.
It seems so much easier than in MSTS, where you have to do the Route geography extractor.

Thanks
moranb
Well Established Forum Member
Posts: 859
Joined: Tue Oct 05, 2004 7:41 am

Re: Using DEMs and Google Earth Tutorial

Post by moranb »

Re-reading the tutorial, I realize that I missed one important point in the final stage after exporting the decal blueprint to the asset folder. It is necessary to edit the 'length' and 'width' entries to the real 'length' and 'width' represented by the decal in the image BIN file in the asset folder. So, if your original image represented an area 400m by 400m, change the default figure of 20 by 20 to 400 by 400. Otherwise your decal will look more like a postage stamp. The lines to look for are <Width d:type="sFloat32">20.000000</Width> and <Length d:type="sFloat32">20.000000</Length>. These entries are about two thirds of the way down the file. The image Bin file can be edited best with Mike Simpsons RS Tools.

Sorry for any confusion caused.
pgmetcalf
Well Established Forum Member
Posts: 580
Joined: Wed Jun 19, 2002 1:42 pm

Re: Using DEMs and Google Earth Tutorial

Post by pgmetcalf »

Not really anything to do with base mapping but when I check location on google Earth (degrees) and jump to the same location in RS the position is slighlty off. Anyone found a solution to this? Is it something to do with the camera angle in RS?
moranb
Well Established Forum Member
Posts: 859
Joined: Tue Oct 05, 2004 7:41 am

Re: Using DEMs and Google Earth Tutorial

Post by moranb »

So far at least, I have not experienced this problem. I am working on the Dublin-Cork mainline and have got as far as Ballybrophy exactly 66.54 miles from Heuston Station (Dublin) which is identical to the actual mileage as indicated in the Quail Railway diagram. The lat. and long. of Ballybrophy is exactly where it is supposed to be in RS and my marker for the station, taken from Google Earth, was less than 50 meters out. It may be a UTM issue.
Locked

Return to “[RS] Route Building”