TranzDEM US Route: Import into Trainz

c44d9w

New member
This is the start of a series of posts about my attempt to create a large US route (160 miles) using TranzDEM. I used OpenStreetMaps (OSM) for map data and USGS for DEM data.

I encountered significant troubles with the Tile Map Export. I am not sure if that was related to my PC (not enough memory, etc), or if I did some things wrong. With the full route (160 miles), the UTM Tile Map export failed immediately. Using a reduced route (60 miles), many tiles did not get exported. For a small route (20 miles), everything worked fine.

But ultimately, I don't actually need the UTM Tile export. The textures can also be added to the DEM export, and that is good enough. But it would have been nice to have the textures in a separate layer.

I am still a beginner with TranzDEM. What I present below may not be the best way, or the right way.

Read the documentation or watch the following YouTube tutorial when something is not clear. https://www.youtube.com/watch?v=Meeq_5_keYs



Summary of Tasks


  • Get a coarse (large-scale) Raster Map. I used OpenStreetMap (OSM), as TransDEM has support for it.
  • Trace the Rail Route, using the Raster Map.
  • Get the Rail Vector Route from OSM, using JOSM and the traced rail route. Optionally get Road Vector Routes.
  • Get DEM Data. I used USGS 1/3 arc-sec data.
  • Get detailed Raster Map Tiles along the Rail Route.
  • Export the DEM, Raster Map Tiles, and Vector Routes.
  • Import the generated route data into Trainz.

Preparation


  • Follow the "Additional Installations" section in the documentation, and install the TransDEM Ground Textures, and the Trainz Mesh Importer.
  • Download the example tile map server file from http://www.rolandziegler.de/StreckeUndLandschaft/downloadEngl.htm
  • Import the Map Tile Sample Settings into TransDEM, using "Raster Map" -> "Map Tile Servers".
    • Click on "Settings" and use "Import".
  • Optional: Set the "Trainz Custom Content Folder" in "Options" -> "Settings" -> "Trainz Global Export Parameters".
    • The default is to use the Trainz build "editing" directory. This can cause problems with actions in Trainz.
    • Better is to use a Trainz-independent directory.

Next: TranzDEM US Route: Get Overview Raster Map from OpenStreetMaps
 
Last edited:
TranzDEM US Route: Get Overview Raster Map from OpenStreetMaps

This post describes how to get a coarse (large-scale) raster map of the route. For the intro-post, see https://forums.auran.com/trainz/sho...StreetMap-and-USGS-DEMs&p=1954597#post1954597.

I used OpenStreetMap (OSM) because TransDEM supports it.

Steps:

  • Ensure that the example map tile servers have been imported into TransDEM. See "Preparation" in the intor post.

  • Select "Raster Map" -> "Map Tile Servers" from the menu.

  • In "Map Source", select "Open Street Map" and map type "Map".

  • I changed the "Map Size" to 1024 pixels, but I am not sure if that is the best value.
    • Leave the rest at the default.
  • Click the map to zoom and navigate to the area of interest.
    • Zoom to at least level 9. This will ensure that the railroad tracks are visible.
    • If the area of interest is larger than what is shown in the map, repeat the following until the area is covered.
  • Click the big righ-arrow to copy the map data into the fields on the right.

  • Click "Get Map" to get the map tile. Specify a name that identifies the area of interest (not just the tile).
    • This adds the tile to the raster map.
  • With size 1024, navigate two or 3 clicks, and get the next map tile. Don't forget to click the big right-arrow each time.

  • When done, save the complete map using "Raster Map" -> "Save georef Raster Map". This creates a .lgb file, which is a list of all the map tiles.

Next: TranzDEM US Route: Trace Railroad Route
 
TranzDEM US Route: Trace Railroad Route

This post describes how to create a rough trace of the route. The trace will be used later to get more refined routes and raster maps. For the intro-post, see https://forums.auran.com/trainz/sho...ge-US-Route-using-OpenStreetMap-and-USGS-DEMs.

