Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 41

Thread: Toward automatic route creation from map data

  1. #1

    Default Toward automatic route creation from map data

    Greetings all,

    I have been experimenting with a “big data” approach to automatically create routes, where data from Google Maps and OpenRailwayMaps is used to automatically lay track without using the route editor. This would obviously allow for the creation of huge routes very quickly. So far I have achieved:

    • Extracting the long/lat of straights, curves and switches of any Open Railways map.
    • Converting the longitude and latitude into meters
    • Calculating the angle and radius of curvature for each curve and switch and distances for all straights


    At the bottom is an example of the railroads of Longview, TX.
    What I am trying to figure out now:

    • How to convert long/lat into the “tile numbers” and xyz positions of the route editor. RouteRiter can do this but it would require a lot of copy and pasting. I want to do it automatically, and there must be an equation on this somewhere.
    • Any good tutorials on qdirection?
    • Elevation (I can get it from Google Maps api). I've installed DEMEX for terrain.


    Once I figure out these things, I’m going to try to start programatically laying tracks and seeing how they compare to the real world. Any other suggestions or information? I Googled this concept a lot and it seems like there are many ways to put markers in MSTS but no one has tried track laying automatically.
    -Dave

    Explanation of the map: Blue is a through railroad point, green is a switch, red is an endpoint, and yellow is a point adjacent to a switch.

    longview.jpg

    wye.jpg

  2. #2
    Join Date
    Oct 2015
    Location
    Poland
    Posts
    171

    Default

    Good luck, but you did maybe 1% of work needed ..

    How to convert long/lat into the “tile numbers” and xyz positions of the route editor. RouteRiter can do this but it would require a lot of copy and pasting. I want to do it automatically, and there must be an equation on this somewhere.
    C# original code:
    https://github.com/twpol/msts-tools/...Coordinates.cs
    or
    TSRE C++ implementation:
    https://github.com/GokuMK/TSRE5/blob.../IghCoords.cpp

    Any good tutorials on qdirection?
    Use some math 3D library, like http://glmatrix.net/
    If you want to learn about this, look for "Quaternion".

    Elevation (I can get it from Google Maps api). I've installed DEMEX for terrain.
    If you want to work with terrain elevation, you need to make your own code anyway.

    Once I figure out these things, I’m going to try to start programatically laying tracks and seeing how they compare to the real world. Any other suggestions or information? I Googled this concept a lot and it seems like there are many ways to put markers in MSTS but no one has tried track laying automatically.
    Maybe because no one, except me (and maybe JKY), doesn't know how to place tracks at all.

    Of course feel free to use TSRE TDB functions. Placing tracks is 1429 line "placeTrack" function.
    https://github.com/GokuMK/TSRE5/blob/master/TDB.cpp
    Last edited by GokuMK; 07-14-2017 at 11:30 AM.

  3. #3
    Join Date
    Oct 2015
    Location
    Poland
    Posts
    171

    Default

    Now I think, you can only place static shapes and add them to TDB in Route Editor. It will be much easier than creating TDB data.
    Last edited by GokuMK; 07-14-2017 at 12:02 PM.

  4. #4

    Default

    Quote Originally Posted by GokuMK View Post
    Now I think, you can only place static shapes and add them to TDB in Route Editor. It will be much easier than creating TDB data.
    Thanks for your insight! I'll start converting the functions into Python, which is what I'm using, so I can include elevation as well. I figure I'll lay the tracks programatically and then generate the track database in MSTS's editor.

  5. #5

    Default

    I think the issue will be having your algorithm automatically pick the right track piece to be used for a given track vector. I imagine an iterative process would need to be used to fine tune the lengths needed, from a given tsection.

    Further on, how it would treat switches, sidings etc, as there is no info in google earth to mark these out as unique

  6. #6

    Default

    Good luck -- you'll want to have some way of controlling your grade changes -- elevation data can vary, so knowing when you're bridging a gap with trestle, viaduct, etc. isn't necessarily something you can predict or interpret from GIS or DEM.

    Also keep in mind that laying track is only about 5-10% of the work involved in creating a route.

  7. #7
    Join Date
    Apr 2007
    Location
    Swindon, England
    Posts
    3,655

    Default

    Interesting concept but as Eric notes, tracklaying is the relatively easy part of route building in any of the sims. The real work comes painting and decorating all that terrain plus adding in signalling etc. Also I haven't spent much time on Open Rail Map but I assume it is derived from OSM, which in many locations gives the barest representation of the railway and doesn't have accurate yard or track layout - literally just a single vector line. In many locations not entirely accurate. In Trainz (not MSTS but principle the same) I recently transposed OSM data over the DEM for a North Korea - of all places - branch line. Where the route should have been hugging one side of the valley wall, when I opened the route to edit it was criss crossing one side to the other, the river in places was up the side of the canyon. So OSM isn't necessarily all that accurate.

    And on the subject of Transdem, that programme does something similar in that it will lay a basic single track spline on a traced vector path, but again that is so inaccurate as to be virtually useless. Better off working from scratch and laying out the track manually. A route editor with a mapping overlay (as I believe TSRE offers) is useful as it avoids having to tediously plot out markers in GE first.

    There are also many disused or abandoned lines which are often a popular target for train simmers. However these don't always appear on OSM, where they have been added the data is sometimes later removed by other contributors and, again, rarely shoes the track layout that existed when the line was open.

    With regard to elevation and gradient, even DEM data doesn't always define where the railway line is on an embankment (fill) or cutting or even tunnel which is where detailed markers based on topographic mapping or aerial photography and knowledge of the prototype comes in.

    Good luck with the project and any attempt to improve or ease the route building workload is welcome but it has to offer a significant gain over the two systems (for MSTS) we now have.
    Vern.

  8. #8

    Default

    Quote Originally Posted by NorthernWarrior View Post
    Interesting concept but as Eric notes, tracklaying is the relatively easy part of route building in any of the sims. The real work comes painting and decorating all that terrain plus adding in signalling etc. Also I haven't spent much time on Open Rail Map but I assume it is derived from OSM, which in many locations gives the barest representation of the railway and doesn't have accurate yard or track layout.
    Excellent points! For the areas I'm looking at, there seems to be a lot of details, including switches and crossovers and buildings. I wonder if the easier "route" would be to still do track laying manually but then add buildings automatically, as Google Earth has most buildings in the US at least and I wouldn't have to worry about the track vectors.

  9. #9

    Default

    Quote Originally Posted by joe_star View Post
    Further on, how it would treat switches, sidings etc, as there is no info in google earth to mark these out as unique
    Open Railway Maps seems to have switches and sidings for most American cities. I'd have to look up what the data they have for the rest of the world.

  10. #10

    Default

    So it's not track yet but it is automatically placed trees where the markers are. Oddly they are off 0.2-2 m, which might be the different way that Python rounds floats vs C#. Also ViewDbSphere in the world files is killing me, but it is a start!

    MarkerTrees.jpg

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •