Help to create GPX to underground train track

In São Paulo there’s a subway that has driverless trains, so it’s easy to take a video showing the train going forward. https://www.youtube.com/watch?v=4qQp6AiWDWE

The path that the train goes underground is already mapped on OSM: http://www.openstreetmap.org/way/270082121

What are the steps that one need to take in order to do something like this? http://mapillary.github.io/mapillary_examples/commuteskane-trip1.html

I was wondering, that I might need to craft a GPX file with a random timestamp considering the speed that the train goes from station to station. However obviously this speed is not constant, so I’d have to take in account the train acceleration and deacceleration. I thought that a good enough approximation could be considering that first X seconds of acceleration have a Y km/h speed.

Anyways, what are your thoughts about this?

Thanks.

The lights in the tunnel seem to have a fairly constant distance between them. You could use it to calculate distance or speed along the track and use that to make your gpx file
Ask @peter if you need to fill the altitude field as well, so they know it is underground

You need to use something like ST_Line_Interpolate_Point in PostGIS

I have no idea on how to do that. Can you help? :blush:

In ideal theory, 3d reconstruction should be able to reconstruct the whole sequence without any gps, and then you would only need to scale the resulting gpx trace, and place it correctly on the map. Or without additional work at all, if you record from entering to exiting the subway, where you have a GPS fix in both points. I don’t know if something like this is possible in practice, due to all those inaccuracies involved.
I also wonder if it could be possible to upload an untagged sequence along with an (approximate) gpx trace, and the algorithm fitting the sequence to the trace (e.g. correcting timing), and, optionally, optimizing the trace from the pictures.

I managed to split the video between every station and get a GPX file from OSM way. The GPX file looks like this:

<?xml version="1.0" standalone="yes"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="KML2GPX.COM" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
    <metadata>
        <name><![CDATA[Converted from a KML file using KML2GPX.COM]]></name>
        <desc><![CDATA[Converted from a KML file KML2GPX.COM]]></desc>
    </metadata>
    <trk>
        <name><![CDATA[Track no: 1]]></name>
        <desc><![CDATA[This is track no: 1]]></desc>
        <number>1</number>
        <trkseg>
            <trkpt lat="-23.571860" lon="-46.708036"><!-- Butantã 00:10 -> Pinheiros 01:25 -->
                <ele>0</ele>
                <time>2012-01-16T07:25:07Z</time>
            </trkpt>
            <trkpt lat="-23.568891" lon="-46.705568">
                <ele>0</ele>
            </trkpt>
            <trkpt lat="-23.568519" lon="-46.705244">
                <ele>0</ele>
            </trkpt>
            <trkpt lat="-23.568223" lon="-46.704958">
                <ele>0</ele>
            </trkpt>
            <trkpt lat="-23.567991" lon="-46.704631">
                <ele>0</ele>
            </trkpt>
            <trkpt lat="-23.567800" lon="-46.704277">
                <ele>0</ele>
            </trkpt>
            <trkpt lat="-23.567660" lon="-46.703824">
                <ele>0</ele>
            </trkpt>
            <trkpt lat="-23.567284" lon="-46.701939">
                <ele>0</ele>
                <time>2012-07-20T07:26:40Z</time>
            </trkpt>
        </trkseg>
    </trk>
</gpx>

Only the start and end points have a time tag. Do you know if this is sufficient to upload the video? I’d manually ajust the position later, making the initial and final pictures more close together.

Download the free program geosetter (windows) and drag the photos to the right place on a map and save them. Now they have latitude and longitude in the exif and you can upload them

Took the saturday to code a solution. Meet gpxcrafttime:

http://nighto.github.io/gpxcrafttime/

You enter a GPX file with no time information (such as the one on the example above) and a timerange and it outputs a GPX with the interpolated coordinates, one for each second:

<?xml version="1.0" standalone="yes" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="http://nighto.github.io/gpxcrafttime/" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
    <trk>
        <trkseg>
            <trkpt lat="-23.571860" lon="-46.708036">
                <time>2012-01-16T00:00:10.000Z</time>
            </trkpt>
            <trkpt lat="-23.571778" lon="-46.707967">
                <time>2012-01-16T00:00:11.000Z</time>
            </trkpt>
            <trkpt lat="-23.571695" lon="-46.707899">
                <time>2012-01-16T00:00:12.000Z</time>
            </trkpt>
            <trkpt lat="-23.571613" lon="-46.707830">
                <time>2012-01-16T00:00:13.000Z</time>
            </trkpt>
            <trkpt lat="-23.571530" lon="-46.707762">
                <time>2012-01-16T00:00:14.000Z</time>
            </trkpt>
            <trkpt lat="-23.571448" lon="-46.707693">
                <time>2012-01-16T00:00:15.000Z</time>
            </trkpt>
            <trkpt lat="-23.571365" lon="-46.707625">
                <time>2012-01-16T00:00:16.000Z</time>
            </trkpt>
            <trkpt lat="-23.571283" lon="-46.707556">
                <time>2012-01-16T00:00:17.000Z</time>
            </trkpt>
            <trkpt lat="-23.571200" lon="-46.707488">
                <time>2012-01-16T00:00:18.000Z</time>
            </trkpt>
            <trkpt lat="-23.571118" lon="-46.707419">
                <time>2012-01-16T00:00:19.000Z</time>
            </trkpt>
            <trkpt lat="-23.571035" lon="-46.707350">
                <time>2012-01-16T00:00:20.000Z</time>
            </trkpt>
            <trkpt lat="-23.570953" lon="-46.707282">
                <time>2012-01-16T00:00:21.000Z</time>
            </trkpt>
            <trkpt lat="-23.570870" lon="-46.707213">
                <time>2012-01-16T00:00:22.000Z</time>
            </trkpt>
            <trkpt lat="-23.570788" lon="-46.707145">
                <time>2012-01-16T00:00:23.000Z</time>
            </trkpt>
            <trkpt lat="-23.570705" lon="-46.707076">
                <time>2012-01-16T00:00:24.000Z</time>
            </trkpt>
            <trkpt lat="-23.570623" lon="-46.707008">
                <time>2012-01-16T00:00:25.000Z</time>
            </trkpt>
            <trkpt lat="-23.570540" lon="-46.706939">
                <time>2012-01-16T00:00:26.000Z</time>
            </trkpt>
            <trkpt lat="-23.570458" lon="-46.706871">
                <time>2012-01-16T00:00:27.000Z</time>
            </trkpt>
            <trkpt lat="-23.570376" lon="-46.706802">
                <time>2012-01-16T00:00:28.000Z</time>
            </trkpt>
            <trkpt lat="-23.570293" lon="-46.706733">
                <time>2012-01-16T00:00:29.000Z</time>
            </trkpt>
            <trkpt lat="-23.570211" lon="-46.706665">
                <time>2012-01-16T00:00:30.000Z</time>
            </trkpt>
            <trkpt lat="-23.570128" lon="-46.706596">
                <time>2012-01-16T00:00:31.000Z</time>
            </trkpt>
            <trkpt lat="-23.570046" lon="-46.706528">
                <time>2012-01-16T00:00:32.000Z</time>
            </trkpt>
            <trkpt lat="-23.569963" lon="-46.706459">
                <time>2012-01-16T00:00:33.000Z</time>
            </trkpt>
            <trkpt lat="-23.569881" lon="-46.706391">
                <time>2012-01-16T00:00:34.000Z</time>
            </trkpt>
            <trkpt lat="-23.569798" lon="-46.706322">
                <time>2012-01-16T00:00:35.000Z</time>
            </trkpt>
            <trkpt lat="-23.569716" lon="-46.706254">
                <time>2012-01-16T00:00:36.000Z</time>
            </trkpt>
            <trkpt lat="-23.569633" lon="-46.706185">
                <time>2012-01-16T00:00:37.000Z</time>
            </trkpt>
            <trkpt lat="-23.569551" lon="-46.706116">
                <time>2012-01-16T00:00:38.000Z</time>
            </trkpt>
            <trkpt lat="-23.569468" lon="-46.706048">
                <time>2012-01-16T00:00:39.000Z</time>
            </trkpt>
            <trkpt lat="-23.569386" lon="-46.705979">
                <time>2012-01-16T00:00:40.000Z</time>
            </trkpt>
            <trkpt lat="-23.569303" lon="-46.705911">
                <time>2012-01-16T00:00:41.000Z</time>
            </trkpt>
            <trkpt lat="-23.569221" lon="-46.705842">
                <time>2012-01-16T00:00:42.000Z</time>
            </trkpt>
            <trkpt lat="-23.569138" lon="-46.705774">
                <time>2012-01-16T00:00:43.000Z</time>
            </trkpt>
            <trkpt lat="-23.569056" lon="-46.705705">
                <time>2012-01-16T00:00:44.000Z</time>
            </trkpt>
            <trkpt lat="-23.568973" lon="-46.705637">
                <time>2012-01-16T00:00:45.000Z</time>
            </trkpt>
            <trkpt lat="-23.568891" lon="-46.705568">
                <time>2012-01-16T00:00:46.000Z</time>
            </trkpt>
            <trkpt lat="-23.568817" lon="-46.705503">
                <time>2012-01-16T00:00:47.000Z</time>
            </trkpt>
            <trkpt lat="-23.568742" lon="-46.705438">
                <time>2012-01-16T00:00:48.000Z</time>
            </trkpt>
            <trkpt lat="-23.568668" lon="-46.705374">
                <time>2012-01-16T00:00:49.000Z</time>
            </trkpt>
            <trkpt lat="-23.568593" lon="-46.705309">
                <time>2012-01-16T00:00:50.000Z</time>
            </trkpt>
            <trkpt lat="-23.568519" lon="-46.705244">
                <time>2012-01-16T00:00:51.000Z</time>
            </trkpt>
            <trkpt lat="-23.568445" lon="-46.705173">
                <time>2012-01-16T00:00:52.000Z</time>
            </trkpt>
            <trkpt lat="-23.568371" lon="-46.705101">
                <time>2012-01-16T00:00:53.000Z</time>
            </trkpt>
            <trkpt lat="-23.568297" lon="-46.705029">
                <time>2012-01-16T00:00:54.000Z</time>
            </trkpt>
            <trkpt lat="-23.568223" lon="-46.704958">
                <time>2012-01-16T00:00:55.000Z</time>
            </trkpt>
            <trkpt lat="-23.568165" lon="-46.704876">
                <time>2012-01-16T00:00:56.000Z</time>
            </trkpt>
            <trkpt lat="-23.568107" lon="-46.704794">
                <time>2012-01-16T00:00:57.000Z</time>
            </trkpt>
            <trkpt lat="-23.568049" lon="-46.704713">
                <time>2012-01-16T00:00:58.000Z</time>
            </trkpt>
            <trkpt lat="-23.567991" lon="-46.704631">
                <time>2012-01-16T00:00:59.000Z</time>
            </trkpt>
            <trkpt lat="-23.567943" lon="-46.704543">
                <time>2012-01-16T00:01:00.000Z</time>
            </trkpt>
            <trkpt lat="-23.567895" lon="-46.704454">
                <time>2012-01-16T00:01:01.000Z</time>
            </trkpt>
            <trkpt lat="-23.567848" lon="-46.704365">
                <time>2012-01-16T00:01:02.000Z</time>
            </trkpt>
            <trkpt lat="-23.567800" lon="-46.704277">
                <time>2012-01-16T00:01:03.000Z</time>
            </trkpt>
            <trkpt lat="-23.567765" lon="-46.704164">
                <time>2012-01-16T00:01:04.000Z</time>
            </trkpt>
            <trkpt lat="-23.567730" lon="-46.704050">
                <time>2012-01-16T00:01:05.000Z</time>
            </trkpt>
            <trkpt lat="-23.567695" lon="-46.703937">
                <time>2012-01-16T00:01:06.000Z</time>
            </trkpt>
            <trkpt lat="-23.567660" lon="-46.703824">
                <time>2012-01-16T00:01:07.000Z</time>
            </trkpt>
            <trkpt lat="-23.567639" lon="-46.703719">
                <time>2012-01-16T00:01:08.000Z</time>
            </trkpt>
            <trkpt lat="-23.567618" lon="-46.703615">
                <time>2012-01-16T00:01:09.000Z</time>
            </trkpt>
            <trkpt lat="-23.567597" lon="-46.703510">
                <time>2012-01-16T00:01:10.000Z</time>
            </trkpt>
            <trkpt lat="-23.567576" lon="-46.703405">
                <time>2012-01-16T00:01:11.000Z</time>
            </trkpt>
            <trkpt lat="-23.567556" lon="-46.703300">
                <time>2012-01-16T00:01:12.000Z</time>
            </trkpt>
            <trkpt lat="-23.567535" lon="-46.703196">
                <time>2012-01-16T00:01:13.000Z</time>
            </trkpt>
            <trkpt lat="-23.567514" lon="-46.703091">
                <time>2012-01-16T00:01:14.000Z</time>
            </trkpt>
            <trkpt lat="-23.567493" lon="-46.702986">
                <time>2012-01-16T00:01:15.000Z</time>
            </trkpt>
            <trkpt lat="-23.567472" lon="-46.702882">
                <time>2012-01-16T00:01:16.000Z</time>
            </trkpt>
            <trkpt lat="-23.567451" lon="-46.702777">
                <time>2012-01-16T00:01:17.000Z</time>
            </trkpt>
            <trkpt lat="-23.567430" lon="-46.702672">
                <time>2012-01-16T00:01:18.000Z</time>
            </trkpt>
            <trkpt lat="-23.567409" lon="-46.702567">
                <time>2012-01-16T00:01:19.000Z</time>
            </trkpt>
            <trkpt lat="-23.567388" lon="-46.702463">
                <time>2012-01-16T00:01:20.000Z</time>
            </trkpt>
            <trkpt lat="-23.567368" lon="-46.702358">
                <time>2012-01-16T00:01:21.000Z</time>
            </trkpt>
            <trkpt lat="-23.567347" lon="-46.702253">
                <time>2012-01-16T00:01:22.000Z</time>
            </trkpt>
            <trkpt lat="-23.567326" lon="-46.702148">
                <time>2012-01-16T00:01:23.000Z</time>
            </trkpt>
            <trkpt lat="-23.567305" lon="-46.702044">
                <time>2012-01-16T00:01:24.000Z</time>
            </trkpt>
            <trkpt lat="-23.567284" lon="-46.701939">
                <time>2012-01-16T00:01:25.000Z</time>
            </trkpt>
        </trkseg>
    </trk>
</gpx>

Hope it is useful for someone. Now the video is uploading to Mapillary and I’ll know soon if this works. :slight_smile:

And it worked! :smile:

http://www.mapillary.com/map/im/0dJe-DB5GgzBC0T_cRa3-A/photo

I uploaded a first sequence, between two stations. There’s work to be done regarding acceleration/deacceleration, - the script creates the points on the same distance, as in the speed is constant, but that obviously is not the case. But for a first try it is good enough, I think. Now I’ll upload the rest of the sequence then maybe just drag the points near the station a little closer together.

Wrote down how I did it: https://www.openstreetmap.org/user/Nighto/diary/37313