Steps:


  • If not already loaded, open the georef raster map created in the preceding task, using "Raster Map" -> "Open georef Raster Map".

  • Activate the simple route editor, using the icon or "Route" -> "Simple Route Editor".

  • Create a new poly-line, using the icon or "Route" -> "Polyline".

  • Click on points along the railroad track. Be fairly close, but it does not have to be exact.
    • Use the ESC key to complete a polyline.

  • Repeat for branches off the main route.

  • Deactivate the simple route editor, using the icon or "Route" -> "Simple Route Editor".

  • Save the traced route, using "Route" -> "Save Route".
    • Give it a name that makes it clear that it is a coarse trace of the route.

  • Also save the traced route as a .gpx file, using "Route" -> "Save Route as", selecting GPS Exchange File.

Next: TranzDEM US Route: Get Railroad Vector Route from OSM
 
Last edited:
TranzDEM US Route: Get Railroad Vector Route from OSM

This post describes how to get an exact vector of the railroad tracks from OpenStreetMap (OSM). For the intro-post, see https://forums.auran.com/trainz/sho...ge-US-Route-using-OpenStreetMap-and-USGS-DEMs.

This part uses the Java Editor for OpenStreetMap (JOSM). It needs to be downloaded from https://josm.openstreetmap.de. Java needs to be installed on the PC.

Steps:



  • Start JOSM. Either tun the WebSstart link, or open josm.jar with Java.

  • Open the traced route (.gpx) file, using "File" -> "Open".

  • Show the filters: filter/funnel icon on left, or "Windows" -> "Filter".

  • Download OSM data along the track (traced route).
    • In the "Layers" filter, right-click the traced route layer and select "Download from OSM along this track".
    • Recommended (source unknown): 500 m from tack; max 5 km-sqare.
    • Download "track only".
    • Click "Download as new layer".

  • In the filter box (bottom right), click the "+" to add a new filter.
    • In the presets, select "Transport/Railway/Rail".
    • For the filter, select E (enable), H (hide) and I (invert).
    • Now only the railway tracks are showing.

  • Create a rectangle around the area of interest.
    • Then click "Edit" -> "Copy".

  • Create a new layer, call it Railroads.
    • Then paste the copied track vectors into the new layer, using "Edit" -> "Paste".

  • The pasted route is offset from the route in the orginal layer. It needs to be moved on top of the original route.
    • Click+drag any part of the copied route, until it is on top of the original route.
    • Use an end point for best alignment. Zoom in repeatedly to make adjustments.

  • Export the railway layer: right-click the layer and click "Save as".
    • Select GPX format.

  • Repeat the same for roads, as desired.
    • Use filter presets "Highways/Streets/Motorway" and "Highways/Streets/Primary", etc.

Next: TranzDEM US Route: Get the Digital Elevation Model Data
 
Last edited:
TranzDEM US Route: Get the Digital Elevation Model Data

This post describes how get Digital Elevation Model (DEM) data from the USGS and import it into TransDEM. For the intro-post, see https://forums.auran.com/trainz/sho...ge-US-Route-using-OpenStreetMap-and-USGS-DEMs.

I used the USGS data, because it offers better resolution than the SRTM data. The area of my interest had 1/3 arc-sec resolution data. Others have 1/9 arc-sec, 5 meter and 1 meter data.

