TransDEM Forum

TransDEM News, Support, Hints and Resources
It is currently 19 Mar 2024 11:37

All times are UTC + 1 hour




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: 08 Mar 2012 12:01 
Offline

Joined: 05 Jan 2011 16:45
Posts: 1459
TransDEM supports Open Street Map (OSM) raster data via its built-in map tile client. But TransDEM cannot directly access the underlying vector data. There are ways around this. Some websites offer vector data in ESRI Shape format (.shp), based on OSM, which TransDEM can read.

This tutorial shows a method to create your own OSM vector data for TransDEM, employing a piece of extra software, JOSM, the Java OSM Editor, and making use of the GPX file format for data exchange between JOSM and TransDEM.

To follow this tutorial you should be familiar with TransDEM and have some basic experience with vector data editors.

This tutorial picks a place named Moramanga in Madagascar, a small market town with a railway junction and a yard and depot. OSM coverage is still rudimentary but that provides a clearer picture when illustrating the individual steps of the tutorial.




  • Part 1: Preparing a path in TransDEM.

    We want to make use of working “along a path”, a feature which also exists in JOSM. For this, we do some preparatory work in TransDEM.

    1. With the TransDEM Map Tile client, navigate to Madagascar (the huge island off the coast in South East Africa), and find Moramanga.

      Image
    2. Zoom in to level 14, focussing on Moramanga, set the the map size to 1024, and download a single map clipping.

      Image
    3. With the built-in TransDEM Simple Route Editor, draw a simple path following the railway lines.

      Image
    4. Save this path in GPX format. I called it “path.gpx”

  • Part 2: Handling OSM Data in JOSM

    The main part of the work in this tutorial will be carried out in JOSM. The task will be to isolate a railway layer from the OSM vector data and export it as a gpx file. You don't need much expertise with JOSM to accomplish this. Most work will be done using the JOSM menus and side-bar windows. In the main window you will have to pan and zoom. To pan, press and drag with the right mouse button. To zoom, use the mouse wheel.

    For a more thorough introduction, have a look at the JOSM Guide. In this tutorial we will not manipulate any data, just download, filter, and copy.

    1. Start JOSM. Form the “File” menu or from the main toolbar click “Open”. Find and select “path.gpx”, created with TransDEM in the first part. The path will show in the main window. At the top right, the layer window will show “path.gpx”

      Image
    2. Select the layer in the Layer window, open the context menu (right mouse button) and select “Download from OSM along this track”.

      Image

    3. Define the download extent in the pop-up window:

      Image

    4. JOSM will split the download into a series of requests. A new layer will be created for the OSM data. Rename it (double click) to “OSM”.

      Image

    5. We will now define a filter to isolate railway-related data. There is no “Railway” layer as such in OSM; we have to create one ourselves. Make sure, the filter window is visible, JOSM main menu: Windows | Filter. In the Filter window (bottom right), click “Add”.
    6. In the filter definition window, enter “railway” as the filter text. This will filter all elements, nodes and ways (the latter including polygons), where the key is “railway”. (See the JOSM Guide and the OSM map features page for the concept of map feature properties in OSM.)

      Image

    7. Apply the filter. Click “E”, “H” and “I”. “E” enables the filter. “H” hides filtered objects and “I” inverses the filter. With this combination, only such objects will be shown, which have a key “railway”. (Feel free to refine the filter, once you have a better understanding of OSM map feature properties.)

      Image
    8. Zoom out (mouse wheel) until the entire data collection downloaded is visible in the JOSM main window. Create a rectangular mask to encompass all data. (Press left mouse button and drag).

      Image
      This will select all elements visible.

      Image
    9. Copy the data onto the clipboard: Ctrl+C, or main menu: “Edit” | “Copy”.
    10. Create a new layer: Ctrl+N, or main menu: “File” | “New Layer”. Rename the new layer “Work”.
    11. Paste the clipboard data into the new layer, Ctrl+V or main menu: “Edit” | “Paste”.
    12. Zoom in again to get a clearer picture. Hide the other two layers, “OSM” and “path.gpx”, clicking the eye icon or selecting “Hide” in the layer context menu.

      Image

      We now have isolated the railway objects in a separate layer. Our basic filter will have included the station building. We could delete it in JOSM, or in TransDEM later, or we could define a better filter, but for this tutorial we just accept tit as it is.

    13. The last step in JOSM is to export our “work” layer as a gpx file. We do this with the layer context menu.

      Image

      I named my file “osm.gpx”.

  • Part 3: Using the Data in TransDEM

    1. Back in TransDEM, delete the vector data of the path, drawn in part 1.
    2. Open “osm.gpx”, OSM railway objects will be shown in TransDEM.

      Image
    3. Zoom in for more detail. All the tracks, including the turning loop, will appear. The station building will appear, too. Delete if you want to.

      Image
    4. That's it.


