Posts: 21
Threads: 4
Joined: Apr 2016
11.05.2020, 16:36
I hope someone on here can help, I've searched high and low for an animated map that will synchronise to time stamps in a GPS file.
Basically from a train cab-ride video I have used RouteConverter to record points of interest against the elapsed time from the start of the video. This has given me a list of some 300 waypoints like so:
LAT LONG Time DESCRIPTION
53.7557820, -2.7075300, 00:00:28 Platform 3; Preston Station
53.7570980, -2.7077790, 00:00:53 Fishergate
53.7595130, -2.7097000, 00:01:14 Ring Way; PR1 8YN Preston; England; United Kingdom
53.7604390, -2.7112230, 00:01:26 Preston North Junction
53.7610960, -2.7121300, 00:01:31 Crossover to the right
53.7620230, -2.7132080, 00:01:38 Crossover from the right
53.7627810, -2.7139190, 00:01:42 Over-bridge Pedder Street; PR2 2QT Preston; England; United Kingdom
So at 28 seconds from the start I need to add a pointer at "Platform 3", then at 53 seconds move the pointer to "Fishergate", after 1 minute and 14 seconds move to "Ring Way" and so on.
I have tried Google Earth, but as far as I can see it will only animate the map at a constant speed and the program runs so slow the imagery can't keep up with the train!
Thanks in anticipation,
Roger B
Posts: 21
Threads: 4
Joined: Apr 2016
12.05.2020, 19:15
(This post was last modified: 12.05.2020, 19:19 by Roger B.)
After a lot more searching I still haven't found exactly what I want, so I've figured out a work-around. This involves using a utility called "Keyboard and Mouse Simulator" (KBMS), obtainable from here:
https://www.softpedia.com/get/System/Sys...ator.shtml
Basically I've set it up to work in conjunction with RouteConverter so that it simulates the down arrow key at regular intervals to scroll the map as the train journey (on video) progresses.
I used the following routine in KBMS:
[REPEAT #1] x20
[WAIT] 7500
[PRESSKEY] [1] 40;down
[END-REPEAT #1]
Note that the [WAIT] setting of 7500 mSec gives an overall delay of about 15 Sec in real life, this is because the [REPEAT] function is in itself slow, and the timing of the loop probably depends on what else is going on in the computer at the same time.
NOTE: The Project Setting "On simulation/record start" must be set to "Move to system tray" otherwise KBMS always stays in focus and it scrolls down its own listing!
This is what you do:
Start KBMS and load the project you wish to use.
Start RouteConverter and load the map and position list.
Click the start item in the position list, this also makes sure the position list is in focus.
Press F5, this is the default hot-key to start the KBMS routine running, (F6 is the default stop key). At this point KBMS should disappear onto the system tray and focus passed to the position list. It's best not to have any other windows open at the time if possible to ensure that focus does go to RouteConverter, check the taskbar to make sure.
The map pointer in RouteConverter should make its way along the track as the video plays. In order to keep sync I set the waypoints at regular intervals, for the train I used 15 secs. It's trial and error to set the [WAIT] parameter in KBMS. If you get out of sysnc you can always use the mouse to select another position in the list and waypoint selection will carry on from there.
Posts: 21
Threads: 4
Joined: Apr 2016
Further to my last post, I can say this method also works for Google earth.
Modfy the KBMS routine to
[REPEAT #1] x20
[WAIT] 7500
[PRESSKEY] [1] 40;down
[PRESSKEY] [1] 43;return
[END-REPEAT #1]
Export the waypoint list in KML3 format and load into Google Earth. Make the waypoints visible (optional) and select the starting point.
Make sure that the relative positions on the taskbar of Google Earth and KBMS are such that when the latter disappears into the system tray focus is handed to Google Earth. Press F5 to start KBMS.
Posts: 7,419
Threads: 223
Joined: Aug 2007
Dear Roger,
thank you for your descriptions. I've heard this kind of questions before – now there is a thread in the forum to point to :-)
--
Christian
Posts: 21
Threads: 4
Joined: Apr 2016
Marking 15 second intervals on the map is well and good, but it's much easier to mark landmarks such as bridges but this results in varying time intervals between waypoints.
Keyboard and Mouse Simulator (KBMS) can't handle this easily so I wrote a routine in Visual Basic for Applications (VBA) hosted on Excel 365 to read a file exported from Route Converter and send down-key keystrokes at the required intervals to Route Converter.
Sub Steps() 'invoked by a "Start Buttton" on the spreadsheet
PointCount = 0
Open "c:\Temp\StepData.csv" For Input As 1
Line Input #1, a$ 'strip header
Input #1, aa$, ab$, ac$, ad$, ae$, af$, ag$, ah$, ai$, aj$, ak$, al$, am$, an$, ao$ '1st data line
InitialTime = Val(Mid$(ad$, 1, 2)) * 3600 + Val(Mid$(ad$, 3, 2)) * 60 + Val(Mid$(ad$, 5, 2)) 'Seconds
ActiveSheet.Cells(2, 9).Select
ActiveCell.Value = "Loading data from file"
On Error Resume Next
Do 'Load array with timing intervals
Input #1, aa$, ab$, ac$, ad$, ae$, af$, ag$, ah$, ai$, aj$, ak$, al$, am$, an$, ao$ 'Subsequent data lines
Time2 = Val(Mid$(ad$, 1, 2)) * 3600 + Val(Mid$(ad$, 3, 2)) * 60 + Val(Mid$(ad$, 5, 2)) - InitialTime 'Seconds
Interval = Time2 - Time1
PointCount = PointCount + 1
Waitlist(PointCount) = Interval
Time1 = Time2
Loop Until EOF(1)
Close
ActiveCell.Value = "Data loaded, 10sec. to select start position"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10 'wait 10 secs before executing sendkeys
Application.Wait TimeSerial(newHour, newMinute, newSecond) 'Time delay to allow selection of target window
For n! = 1 To PointCount
ActiveCell.Value = "Line " + Str$(n!) + "/" + Str$(PointCount) + " Interval" + Str$(Waitlist(n!))
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + Waitlist(n!) 'WaitList(n!) is the interval
Application.Wait TimeSerial(newHour, newMinute, newSecond) 'Wait for the duration of the interval
SendKeys "{DOWN}", False 'NB There is a bug in VBA which causes NumLocks to switch off !!
Next
End
End Sub
1) Export the position list as waypoints to c:\Temp\StepData.csv
2) Press the start button and the routine opens c:\Temp\StepData.csv, gives you about 10 seconds to click on the 1st entry in the position list and then starts outputting down-key keystrokes.
3) Do not click on any other windows until the program finishes, otherwise those keystrokes will be sent to the program you click on!
4) Always use copies of your data files in case anything goes wrong. Under Microsoft Excel and Windows 10 it won't of course.
5) To interrupt the routine press Ctrl-Break (Ctrl-Pause on some keyboards).
6) There is a bug in the SendKeys instruction which switches Num Locks off.
This is the bare bones of a larger application I'm working on which will automatically switch to Route Converter and allow the user to select which file to import and so on.
Posts: 7,419
Threads: 223
Joined: Aug 2007
Do I understand you correctly, that you use a Track type position list and use the red/black bubble selection mark on the map and 15s intermediate positions to roughly display in realtime where a train is located? And you play that animation and record it next to a video showing the train?
--
Christian
Posts: 21
Threads: 4
Joined: Apr 2016
(24.05.2020, 10:25)routeconverter Wrote: Do I understand you correctly, that you use a Track type position list and use the red/black bubble selection mark on the map and 15s intermediate positions to roughly display in realtime where a train is located? And you play that animation and record it next to a video showing the train?
Yup.
I'm moving on at a pace with this at the moment. I can now read the position list (as an exported file), calculate the time intervals between points and move the map in relation to these intervals, thus keeping more closely in sync with the train.
Some time ago I wrote a parsing routine for GPX files which I may incorporate in this project to save having to export a CSV file.
This is a typical train video https://www.youtube.com/watch?v=OK7UcDVOJ8Q&t=5s
Posts: 7,419
Threads: 223
Joined: Aug 2007
(24.05.2020, 18:23)Roger B Wrote: This is a typical train video https://www.youtube.com/watch?v=OK7UcDVOJ8Q&t=5s
But there is no map visible? Just place names and the speed limit.
--
Christian
Posts: 21
Threads: 4
Joined: Apr 2016
(28.05.2020, 05:41)routeconverter Wrote: (24.05.2020, 18:23)Roger B Wrote: This is a typical train video https://www.youtube.com/watch?v=OK7UcDVOJ8Q&t=5s
But there is no map visible? Just place names and the speed limit. That's right. That's where the fun begins, you run the video on one screen with RouteConverter on the other and as the video progresses you mark the points on the map, and enter the elapsed time to the points list. You need to stop the video to do this, and it helps if you can skip back and forth a frame at a time.
The points would typically be bridges, stations, tunnels and so on. I've counted overhead gantries to get a fix, but that only works on electrified lines.
Using Google Earth as the map you certainly appreciate the work done during the war by the people who interpreted aerial photographs!
|