Steps:


  • Goto https://apps.nationalmap.gov/downloader/.
  • Under "Data", check "Elevation Products (3DEP)", and select the resolution desired.
  • On the map, navigate to the area of interest.
  • Click the "Extent" button (top-left), and on the map use the mouse to select the area of interest.
  • Click the "Search Products" button. This will list the datasets that cover the selected area.
  • Download each data set, using the "Download Link (TIF)" link.

  • Start TranzDEM, if not already running.
  • Open each downloaded data set (.tif file), using "File / DEM" -> "Open DEM", and then save using "File / DEM" -> "Save DEM".
    • This converts the data set into .dem files.

  • Open the first .dem file, using "File / DEM" -> "Open DEM".
  • Add the remaining .dem files, using "File / DEM" -> "Add DEM".
  • Optionally save the combined DEM file, using "File / DEM" -> "Save DEM as".

  • Load the traced route, using "Route" -> "Open Route".
  • Ensure that the Select tool is active, and select a rectangle around the traced route (area of interest).
  • Remove the DEM data outside the rectangle, using "Tools" -> "Erase DEM Points":
    • Click the left mouse button and select "All outside rectangular ...".
  • Save the cropped DEM, using "File / DEM" -> "Save as ...", giving it an appropriate name.
    • This is the DEM data to work with for the Trainz route.

Next: TranzDEM US Route: Get Detailed Raster Map Tiles Along Route
 
TranzDEM US Route: Get Detailed Raster Map Tiles Along Route

This post describes how fetch more detailed raster map tiles along the route. For the intro-post, see https://forums.auran.com/trainz/sho...ge-US-Route-using-OpenStreetMap-and-USGS-DEMs.

Steps:


  • If not already loaded, open the large-scale raster map, using "Raster Map" -> "Open georef Raster Map".
  • If not already loaded, open the railroads vector route, using "Route" -> "Open Route".
    • Select the GPS Exchange File (.gpx) format.
  • Open the map tile server, using "Raster Map" -> "Map Tile Servers".
  • In "Map Source", select "Open Street Map" and map type "Map".
    • Use "Map Size" 1024 (my choice).
    • Set the "Mode" to "Map images along path".
    • Leave rest at defaults.
  • In the map, navigate to anywhere in the area of interest. Preferably this is an area with lots of details.
    • Zoom to at least level 14.
    • Click the large righ-arrow to adopt the map data.
  • Click the "Get Map" button to fetch all the raster map tiles along the route.
    • Automatically saves the list of map tiles (.lgb file).
  • Verify that all track has map tiles.

Next: TranzDEM US Route: Export DEM, Raster Map, and Vector Routes
 
Last edited:
TranzDEM US Route: Export DEM, Raster Map, and Vector Routes

This post describes how export the elevation data, raster map tiles, and track (and road) routes from TransDEM. For the intro-post, see here.

Steps:


  • Esure that the "Trainz Custom Content Folder" is empty (no file with the route name, and no content in the "scenery" folder).
  • If not already loaded, open the cropped DEM, using "File / DEM" -> "Open DEM"
  • If not already loaded, open the detailed raster map tiles, using "Raster Map" -> "Open georef Raster Map".
  • If not already loaded, open the railroads vector route, using "Route" -> "Open Route".
    • Select the GPS Exchange File (.gpx) format.
  • In the "View" menu.
    • Ensure that "UTM-Grid / WGS84" and "Fixed 1000 m Grid Width" are selected.
    • Optionally select "Show Grid Squares".
  • In the "Trainz" menu, select "Show Baseboard Grid".
    • I am not sure if this is required or not.
  • Using the mouse, select a rectangle that encloses the whole route.

Export the DEM Data:


  • Export the DEM, using the icon or "Trainz" -> "Export and Create DEM & and Ground Textures".
  • In "Overlay Bitmap", deselect "Ground Textures from Raster Map", "Show Route" and "Show UTM Grid".
    • I prefer not to have the ground textures, route and UTM grid in the route layer.
  • Set the "Route Filter as desired. I used 2 baseboards (or as desired).
  • Set the "Trainz Version", TANE in my case. I also set "5 m Grid" to "All".
  • Set the "Map Name" (route) and "Region".
  • Click "OK".
    • This creates the basic route files for Trainz. They will be in the export folder, in a folder named for the route.