You can create similar filters to extract roads, waterways and other polyline features and repeat the process, but you will have to familiarise yourself with OSM map feature properties for this, see above. Remember that TransDEM only supports one feature layer at a time when exporting to Trainz.


Top
 Profile  
 
PostPosted: 13 Mar 2012 18:14 
Offline

Joined: 17 Feb 2012 13:45
Posts: 3
Hi Roland! I have tried that method and results are good. You have pointed that station buildings can be easily deleted if you don't need it. I have stations borders polylined but when I tried to edit for deleting in TransDEM I couldn't find tool for it. Do I need to export to Trainz first?


Top
 Profile  
 
PostPosted: 13 Mar 2012 18:27 
Offline

Joined: 05 Jan 2011 16:45
Posts: 1459
piergav wrote:
I have stations borders polylined but when I tried to edit for deleting in TransDEM I couldn't find tool for it.
Select the unwanted polyline in the TransDEM Simple Route Editor and press [Del], or right-click and call "Remove Polyline" from the context menu.


Top
 Profile  
 
PostPosted: 14 Feb 2013 22:52 
Offline

Joined: 14 Feb 2013 07:20
Posts: 4
I know this is kinda old, but I discovered something I wanted to add - if you choose to export other splines from JOSM (such as roads) and your "railway" filter included railroad crossings, it seems that those crossings will end up with the roads and the tracks (despite using TransDem to export them to the route separately) "coupled togther" at those points. You can use this to know where to place crossings if you're unsure, but either way to get around it just delete the road splines that are immediately connected to the tracks and then redraw them over the tracks - this will remove the "junction" there and fix your track alignments.


Top
 Profile  
 
PostPosted: 26 Jan 2015 22:19 
Offline

Joined: 15 Nov 2014 07:21
Posts: 17
I downloaded a file folder that has all us rail lines in it. It has two .shp files in it, rail_lines and rail_nodes. How do I get them into Trans-dem and do I use one or both files? I think I got the file off this site somewhere. If I need to I can try and find the post for you to look at. Thanks in advance. Found the post on, 1 resources, 2 all the rail lines in the us for Transdem.


Top
 Profile  
 
PostPosted: 27 Jan 2015 19:47 
Offline

Joined: 05 Jan 2011 16:45
Posts: 1459
Jayco-man wrote:
I downloaded a file folder that has all us rail lines in it. It has two .shp files in it, rail_lines and rail_nodes. How do I get them into Trans-dem and do I use one or both files? I think I got the file off this site somewhere. If I need to I can try and find the post for you to look at. Thanks in advance. Found the post on, 1 resources, 2 all the rail lines in the us for Transdem.

See here: Re: All the Rail Lines in the US for TransDEM


Top
 Profile  
 
PostPosted: 21 Jun 2022 10:50 
Offline

Joined: 31 May 2021 17:48
Posts: 18
Sorry for bumping this old topic, but I ran this tutorial and created my route, but when importing it into TransDEM, the route is skewed; you can clearly see where the track should be, along the valley, and where it was placed:

Image


Top
 Profile  
 
PostPosted: 21 Jun 2022 10:54 
Offline

Joined: 31 May 2021 17:48
Posts: 18
These numbers are different, looks like a JOSM issue, not TransDEM..

Image

Image


Top
 Profile  
 
PostPosted: 21 Jun 2022 17:10 
Offline

Joined: 05 Jan 2011 16:45
Posts: 1459
Check with map tiles first. Load an OSM raster map on top of your DEM. Does it fit? As there are no projection variables with OSM map tiles (apart from a different UTM zone), it can be used as a reference.


Top
 Profile  
 
PostPosted: 21 Jun 2022 18:33 
Offline

Joined: 31 May 2021 17:48
Posts: 18
I don't think that is the issue.

Here is the DEM with the raster map tile AND rough route loaded in TransDEM, the coordinates are ok:

Image

All the OSM UTM tiles were exported to Trainz and fit perfectly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  
cron

Imprint & Privacy

Powered by phpBB® Forum Software © phpBB Group