Ts Dem Importer Release

Discussion in 'Content Developer's Area' started by Tomas9970, Dec 9, 2019.

  1. Tomas9970

    Tomas9970 Well-Known Member

    Joined:
    Oct 7, 2018
    Messages:
    1,042
    Likes Received:
    1,050
    First things first I do have to apologise for not working on it for some time but I simply didn't know how to do certain things however I have managed to resolve these issues and the tool is finally here and available.
    I had to cut down my goals a bit but I believe that it does not affect the purpose of this tool.
    I hope that it does not give me a bad reputation.

    What is it
    The TS DEM importer is a tool designed to import high resolution elevation maps into Train simulator to provide better landscape quality for route building.

    Limitations
    There are two main limitations releated to the DEMs.
    1. They must use meters as units. Not degrees.
    2. All DEMs that you are trying to import must use the same DEM datum.

    Requirements
    This program requires GDAL from the OSGeo4W package so you must have that installed.

    How to use
    1. import all of your landscape tiles using Train simulator's built in landscape import tool. This will tell the DEM importer what area do you want to import.

    2. Backup your route. I have tested this tool quite a bit and it haven't failed but that does not mean that it's perfect.

    3. Convert your route's origin to the coordinate system used by your DEM.
    A good DEM datum converter can be found here.
    Here are some DEM datums that I have used:
    USGS 1 meter DEM datum: EPSG:26910
    Alaska 5 meter DEM datum: EPSG:6393
    Austria 10 meter DEM datum: EPSG:31287

    4. Launch the TS DEM importer from the command line with arguments.
    The correct syntax is "TS dem importer simple.exe" <route_dir> <dem/txt> <x> <y>
    <route_dir>
    Location of your route. Wrap it in quotes if it contains any spaces.
    Example: "C:\Program Files (x86)\Steam\steamapps\common\RailWorks\Content\Routes\0349f149-8da0-40db-b7fc-d45290c5f7dd"

    <dem/txt>
    Location of the DEM that you want to import or a text file containing locations of multiple DEMs (one per line). Wrap it in quotes if it contains any spaces.
    Example: "E:\Landscapes\myDEM.tif" or "E:\Landscapes\list.txt"

    <x> <y>
    Coordinates of your route's origin converted to the datum of your DEM.
    Example: 505608 413000

    5. Let it finish. It will take a while. All the processing is done in a temporary location and then applied to your route so a crash of the tool won't damage your route in any way.

    6. Open your route in the Train simulator route editor and you should see a new landscape.

    About the files
    This is pretty self explainatory but I'll document it anyway. The "binaries" zip file contains just the compiled executable to be used by the end user. The "source" zip file contains the full C# source code of the program in case anyone wants to take a look at it (Warning, it's a bit messy:D).

    I hope I haven't missed anything and that this small documentation is usable.
     

    Attached Files:

    • Like Like x 4
  2. ceejay#9369

    ceejay#9369 New Member

    Joined:
    Dec 30, 2020
    Messages:
    26
    Likes Received:
    1
    I will check this out. It might be of some use to me, To get some high res DEM into TS for Australian and some others I have in mind. The DEM for Australia that can be used by default in the editor, is pretty useless, Being able to use the 5 Meter or 1 Meter is more useful.
     
  3. savvnz

    savvnz New Member

    Joined:
    Jun 7, 2020
    Messages:
    13
    Likes Received:
    25
    Bumping an ancient thread, I know. But I was looking for an easier way to import LiDAR and came across your tool Tomas.

    I followed the instructions but its spitting out this error:

    N:\>"TS Dem importer simple.exe" "L:\ExpandedSteamLibrary\steamapps\common\ts14Alpha\Content\Routes\318238a5-6c83-4257-a868-661e6aa454ec" "N:\ChChDEM\List.txt" 1577323.2719470744 5171625.882780413
    This operation will remove and overwrite any landscape information that is present in your route. Are you sure you want to continue? [no]: yes
    Copying terrain tiles to a temporary location...
    Converting terrain tiles from bin to xml...

    Unhandled Exception: System.ComponentModel.Win32Exception: The system cannot find the file specified
    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
    at System.Diagnostics.Process.Start()
    at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
    at TS_DEM_importer_simple.SysTools.launchProgram(String program, String arguments)
    at TS_DEM_importer_simple.TSTools.bulkConvert(FileInfo[] files)
    at TS_DEM_importer_simple.Program.Main(String[] args)

    The List.txt I have tried with both full paths in the list and as just the .tiff name, I have OSGeo4W installed for GDAL etc. Interested if you have any thoughts!
     
  4. Tomas9970

    Tomas9970 Well-Known Member

    Joined:
    Oct 7, 2018
    Messages:
    1,042
    Likes Received:
    1,050
    Sorry but, I stopped caring about the program (and the process in general) a long time ago so I don't think I remember anything about it anymore. Not to mention how terribly it was written at the time (made for personal use with some docs slapped on top due to high interest from other people) with all the hooks to install directories of other programs, lack of proper XML and most likely a bunch of other things that could break so easily.

    So yeah, this thing always sucked and I'm not proud of it in the slightest but at least it might have inspired the official LIDAR implementation in TSW.
     
  5. dolanbaker

    dolanbaker Active Member

    Joined:
    Dec 29, 2022
    Messages:
    149
    Likes Received:
    131
    Sounds interesting, I was recently experimenting with importing Lidar files and ended up with scenery assets which had the correct contours but none of the attributes of terrain. I will check the app over the next few weeks and see if it works for me.
     
    • Like Like x 1

Share This Page