Export the Map Tiles and Textures:


  • Export the map tiles, using the icon or "Trainz" -> "Export and Create UTM Tiles".
  • Select "1000 m tile", "3D tile", and "Max. texture size" 1024 px.
    • These are recommendations from the video tutorial.
    • Ensure that the "Route Filter" is active, and set "Radius" as desired (1 should be fine).
    • I prefer the map textures in a separate layer, and thus use "Layer Name" to Raster Map.
  • Click "OK".
    • This updates the route files, and creates a set of textures in the "scenery" directory.

Export the Vecor Routes (tacks, roads):


  • Export the railroad tracks route, using the icon or "Trainz" -> Export and Create Track Splines".
  • Ensure that "Adopt terrain elevation" is selected.
  • Set the "Object KUID" to "Track" and select the desired track KUID.
    • Add another track if desired.
  • Enable "Junctions" and set the "Junction levers" KUID.
  • Set the "Layer name", eg Railroad Tracks.
  • Click "OK".
    • This updates the route files.
  • Repeat with each roads vector route.
    • Change "Object KUID" to "Road" and select the desired road KUID.
    • I put each type of roads into a separate layer.
Notes:
  • I had trouble with the map tile & texture export. The export completely failed for a very large route (160 miles). Many map tiles were missing for a large route (60 miles). It worked fine for a small route (20 miles).
  • My work-around is to include the ground texture in the DEM export, and skip the Map Tile export. This worked fine for the large route.

Update: TransDEM has a limit of how many UTM tiles it can export at a time. It seems to be 25 x 25 tiles for a rectangle, and 999 tiles for a path. The solution is break down the export into small parts (ie. repeat the UTM tile export with adjacent rectangles).

Next: TranzDEM US Route: Import into Trainz
 
Last edited:
This post describes how to import the artifacts created by TranzDEM into Trainz (in my case TANE) as a route. For the intro-post, see here.

Steps:


  • Start the Trainz Content Manager.
  • Import the route folder, using "File" -> "Import Content Folder".
    • The folder is in the "Trainz Custom Content" folder, set in "Options" -> "Settings" -> "Trainz Global Export Parameters".
  • Import the scenery folder, using "File" -> "Import Content Folder". Needed only when UTM Raster Map Tiles are exported.
    • Ignore the single warning about the log file.
  • Set the content manager filter to "Today", and verify that the route and UTM tiles were created.
    • Some UTM tiles are reported as faulty. I am not sure if that is a problem or not.
  • Start Trainz, and edit the new route.
    • Verify that the terrain (elevation) is as expected.
    • Verify that the map tiles are painted onto the terrain. Note that they are quite low resolution.
    • Verify that the tracks are present.
    • Verify that the roads are present.
    • Verify that the route is fully covered (no baseboards) missing.

Notes:
  • I don't know at this time how to fix (eg. add missing baseboards, etc) a route that has been imported into Trainz.
  • The tracks are not always accurate, and need a lot of work to create a clean route.

Next: Work on the route in Surveyor. Align track, fix minor errors, etc.
 
Overall I am quite impressed with TranzDEM.

The elevation model is beautiful. In a hilly area, one can easily spot the ROW (cuts and fills), roads and rivers. A minor problem is bridges - the model represents the top of the bridge deck.

The UTM Raster Tile Map seems to be challenging at scale. I need to explore this more. I would have liked to have the base layer clean (only elevation) and have the raster map textures in a separate layer. But that worked only for small routes. The work-around is to add the raster map textures to the DEM export, and not export the Raster Map Tiles at all.

The track alignment needs a lot of work. Despite obtaining it from OSM, there are small offsets. For example in a cut, the track may be partway up the side. This requires a lot of work to realign and get a consistent grade. Similarly, yards need a fair bit of work.
 
Or do you mean creating multiple posts?

This, this is the wrong way. We have rules specifically against flooding on the forum.

But really tutorial stuff should go onto your own site or in the Wiki.
 
Last edited:
Understood. Thanks for combining the threads into a single post.

Unfortunately the title of the thread is now incorrect, and it does not seem that it can be changed.
 
Back
Top